[ESS] paragraph filling in R scripts

Tyler William Smith tyler.smith at mail.mcgill.ca
Sun Jun 14 21:58:39 CEST 2009


Dr. Alun Pope wrote: 

Thanks for looking at this.  I have not encountered the problem you
mention, but I have come across the following problem which is related.

Suppose I have a perfectly good expression such as this

very.long.meaningful.object.name[some.indexing.also.long,] <-
some.longish.expressions

When I tidy the code by end-delete-return on that line, the line appears
as:

very.long.meaningful.object.name[some.indexing.also.long,]
<- some.longish.expressions

Hi Alun,

I'm away from my computer at the moment, but I think this is a different issue. If I understand you correctly, what you're seeing is the Emacs' auto-filling breaking up an R statement in inappropriate places. As I understand it, line-wrapping/filling functions just look for white space beyond a specified column number, and use that to break your line into two pieces. If that space happens to fall immediately before the <- operator, you get a bad break. 

I suspect this is fixable, but the code I sent in my last message won't help. I will poke around at this when I get a chance, unless wiser folk have already got a solution.

Cheers,

Tyler

-----Original Message-----
From: ess-help-bounces at stat.math.ethz.ch
[mailto:ess-help-bounces at stat.math.ethz.ch] On Behalf Of tyler
Sent: Saturday, 13 June 2009 12:19 PM
To: ess-help at stat.math.ethz.ch
Subject: [ESS] paragraph filling in R scripts

Hi again,

Another bug from way back, this one reported for 5.3.6:

https://stat.ethz.ch/pipermail/ess-bugs/2007q4/000468.html

I fixed this with the following lines from my .emacs, but patching
essl-s.el would be cleaner.

(defun my-ess-mode-hook ()
  (setq paragraph-start
        (concat paragraph-start
                "\\|.*<-\\|\\s +\\(while\\|if\\|else\\|for\\)")))
(add-hook 'ess-mode-hook 'my-ess-mode-hook)

I haven't looked at this in ages, since my hook fixed the problem for
me. There may be better solutions, but this works fine for me.

Cheers,

Tyler

--
What is wanted is not the will to believe, but the will to find out,
which is the exact opposite.           --Bertrand Russell

______________________________________________
ESS-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help

______________________________________________________
This email has been scanned by the Access Networks/MessageLabs Email
Security System.For more information please visit
http://www.indicium.com.au/
______________________________________________________

IMPORTANT NOTICE
This e-mail may be confidential, may be legally privileged, and is for the intended recipient only. Unauthorized access, disclosure, copying, distribution, or reliance on any of it by anyone else is prohibited and may a criminal offence.  Please delete if received in error and e-mail confirmation to sender
______________________________________________________
This email has been scanned by the Access Networks/MessageLabs Email Security System.For more information please visit http://www.indicium.com.au/



More information about the ESS-help mailing list