[ESS] `font-lock-pre-idle-hook': Error message any time I type in xemacs

Brian Diggs diggsb at ohsu.edu
Mon Mar 22 21:46:15 CET 2010

On 3/19/2010 6:58 AM, Rodney Sparapani wrote:
> On 03/18/10 05:37 PM, Brian Diggs wrote:
>> It is not just an Ubuntu issue. I also see it with ESS 5.8 under XEmacs
>> 21.4.21 on Windows XP. I can get the errors to go away and the font
>> locking to work correctly if I turn off font-lock-mode and then turn it
>> back on. However, this has to be done individually for every ESS[S]
>> buffer separately.
>> Since turning off and turning on font-lock-mode fixes it, I am guessing
>> it has something to do with how font-lock-mode is enabled for buffers.
>> However, I don't know where to look to start figuring it out. I would be
>> happy to do some hunting if someone could give me directions as to what
>> to look for.
>> -- 
>> Brian Diggs
> I cannot replicate your issue with ESS 5.8 under XEmacs 21.4.21
> on Windows XP.  Do you have to do anything in particular or is
> it just automatic?
> Rodney

It is automatic.  I've tried to determine if it is something in my 
configuration, but can not find anything.  Here are the steps that I can 
take to reproduce it.

Start XEmacs (-q and -no-site-file are not necessary for the problem, 
but I wanted to isolate that it is not something in my configuration)

"C:\Program Files\XEmacs\XEmacs-21.4.21\i586-pc-win32\xemacs.exe" -q 

In *scratch* buffer:

(require 'ess-site)

Using C-j to execute it.  I should note that no *ESS* buffer appears; it 
just stays in *scratch*, though there is an *ESS* buffer in the buffer list.

Open a .R file:

C-x C-f ~/test.R

Type anything; after first keypress get the warning (in the *Warnings* 

(1) (warning/warning) Error caught in `font-lock-pre-idle-hook': 
(invalid-function 0)

If it is useful, the contents of the *ESS* buffer are:

[ess-site.el]: ess-customize-alist=nil
[ess-site.el _2_]: ess-customize-alist=nil
(ess-find-rterm): ess-R-root-dir = 'c:\Program Files\'
(R): ess-r-versions-create making M-x defuns for

(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, 
comint..echoes=nil, comint..sender=comint-simple-send
(ess-mode-1): ess-language=S, ess-dialect=R buf=test.R
(ess-mode-1.5): alist=((ess-local-customize-alist quote 
R-customize-alist) (ess-dialect . R) (ess-suffix . R) 
(ess-dump-filename-template ess-replace-regexp-in-string S$ ess-suffix 
ess-dump-filename-template-proto) (ess-mode-syntax-table . 
R-syntax-table) (ess-mode-editing-alist . R-editing-alist) 
(ess-change-sp-regexp . ess-R-change-sp-regexp) (ess-help-sec-regex . 
ess-help-R-sec-regex) (ess-help-sec-keys-alist . 
ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout) 
(ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern . 
ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el) 
(ess-imenu-mode-function quote ess-imenu-R) (inferior-ess-program . 
inferior-R-program-name) (inferior-ess-objects-command . 
inferior-R-objects-command) (inferior-ess-font-lock-keywords . 
inferior-ess-R-font-lock-keywords) (inferior-ess-search-list-command . 
) (inferior-ess-help-command . inferior-ess-r-help-command) 
(inferior-ess-help-filetype) (inferior-ess-exit-command . q()) 
(inferior-ess-exit-prompt . Save workspace image? [y/n/c]: ) 
(inferior-ess-primary-prompt . \([A-Z][][A-Za-z0-9.]*\)?> ) 
(inferior-ess-secondary-prompt . + ?) (inferior-ess-start-file) 
(inferior-ess-start-args . ) (ess-STERM . iESS) (ess-editor . R-editor) 
(ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
) (inferior-ess-language-start eval inferior-S-language-start) 
(comint-use-prompt-regexp-instead-of-fields . t))
(ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| 
page-delimiter) (paragraph-separate concat \s-*$\| page-delimiter) 
(paragraph-ignore-fill-prefix . t) (require-final-newline . t) 
(comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) 
(comment-column . 40) (indent-line-function quote S-indent-line) 
(parse-sexp-ignore-comments . t) (ess-style . ess-default-style) 
(ess-local-process-name) (ess-mode-syntax-table . S-syntax-table) 
(add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
]*function) (font-lock-defaults quote (ess-R-mode-font-lock-keywords nil 
nil ((?\. . w) (?_ . w)))))
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, 
comint..echoes=nil, comint..sender=comint-simple-send

Finished setting up ESS-mode.

And the contents of the  *Message-Log* buffer are:

Loading cus-face...
Loading cus-face...done
Loading regexp-opt...
Loading regexp-opt...done
enabling speedbar support
Loading efs-cu...
Loading efs-cu...done
(New file)
Loading ess-roxy...
Loading edmacro...
Loading edmacro...done
Loading easy-mmode...
Loading easy-mmode...done
Loading advice...
Loading advice...done
Loading ess-roxy...done

I have found an even simpler way to work around the problem.  In the 
misbehaving buffer, if I manually run 'R-mode' again, the font locking 
works as expected.  This is a shorter invocation than my previous 
workaround ('font-lock-mode', 'font-lock-mode').  However, it is still a 
per-buffer workaround.

Brian Diggs
Senior Research Associate, Department of Surgery, Oregon Health & 
Science University

More information about the ESS-help mailing list