[ESS] Saving R files

Martin Maechler maechler at stat.math.ethz.ch
Wed Aug 31 16:12:50 CEST 2005


>>>>> "GB" == Göran Broström <gb at stat.umu.se>


>>>>>     on Wed, 31 Aug 2005 14:45:11 +0200 writes:

    GB> On Wed, Aug 31, 2005 at 11:59:34AM +0200, Martin Maechler wrote:
    >> >>>>> "GB" == Göran Broström <gb at stat.umu.se>
    >> >>>>>     on Tue, 30 Aug 2005 23:48:09 +0200 writes:
    >> 
    GB> I have used ESS just for editing R source code for a long time, with
    GB> great pleasure. I install and upgrade ess via apt-get on my debian system.
    GB> After the latest upgrades I can suddenly not save buffers the usual way
    GB> by C-x C-s. Nothing happens, simply. If I try to quit, C-x C-c, I get the
    GB> question if I want to save....; I answer yes and get the reply "Modified 
    GB> buffers...." It ends with me quitting, without being able to save the file.
    GB> I rename it so I can edit in non-ess mode, which is boring, but works.
    >> 
    >> I know that there are quite a few users who get ess as  Debian
    >> (or Ubuntu) package.  I've done so myself (but usually rather
    >> want to use the "developers" version) without any problem.
    >> 
    GB> Can someone tell me what is going on?
    >> 
    >> not yet..  Are you sure it's related to ESS at all?

    GB> Only because if I change the file extension to .u (say), then the problem 
    GB> disappears, and, if I remove 
    -----------------------------------------
    ;;; ESS
	 (add-hook 'ess-mode-hook
		   (lambda ()
		     (ess-set-style 'C++)
		     (add-hook 'local-write-file-hooks
			       (lambda ()
				 (ess-nuke-trailing-whitespace)))))
	 (setq ess-nuke-trailing-whitespace-p 'ask)
	 (add-hook 'perl-mode-hook
		   (lambda () (setq perl-indent-level 4)))
    -----------------------------------------

    GB> from .emacs, it also disappear. I now realize that this
    GB> only should be used in emacs-20, 

actually, no:  all the above is also for emacs-21.

    GB> and I am using emacs-21 (I got that from "Writing R extensions").

AFAICS "Writing R extensions" says only to change the
"c-mode-hook" mentioned there (but not mentioned above) for
emacs 21.

    GB> Interestingly, at work I get

    GB> 'Query replacing[     ]+$ with : (? for help)'

    GB> (what the $!# is that?:-)

it's  (ess-nuke-trailing-whitespace)
with it's default set to 'ask - hence it asks you if it should
replace trailing white space.  If answer "!"  (which you could
learn from typing "?" for help as it mentions), all the trailing
white space characters will be removed from your file.

Something I've been using forever all the time -- also in emacs 21
(and even "emacs 22.0-pretesting" -- and I just read that I
 should eventually do something slightly different there, because
 local-write-file-hooks is obsolete there).




    GB> when I try to save, and at home the symptoms I described
    GB> before.

    GB> So the solution to my problem seems to be to remove that
    GB> code from .emacs, right?

well, unless you can't solve the problem properly;
in any case, I'd only remove the "nuke-trailing" part,
which leaves you with

    -----------------------------------------
    ;;; ESS
	 (add-hook 'ess-mode-hook
		   (lambda () (ess-set-style 'C++)))
	 (add-hook 'perl-mode-hook
		   (lambda () (setq perl-indent-level 4)))
    -----------------------------------------



    >> Do you have the same problems when starting emacs as
    >> "emacs -q"

    GB> No (at work).

    >> Finally, what does
    >> C-h v ess-version

    GB> 5.2.6 (still at work). (I'm using debian stable at work and unstable home).

{and 5.2.6 is way outdated; but yes, that's one of the troubles of stable}. 
The ESS-addict that I am would definitely use the current version
of ESS (5.2.9);
the corresponding lisp directory you need to install is really small...

Martin




More information about the ESS-help mailing list