[ESS-bugs] ess-mode 5.2.8; Font Lock Issue
Ari Kornfeld
ari at perspective.com
Thu Aug 11 00:15:52 CEST 2005
Problem1: Font lock doesn't correctly identify/color "Warning in"
because it is overridden by the "in" keyword.
(try executing: warning("message") from inside a function, for
example, the function included in problem 2, below.)
Solution: In ess-cust.el, defvar inferior-ess-R-font-lock-keywords,
change the ordering so that ess-R-mode-font-lock-keywords comes last.
The same rearrangement should be done for inferior-ess-S-font-lock-keywords.
Problem 2: The warning function in R prints out warning messages with
unbalanced parenthesis. With enough warnings, the font-lock parser
breaks down with the following message:
(1) (warning/warning) Error caught in `font-lock-pre-idle-hook':
(error Nesting too deep for parser)
and does so for each new command entered at the ">" prompt, even if
there are no further warnings. If working in split-window mode, whatever
is in the other window gets replaced by this error message every time a
new command is entered.
Sample code:
long.fun.spec<-function(long.argument.1, long.arguments.2,
long.arguments.3) {
warning("Notice missing close paren on the previous line.")}
for (idx in 1:100) long.fun.spec(long.argument.1=1, long.arguments.2=2,
long.arguments.3=c(1,2,3,5,6,9,0))
--- end code.
If you add and extra closing paren to the warning message in the code
above, the parser never gets confused. But in general, one doesn't have
control over warning messages, since they come from prepackaged code.
Best regards,
-ari
Emacs : XEmacs 21.4 (patch 13) "Rational FORTRAN" [Lucid]
(i586-pc-win32) of Sun May 25 2003 on TSUNAMI
Package: ess-mode 5.2.8
current state:
==============
(setq
ess-language "S"
ess-dialect "R"
ess-ask-for-ess-directory t
ess-ask-about-transfile nil
ess-directory nil
ess-keep-dump-files "always"
ess-source-directory "/tmp/"
)
[ess-site.el]: ess-customize-alist=nil
[ess-site.el _2_]: ess-customize-alist=nil
(R): ess-rterm-versions-create making M-x defuns for c:\Program
Files\R\rw2001\bin/Rterm.exe c:\Program
Files\R\rw2010\bin/Rterm.exe(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=edges.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-retr-lastvalue-command . assign(".Last.value", .ess.lvsave, envir=NULL)
) (ess-save-lastvalue-command .
assign(".ess.lvsave",.Last.value,inherits=TRUE)
) (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 .
search()
) (inferior-ess-help-command . help("%s", htmlhelp=FALSE)
) (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-set-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.
(R): ess-dialect=R, buf=edges.r, start-arg=nil
current-prefix-arg=nil
(inferior-ess 0): ess-start-args=--ess
ess-setq-vars-default 0: ess-language=Initial, -dialect=nil, buf=nil,
comint..echoes=nil, comint..sender=comint-simple-send
ess-setq-vars-default 1: ess-language=S, -dialect=R, buf=nil,
comint..echoes=nil, comint..sender=comint-simple-send
(inf-ess 1): lang=S, dialect=R, tmp-dialect=R, buf=edges.r
(inf-ess 1.1): procname=R temp-dialect=R, buf-name=*R*
(inferior-ess) Method #3 start=c:\ari\School\00 Gravitropism\R programs\
buf=*R*
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil,
comint..echoes=nil, comint..sender=comint-simple-send
(inf-ess 2.1): ess-language=S, ess-dialect=R buf=*R*
(inf-ess 2.2): start args = --ess , inf-ess-start-args=--ess
(inf-ess finish [S(R), Rterm(nil,nil)]
(ess-multi 0): inf-ess-start-args=--ess , comint-..echoes=nil
(i-ess 1): buf=*R*, lang=S, comint..echo=nil,
comint..sender=comint-simple-send,
(i-ess 2): buf=*R*, lang=S, comint..echo=t,
comint..sender=inferior-R-input-sender,
(ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t,
comint..sender=inferior-R-input-sender
(i-ess 3): curr-buf=*R*, comint..echo=t,
comint..sender=inferior-R-input-sender,
(ess-multi post inf-ess: start-args=--ess , comint-echoes=t
(ess-multi 1): start-args=--ess
Making Process...Buf *R*, Proc R, Prog Rterm
Start File=nil, Args= --ess .
(R): inferior-ess-language-start=options(STERM='iESS',
editor='gnuclient.exe')
More information about the ESS-bugs
mailing list