[ESS] paragraph filling in R scripts

tyler tyler.smith at mail.mcgill.ca
Mon Jun 15 16:42:41 CEST 2009

"Vitalie S." <vitosmail at rambler.ru> writes:

> On Sat, 13 Jun 2009 04:49:01 +0200, tyler <tyler.smith at mail.mcgill.ca> wrote:
>> 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)
> Thanks for this patch. I am using quite extensively backward-paragraph
> type of functions to navigate rapidly through my code. Now with your
> new regexprs my cursor stops at each if/else/for line which hampers
> the navigation considerably.
> Do you think the issue could be solved in some other way (say by
> replasing fill-paragraph with ess-fill-paragraph)?
> Otherwise I am afraid I would prefer not to have this additional
> regexp in my default installation of ess.

A separate ess-fill-paragraph might work, with locally defined
paragraph-start and paragraph-separate variables. Another alternative
would be to use a customizable variable for paragraph-start within ess,
so each user could decide what behaviour suited them best. In the
meantime, you can make ess ignore while/if/else/for by deleting that
section of the regexp in the hook:

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

I think I prefer the idea of ess-fill-paragraph. I'll poke around with
that for a while and see what happens.



The purpose of models is not to fit the data but to sharpen the
questions.                             --Samuel Karlin

More information about the ESS-help mailing list