[ESS] ess-mode: Wrong type argument: syntax-table-p, nil

Thorsten Jolitz tjolitz at gmail.com
Mon Jun 10 10:53:46 CEST 2013


Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk> writes:

Hi List

>  > Should we also consider renaming 'ess-mode' to something else? It is
>  > quite confusing for beginners in a sense of a major mode. Just some
>  > thoughts. 
>
> Thanks - but I don't think we need to rename it.  The function
> ess-mode is fairly hidden now, since I made it
> non-interactive.  Further, it is not mentioned in our documentation,
> so we should be okay.  

I'm following up to this very old thread, because I just hit exactly the
same problem described in this thread. I run

,----------------------------------------------------------------
| Emacs Version:
| (24.3.1 24 3 gnu/linux hostname x86_64-unknown-linux-gnu x nil)
| 
| ess-version is a variable defined in `ess-custom.el'.
| Its value is "5.15"
`----------------------------------------------------------------

In a program, I use something along the line of 

,--------------------------------------------
| (funcall (get-buffer-mode buffer))
`--------------------------------------------

where `get-buffer-mode' does nothing but "Return major mode of
BUFFER-OR-STRING.":

,---------------------------------------------
| (defun get-buffer-mode (buffer-or-string)
|   (with-current-buffer buffer-or-string
|      major-mode))
`---------------------------------------------

This worked so far for other modes like `emacs-lisp-mode' or
`picolisp-mode', but causes the

,-----------------------------------------
| Wrong type argument: syntax-table-p, nil
`-----------------------------------------

error with `R-mode', since `major-mode' returns `ess-mode' even if
`R-mode' is active. I had to work around this with code like this

,---------------------------------------
| (let ((mode (get-buffer-mode buffer)))
|   ;; special case R-mode
|   (if (eq mode 'ess-mode)
|       (funcall 'R-mode)
|     (funcall mode)))
`---------------------------------------

and it works for me now, but I would still consider it a bug that
`R-mode' returns `ess-mode' as major-mode.

-- 
cheers,
Thorsten



More information about the ESS-help mailing list