accelorator key for 'ESS - ESS Eval - Eval chunk'

john.gavin at ubs.com john.gavin at ubs.com
Tue Dec 9 11:40:28 CET 2003


Hi Stephen,

(Apologies for the slow response, 
I was away from my desk yesterday.)

Thanks for your time with this issue.
I had partial success with your suggestions.
I am able to bind 'ess-eval-chunk' to F5 using your code.
But I am always asked to confirm the process to load the chunk into,
each time I evaluate a chunk.

The results of each step are detailed below.
If there is any further information that 
I can supply please let me know.

I wrote:

> > When editing an Sweave (.Rnw) file, I can evaluate the current chunk
> > by clicking on 'ESS - ESS Eval - Eval chunk'.  Is there an
> > accelorator key that I can use to do this?  If not, can I add code
> > to my .xemacs file to create one?

You wrote:

> That's right, I think there is no accelerator, but something like the
> following should get you what you want (onto function key 5 here)
> 
> (defun my-ess-hook ()
>   "Add my keybindings to ESS mode."
>   (local-set-key (kbd "<f5>") 'ess-eval-chunk))
> (add-hook 'ess-mode-hook 'my-ess-hook) 

This works exactly as predicted. Thanks.

I wrote:

> > As a follow-on issue, 'ESS - ESS Eval - Eval chunk' asks 'Process to
> > load into: R', something that I would like to avoid answering each
> > time I enter a new code chunk.  I asked about this before in
> > relation to submitting one line at a time (C-c C-n) and the code
> > solution suggested by Stephen Eglen works fine for C-c C-n.
> > https://stat.ethz.ch/pipermail/ess-help/2003-August/001529.html A
> > similar solution for 'ESS - ESS Eval - Eval chunk' would be ideal.

You wrote:
 
> Yes, I can repeat that behaviour with the latest ESS in Emacs 21.3.
> The relevant code shows the problem:
> ...
> A new temp buffer is created to store the chunk, and then it is
> executed.  Every time you run ess-eval-chunk, you are asked to specify
> the process because the buffer local variable ess-local-process-name
> is not set in the temp buffer.  
> 
> Here is a possible change to that defun, put this in your 
> .emacs, restart:
> ...
> Then, when you are in your .Rnw buffer, first try M-x ess-eval-line
> which should prompt you for the R process. 


I was asked to confirm the 'Process to load into: R'
after enter M-x ess-eval-line.
And I am only asked to do this once, as expected.

You wrote:

> Confirm this by then
> doing "M-x describe-variable ess-local-process-name" (it should say
> "R").

What I see is:


`ess-local-process-name' is a variable declared in Lisp.
  -- loaded from "ess-cust"

Value: "R"

This value is specific to the current buffer.

Default-value: nil

Documentation:
The name of the ess process associated with the current buffer.


So the value seems to be set to "R" as expected.
(If I check "M-x describe-variable ess-local-process-name" _before_
setting "M-x ess-eval-line" to R, the value of "ess-local-process-name"
is 'nil', so setting "ess-eval-line" to R seems to be working.)

You wrote:

> After that is set, you should then be able to run ess-eval-chunk, and
> it will use whatever process is stored in ess-local-process-name,
> rather than prompting you.  

No, this does not happen. 
I am always asked 'Process to load into:' 
and the default value 'R' is supplied.

I tried inserting the code from your original email
https://www.stat.math.ethz.ch/pipermail/ess-help/2003-December/001633.html
and your second email 
https://www.stat.math.ethz.ch/pipermail/ess-help/2003-December/001636.html
into my .xemacs file (one at a time),
but the result is the same, 
"F5" or "Ess ESS-Eval Eval-chunk" or "M-x ess-eval-chunk" 
always result in the usual prompt 'Process to load into: R'.

Setup details
-------------
Windows XP (NT 5.1) and 
Emacs  : XEmacs 21.4 (patch 6) "Common Lisp (Windows)" 
[Lucid] (i586-pc-win32) of Mon Dec 17 2001 on TSUNAMI
Package: ess-mode 5.1.24

Regards,

John.

John Gavin <john.gavin at ubs.com>,
Quantitative Risk Models and Statistics,
UBS Investment Bank, 6th floor, 
100 Liverpool St., London EC2M 2RH, UK.
Phone +44 (0) 207 567 4289
Fax   +44 (0) 207 568 5352

Visit our website at http://www.ubs.com

This message contains confidential information and is intend...{{dropped}}




More information about the ESS-help mailing list