[ESS-bugs] Font lock bugs in R mode

Ari Kornfeld akorn at perspective.com
Sun Feb 12 02:12:44 CET 2006


Hi,

  There appear to a few minor bugs in ess-cust.el (ESS-5.2.12 and prior):

1. "T" and "F" should be included in ess-R-constants

2. Warning messages are not properly highlighted:
Example Code:
 >  f<-function() warning("Hello")
 > f()
Warning message:
   Hello in: f()

 Problem:
  "Warning" is black, "message" is red (and "in" is red)

 Solution (does not solve the "in" problem)
  in  ess-cust.el
  Part 1:
;; Ari (JAK): "Warning messages?" did not work.  Cut off the "s?"
;;  and just added both variations
(defvar ess-R-message-prefixes
  '("Error:" "Error in"
    "Warning:" "Warning in" "Warning message"
    "Warning messages"))

  Part2:
;; Ari (JAK) moved location of ess-R-mode-font-lock-keywords
;;  so it doesn't override "Warning message" type of stuff
;;  in ess-R-message-prefixes
(defvar inferior-ess-R-font-lock-keywords
   (append
   '(("^[a-zA-Z0-9 ]*[>+]" . font-lock-keyword-face)) ; "prompt" must be 
first

   (if (not inferior-ess-font-lock-input) ;; don't font-lock input :
       (list (cons "^[a-zA-Z0-9 ]*[>+]\\(.*$\\)"
           '(1 font-lock-variable-name-face keep t))) )

   (list
    (cons "^\\*\\*\\*.*\\*\\*\\*\\s *$" 'font-lock-comment-face); 
ess-mode msg
    (cons "\\[,?[1-9][0-9]*,?\\]" 
'font-lock-reference-face);Vector/matrix labels
    (cons (concat "^" (regexp-opt ess-R-message-prefixes 'enc-paren))
      'font-lock-reference-face) ; inferior-ess problems or errors
    (cons "#"     'font-lock-comment-face) ; comment
    (cons "^[^#]*#\\(.*$\\)" '(1 font-lock-comment-face keep t)) ; comments
    )
   ess-R-mode-font-lock-keywords

   )
  "Font-lock patterns used in inferior-R-mode buffers.")


Best regards,
-ari




More information about the ESS-bugs mailing list