[ESS] File mode specification error: (void-function run-mode-hook)

Martin Maechler maechler at stat.math.ethz.ch
Thu Jan 22 10:17:13 CET 2009


>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>>     on Thu, 22 Jan 2009 09:55:09 +0100 writes:

>>>>> "RoSp" == Rodney Sparapani <rsparapa at mcw.edu>
>>>>>     on Wed, 21 Jan 2009 09:19:58 -0600 writes:

    RoSp> Jianjie Ma wrote:
    >>> HI,
    >>> 
    >>> I am new to ESS and Emacs.
    >>> 
    >>> Here is my problem.
    >>> 
    >>> The ESS is put in the directory ~/ess/ess-5.3.10
    >>> 
    >>> In my ~/.emacs file, I added (load
    >>> "~/ess/ess-5.3.10/lisp/ess-site").
    >>> 
    >>> R is installed in ~/Rlang, the version is 2.8.1.
    >>> 
    >>> Emacs is version 21.3.1.
    	      	 ^^^^^^^^^^^^^^

    >>> ESS works and loaded. It works fine for programming and
    >>> running, that is I can start with M-x R and M-x SAS and
    >>> then program and evaluate codes.
    >>> 
    >>> The problem is when using the auto-mode of Emacs.
    >>> 
    >>> When I open a file, for example, ~/test.R, the R-mode
    >>> should be automatically selected since the "ess-site.el
    >>> "specified the auto R-mode for files with suffix
    >>> ".R". However I got the error "File mode specification
    >>> error: (void-function run-mode-hook)" though the file
    >>> can be opened and I can still evaluate the R code.
    >>> 
    >>> And also, the highlighting and fonting features are not
    >>> shown.
    >>> 
    >>> Same Error happened when I tried to open files with
    >>> suffix ".sas".
    >>> 
    >>> Thanks for your help

[...........]

    MM> However, I think we should ESS keep running with Emacs
    MM> 21.x for a little while.  ESS core *had* decided to no
    MM> longer support Emacs 20 or earlier, but we have kept
    MM> 21.x in the list of supported Emacsen.

    MM> After a short look at the definition of run-mode-hooks
    MM> (in Emacs 22.3) I think it should not be hard to make
    MM> ESS workable again for Emacs 21.x, if necessary just by
    MM> making it a no-op for 21.x

that wouldn't have been the best solution, but it was easy to
fix and is already committed in the ESS development sources.

Jianjie, if you can,
delete <ESS>/lisp/ess-mode.elc  if it exists, and
apply the following patch to  <ESS>/lisp/ess-mode.el 

421c421,424
<   (run-mode-hooks 'ess-mode-hook)
---
>   (if (> emacs-major-version 21)
>       (run-mode-hooks 'ess-mode-hook)
>     ;; old emacs 21.x
>     (run-hooks 'ess-mode-hook))

i.e., replace line 421 "(run-mode-hooks 'ess-mode-hook)"
with the new 4 line "(if .......)" statement above

(and if you know how, recreate the ess-mode.elc file).

In any case, the fix will be in ESS 5.3.11 which is to be
released "real soon now".

Martin Maechler, ETH Zurich




More information about the ESS-help mailing list