[ESS] 2 things I wish ESS would do
tyler
tyler.smith at mail.mcgill.ca
Mon May 12 11:40:48 CEST 2008
"A.J. Rossini" <blindglobe at gmail.com> writes:
> On 5/6/08, tyler <tyler.smith at mail.mcgill.ca> wrote:
>
>> Is there a good reason to keep the ess-transcript functions and
>> inferior-ess-prompt hidden from ESS[S] mode? Appropriate helper
>> functions would be easy to cook up if the these items were available. I
>> imagine a single command to collect the current region in the process
>> buffer, prompt for the destination buffer, possibly with a default, and
>> then paste and clean the kill-ring at point in the destination buffer.
>
>
> ... refactoring those functions into a general support location would
> be a great idea, for reuse by the various modes.
>
> best,
> -tony
>
Ok, so how about something like this:
ess-cust.el, ca. line 1269, to make inferior-ess-prompt global:
;; Tyler commented this out:
;;(make-variable-buffer-local 'inferior-ess-prompt)
ess-trns.el, ca. line 35, to allow for require-ing a named feature:
(provide 'ess-trns) ;;Tyler added for require from ess-mode
and ess-mode.el, ca. line 36, to load ess-trns for ess-mode:
(require 'ess-trns); Tyler added to allow for easy cleaning of code
; copied from the process buffer
With that done, and taking advantage of iswitchb, I have the following
new functions for ess-inf.el:
;; transfer commands to script buffer:
(defun ess-extract-commands-and-go (beg end)
"Paste the commands in the region to a script buffer and go there."
(interactive "r")
(kill-ring-save beg end)
(iswitchb-buffer)
(setf start (point))
(yank)
(setf end (point))
(ess-transcript-clean-region start end nil))
(defun ess-extract-commands (beg end)
"Paste the commands in the region to a script buffer."
(interactive "r")
(kill-ring-save beg end)
(set-buffer (iswitchb-read-buffer "select a buffer:"))
(setf start (point))
(yank)
(setf end (point))
(ess-transcript-clean-region start end nil))
If that looks sensible it could be further tweaked to provide sensible
defaults for the buffer selection step, which may or may not use the
iswitchb functions. In particular, we'd have to insure that the
destination buffer was in ESS[S] mode. Ideas?
Cheers,
Tyler
--
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