0

I currently have some syntax highlighting in my ESS code (e.g., for brackets, =, and strings). I would like to add highlighting of function calls, like RStudio's "Highlight R function calls" option. How can I do this?

1

ess-R-font-lock-keywords is a user option that is mentioned in the ESS manual as:

Font-lock patterns for ESS R programming mode. (There is a corresponding ess-S-font-lock-keywords for S buffers.) The default value highlights function names, literals, assignments, source functions and reserved words.

Example configuration:

    (setq ess-R-font-lock-keywords
      '((ess-R-fl-keyword:keywords   . t)
        (ess-R-fl-keyword:constants  . t)
        (ess-R-fl-keyword:modifiers  . t)
        (ess-R-fl-keyword:fun-defs   . t)
        (ess-R-fl-keyword:assign-ops . t)
        (ess-R-fl-keyword:%op%       . t)
        (ess-fl-keyword:fun-calls    . t)
        (ess-fl-keyword:numbers)
        (ess-fl-keyword:operators . t)
        (ess-fl-keyword:delimiters)
        (ess-fl-keyword:=)
        (ess-R-fl-keyword:F&T)))

Setting ess-fl-keyword:fun-calls to t turns on function call highlighting.

I also found out from a stack overflow answer that these can also be set manually through the ESS > Font Lock submenu.

| improve this answer | |
  • Could you elaborate, to make your Q&A more useful to others? Maybe explain why that change takes care of it? – Drew Oct 1 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.