[ESS] R-mode local key binding
Jean Eid
jeaneid at chass.utoronto.ca
Mon Jan 31 19:32:40 CET 2005
thank you Richard for all the helpfull commentgs. The reason why I did not
use M-; is because I wanted 3 comment symbolsd at the begining of the line
that way "tab" does not put these particular comments in the middle of the
buffer. the other function I built becaause I did not want to highlight
the region. so it does the indentation and stays where the cursor was
before the command was issued.
Jean,
On Sat, 29 Jan 2005, Richard M. Heiberger wrote:
> This is a good start. It has a few clashes with the ESS style.
>
> 1. Don't defun R-mode, as that is a function name already used by ESS.
> Redefining an important function name might make things stop working.
>
>
> 2. The specific functions you are defining are already in ESS.
>
> M-;
> puts comment symbols at the beginning of a single empty line and at
> the end of a single line that already has code. If you mark a region,
> it puts comment symbols at the beginning of each line in the region.
>
> C-M-\
> indent-region
>
>
> 3. The message you use "cleaning R code" is not the ideal message.
> "indenting R code" is better. ESS usually uses the word "clean"
> in the function ess-transcript-clean-region which is used to
> convert an S language output transcript file myfile.rt or
> myfile.st into an input file.
>
> ess-transcript-clean-region is an interactive Lisp function in `ess-trns'.
> (ess-transcript-clean-region beg end even-if-read-only)
>
> Strip the transcript in the region, leaving only (R/S/Lsp/..) commands.
> Deletes any lines not beginning with a prompt, and then removes the
> prompt from those lines that remain. Prefix argument means to use
> C-x C-q to clean even if the buffer is M-x read-only.
>
>
> 4. Here is how to define a key and limit it to a single mode, in
> this case ess-mode. This function and key definition displays
> the date and time when pressed in ess-mode (which includes
> R-mode), but not elsewhere.
>
>
> (defun jeaneid ()
> "display the date and time"
> (interactive)
> (message (time-stamp-string)))
>
> (define-key ess-mode-map [(control f8)] 'jeaneid)
>
More information about the ESS-help
mailing list