[ESS] Colors in noweb mode

Terry Therneau therneau at mayo.edu
Fri Dec 2 16:50:35 CET 2011


I have a colors problem for .Rnw files, but only on the servers at work.

The problem: the code portions of the document are fine.  In the text
portion I get coloring appropriate to the code portions though.  So for
the text string
      .... a second order Taylor series about it's value at ....
the color changes to red at the single quote mark an persists until the
next one.  Words like "for", "in", and "function" are hightlighted, etc.

Versions:  ESS 5.14, emacs 21.4.1, running on CentOS.

Suspicion: I have something in my startup files?  But I don't see
anything about colors.  My customization file is listed below.  Any
hints are welcome as this is very annoying.

Note: I simply use this to edit files.  I don't run R or Sweave out of
the emacs process.  

  Terry Therneau

-----------------

init.el file
 ; load ESS (emacs speaks statistics)
(load "~/ess-5.14/lisp/ess-site.el")
(setq Info-additional-search-directory-list 
        '("~/ess-5.14/doc/"))
;(require 'ess-site)

---
custom.el file

(setq line-number-mode t)
;; Add in my key mappings
(load-file "~/.emacs.d/x-keymap.el")

;; override the auto-fill-mode
(setq default-major-mode 'text-mode)
(setq text-mode-hook nil) 

(setq visible-bell nil)                ; override visual bell
(show-paren-mode 1)                    ; don't blink parenthesis-
highlight
(setq scroll-step 0)                   ; scroll by half windows
(setq tab-width 4)
(setq fill-column 80)
(setq truncate-line nil)               ; how this becomes non-nil
escapes me
(tool-bar-mode 0)                      ; remove the tool bar
;; turn off startup message
(setq inhibit-startup-message t)


;; C variables
((add-hook 'c-mode-common-hook
	  (lambda()
	    (setq c-basic-offset 4)
	    (setq c-indent-level 0)
	    (setq c-brace-imaginary-offset 4)
	    (setq c-continued-statement-offset 4)
	    (setq c-argdecl-indent 0)
	    (setq c-else-offset 0)
	    (setq c-tab-always-indent nil)
	    (setq-default c-electric-flag nil)))

 ;;; ESS variables 
(add-hook 'ess-mode-hook
    (lambda()
        (setq ess-tab-always-indent nil)
        (setq ess-auto-newline nil)
        (setq ess-indent-level 4)
        (setq ess-brace-offset 4)
        (setq ess-close-brace-offset 0)
        (setq ess-continued-statement-offset 4)
        (setq ess-arg-function-offset nil)
        (setq ess-expression-offset nil)
        (setq ess-else-offset 0)
        (setq ess-return-indent nil)
        (setq ess-fancy-comments nil)
        (define-key ess-mode-map [return] 'newline)  ; turn off
"electric" newline
        (define-key ess-mode-map "_" 'self-insert-command)
        ))

;;; SAS variables
(setq sas-tab-always-indent nil)
(setq sas-indent-level 4)
(setq sas-auto-newline nil)
(setq sas-electric-semi nil)
(setq sas-undent-end nil)

; R noweb codes
(defun Rnw-mode () 
  (require 'ess-noweb)
  (noweb-mode)
  (if (fboundp 'R-mode)
      (setq noweb-default-code-mode 'R-mode)))

(custom-set-variables
 '(buffers-menu-grouping-function nil)
 '(buffers-menu-sort-function nil)
 '(line-number-mode t))

-----
The x-keymap.el file binds some function keys to my favorite commands so
is irrelevant



More information about the ESS-help mailing list