[ESS] keybinding for (ess-eval-paragraph) and more
Martin Maechler
maechler at stat.math.ethz.ch
Fri Mar 17 11:49:18 CET 2006
>>>>> "Dan" == Dan Bolser <dmb at mrc-dunn.cam.ac.uk>
>>>>> on Fri, 17 Mar 2006 10:20:55 +0000 writes:
Dan> I thought I would post this code in the case that anyone finds it
Dan> useful, or can offer some improvements. I use sql-mode all the time, so
Dan> I find this function 'missing' from ess...
Dan> (defun ess-eval-paragraph ()
Dan> (interactive)
Dan> (mark-paragraph)
Dan> (call-interactively 'ess-eval-region)
Dan> ;;(with-current-buffer "*R*" (end-of-buffer))
Dan> ;;(save-excursion (ess-switch-to-end-of-ESS))
Dan> (end-of-buffer-other-window 0)
Dan> (forward-paragraph)
Dan> )
Hmm, ess-inf.el has been containing -- for about 10.5 years it
seems:
---------------------------------------------------------------
;; This is from Mary Lindstrom <lindstro at Biostat.Wisc.Edu>
;; 31 Aug 1995 14:11:43 To: S-mode at stat.math.ethz.ch
(defun ess-eval-paragraph (vis)
"Send the current paragraph to the inferior ESS process.
Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'."
(interactive "P")
(ess-force-buffer-current "Process to load into: ")
(save-excursion
(forward-paragraph)
(let ((end (point)))
(backward-paragraph)
(ess-eval-region (point) end vis "Eval paragraph"))))
---------------------------------------------------------------
but it is not (yet) bound to any key inside ESS,
as you propose here :
Dan> (global-set-key (kbd "C-c C-c") 'ess-eval-paragraph)
Since I just see that C-c C-c is indeed unbound
in the *.R buffers, we could adopt your proposed key binding
indeed.
What do others think about the proposed keybinding?
I could envisage an even smarter thing:
Bind C-c C-c to ess-eval-paragraph-or-function
which does not yet exist, but which would
- see if we are inside of a function definition;
- if yes, call ess-eval-function
- if no, call ess-eval-paragraph
What do people think about this?
Martin <Maechler at stat.math.ethz.ch> http://stat.ethz.ch/people/maechler
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: +41-44-632-3408 fax: ...-1228 <><
More information about the ESS-help
mailing list