[ESS] options don't work

Kasper Daniel Hansen khansen at stat.berkeley.edu
Wed Apr 29 07:05:33 CEST 2009


Hi Terry

This looks pretty strange. I am not an expert on indentation, but I  
can provide you with my setup, that gives me an indentation level of  
4. Btw., querying for the indentation level yields

ess-indent-level is a variable defined in `ess-cust.el'.
Its value is 4
Local in buffer example.yeast.R; global value is 2

so the opposite of yours. I am using Carbon Emacs on the mac in case  
that there may be a hidden global setting in that Emacs distribution.

The lines in my .emacs that deals with indentation and ESS are

(require 'ess-site)
(setq ess-nuke-trailing-whitespace-p t)
(setq ess-eval-visibly-p nil)
(setq inferior-R-args "--no-save --no-restore") ;; R start flags

(add-hook 'c-mode-hook
	  (lambda ()
	    (c-set-style "bsd")
	    (setq c-basic-offset 4)
))
(add-hook 'perl-model-hook
	  (lambda ()
	    (setq perl-indent-level 4)))
(add-hook 'c++-mode-hook
	  (lambda ()
	    (setq indent-tabs-mode nil)))
(add-hook 'inferior-ess-mode-hook
	  (lambda ()
	    (setq comint-scroll-to-bottom-on-output 'others)
	    (setq indent-tabs-mode nil)
))
(add-hook 'ess-mode-hook
	  (lambda ()
	    (ess-set-style 'C++)
	    (setq indent-tabs-mode nil)
	    (setq comint-scroll-to-bottom-on-output 'others)
	    (add-hook 'local-write-file-hooks
		      (lambda ()
			(ess-nuke-trailing-whitespace)))
))

Kasper

On Apr 28, 2009, at 20:02 , Terry Therneau wrote:

> I've asked for help on this before, tried everything I can think of,
> and am tearing my hair.
> After a new machine, upgrade to Ubuntu 8.10, my indentation options
> for ESS are being ignored.  This is when I open a file with name
> whatever.R (I don't use emacs to run R, just to edit.)
>
> Emacs starting message:
> This is GNU Emacs 22.2.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll  
> bars)
> of 2008-09-05 on vernadsky, modified by Ubuntu
>
> ESS version 5.3.11, installed with Synaptic Package Manager from the
> Iowa State CRAN mirror
>
> If I open a file, say "charlie.R", it shows the buffer to be in ESS[S]
> mode.  A query of the value of ess-indent-level via cntl-h v gives
>
> ess-indent-level is a variable defined in `ess-cust.el'.
> Its value is 2
> Local in buffer charlie.R; global value is 4
>
>
>
> Below is my entire .emacs file from my home directory, after stripping
> out anything that I thought could possibly interact.
> The options to map function keys (which I've used for years and years
> and years) work just fine.
> Someone please help.  I've essentially lost the use of emacs on my
> home machine, and have no clue whatsoever about why.
> WHY does it ignore the global value that I set?
>
> ;; Set up the keyboard so the delete key on both the regular keyboard
> ;; and the keypad delete the character under the cursor and to the  
> right
> ;; under X, instead of the default, backspace behavior.
> (global-set-key [delete] 'delete-char)
> (global-set-key [kp-delete] 'delete-char)
>
> ;; turn on font-lock mode
> (global-font-lock-mode t)
> ;; enable visual feedback on selections
> (setq-default transient-mark-mode t)
>
> ;; always end a file with a newline
> (setq require-final-newline t)
>
> ;; stop at the end of the file, not just add lines
> (setq next-line-add-newlines nil)
>
> ;(when window-system
>  ;; use extended compound-text coding for X clipboard
> ;  (set-selection-coding-system 'compound-text-with-extensions))
>
> ;; Do my preferred keypad bindings, like the old ge ones
> (if (eq window-system 'x)
>    (progn
>      (setq show-paren-mode t)
>      ;; define functions of keypad
>      (global-set-key [f2] 'find-file)
>      (global-set-key [f3] 'find-alternate-file)
>      (global-set-key [f4] 'save-buffer)
>      (global-set-key [f5] 'kill-buffer)
>      (global-set-key [kp-0] 'copy-region-as-kill) ; 0
>      (global-set-key [kp-1] 'isearch-forward)     ; 1
>      (global-set-key [kp-2] 'forward-word)        ; 2
>      (global-set-key [kp-3] 'isearch-backward)    ; 3
>      (global-set-key [kp-4] 'beginning-of-line)   ; 4
>      (global-set-key [kp-5] 'spell-word)          ; 5
>      (global-set-key [kp-6] 'end-of-line)         ; 6
>      (global-set-key [kp-7] 'overwrite-mode)      ; 7
>      (global-set-key [kp-8] 'undo)                ; 8
>      (global-set-key [kp-9] 'delete-char)         ; 9
>      (global-set-key [kp-subtract] 'kill-line)    ; -
>      (global-set-key [kp-separator] 'kill-word)   ; ,
>      (global-set-key [kp-decimal] 'set-mark-command) ; .
>      (global-set-key [kp-enter] 'execute-extended-command)  ; Enter
>        ))
>
> ;;; ESS variables
> (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 4)
> (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)
>
>  Terry Therneau
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list