[ESS] keybinding for (ess-eval-paragraph) and more
maechler at stat.math.ethz.ch
Fri Mar 17 16:01:15 CET 2006
>>>>> "Dan" == Dan Bolser <dmb at mrc-dunn.cam.ac.uk>
>>>>> on Fri, 17 Mar 2006 13:51:21 +0000 writes:
Dan> Martin Maechler wrote:
>>>>>>> "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> (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)
>> Hmm, ess-inf.el has been containing -- for about 10.5 years it
>> ;; 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: ")
>> (let ((end (point)))
>> (ess-eval-region (point) end vis "Eval paragraph"))))
>> but it is not (yet) bound to any key inside ESS,
Dan> Or anywhere in the ESS 'eval' menus.
>> 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
>> What do others think about the proposed keybinding?
Dan> I think its good because 'sql-mode' uses the same binding for the same
Dan> function (but writing to an SQL process obviously).
>> 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?
Dan> I think that would be a good addition, because I have been writing
Dan> functions (loops actually) with non optimal layout simply for the
Dan> convenience of sending the code in one go with C-c C-c. If there was a
Dan> 'block' check, that would be nice also. Personally I like the R process
Dan> buffer to jump to the end after I send a command, else I feel like I am
Dan> sending commands 'blind', and I get irritated by the extra key strokes
Dan> needed to keep jumping the process buffer to the end. Could this
Dan> behavior (as well as the 'paragraph forward' behavior be added to the
Dan> I find it very convenient to skip through some code with nothing more
Dan> than repeated C-c's until I find the section I am developing.
The scrolling of the process buffer is ``unrelated'':
We say in the ESS manual that you should set
We (ESS) cannot really do it for ``political reasons'':
ESS is not the only Emacs package using "comint" the above
settings affects all of them.
In the past I have been advocating our setting (in some
default.el file; you could do this in your ~/.emacs or sitewide
in some site-start.el file :
(setq comint-scroll-to-bottom-on-output 'others) ; not current
;;=default: (setq comint-scroll-to-bottom-on-input nil)
(setq comint-scroll-show-maximum-output t) ;;; this is the key
(define-key comint-mode-map [up]
(define-key comint-mode-map [down]
(define-key comint-mode-map "\C-a" 'comint-bol)
I'm not sure about the exact effect of the 2nd variable,
which we *fail* to mention in the ESS manual.
Can anyone check / confirm if its setting to 't' is still as
important as my comment above (``this is the key'') seems to
More information about the ESS-help