[ESS] Rd-mode filling
tyler
tyler.smith at mail.mcgill.ca
Wed Jun 3 13:16:37 CEST 2009
Martin Maechler <maechler at stat.math.ethz.ch> writes:
>>>>>> "TS" == tyler <tyler.smith at mail.mcgill.ca>
>>>>>> on Wed, 03 Jun 2009 00:25:35 -0300 writes:
>
> TS> Hi, Rd-mode doesn't seem to handle paragraph filling very
> TS> well. At least for me, it only recognizes blank lines as
> TS> paragraph breaks,
>
>
> I agree and I have occasionally had the same experience.
> In those cases I've always ``automatically subconsciously''
> worked around the problem, using the empty-line trick ...
>
> TS> I've written a hook to modify paragraph-start and
> TS> paragraph-separate that fixes this - is that of interest to
> TS> others, or is there some obvious fix that I've overlooked? I
> TS> didn't see anything in the manual or in essddr.el.
>
> I agree that a good solution would be a patch to
> <ess>/lisp/essddr.el
>
> Couldn't you try to change your hook into code that could be
> part of essddr.el ?
Ok. I've pasted the patch below, which:
- ignores leading and trailing whitespace
- paragraph separators are:
lines that start with a '\' and end with a '{'
lines with only a '}'
blank lines
- lines that start with a '\' and end with a '}' are treated as
complete paragraphs
The following code in your .emacs will do the same thing, but is laid
out to make it a little easier to see and modify the different parts of
the regexp.
(defun my-Rd-mode-hook ()
(make-local-variable 'paragraph-start)
(make-local-variable 'paragraph-separate)
(setq paragraph-start
(concat
"\\s *$"
"\\|" "\\s *}\\s *$"
"\\|" "\\s *\\\\.*[{}]\\s *$")
paragraph-separate
(concat
"\\s *$"
"\\|" "\\s *}\\s *$"
"\\|" "\\s *\\\\.*{\\s *$")))
(add-hook 'Rd-mode-hook 'my-Rd-mode-hook)
Cheers,
Tyler
tyler:lisp-> svn diff essddr.el
Index: essddr.el
===================================================================
--- essddr.el (revision 4054)
+++ essddr.el (working copy)
@@ -301,6 +301,11 @@
(set (make-local-variable 'comment-end) "")
(set (make-local-variable 'font-lock-defaults)
'(Rd-font-lock-keywords nil nil))
+ (set (make-local-variable 'paragraph-start)
+ "\\s *$\\|\\s *}\\s *$\\|\\s *\\\\.*[{}]\\s *$")
+ (set (make-local-variable 'paragraph-separate)
+ "\\s *$\\|\\s *}\\s *$\\|\\s *\\\\.*{\\s *$")
+
;; (set (make-local-variable 'parse-sexp-ignore-comments) t)
(require 'easymenu)
--
There is no theory of evolution.
Just a list of animals Chuck Norris allows to live.
http://www.chucknorrisfacts.com/
More information about the ESS-help
mailing list