[ESS] history button in ESS

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Wed Jan 4 13:01:23 CET 2006


Barry Rowlingson writes:
 > Stephen Eglen wrote:
 > 
 > > Try M-p (the meta key and p at the same time, or press Escape and then
 > > p). M-p / M-n will move you through the history, and will do the same
 > > thing e.g. in M-x shell 
 > 
 > 
 > If you want the arrow keys to recall commands, then add this bit of lisp 
 > to either your .emacs or site-start.el files:
 > 
 > (eval-after-load
 >   "comint"
 >   '(progn
 >      (define-key comint-mode-map [up] 
 > 'comint-previous-matching-input-from-input
 > )
 >      (define-key comint-mode-map [down] 
 > 'comint-next-matching-input-from-input)
 >      (define-key comint-mode-map [?\C-a]  'comint-bol)
 >      (define-key comint-mode-map [?\C-c ?\C-a] 'beginning-of-line)))
 > 
 >   - actually I'm not sure what the last two bits do exactly, but the 
 > first two 'define-key' things do the command recall thing.
 > 
 > Barry

Thanks barry.  The last two lines:

 >      (define-key comint-mode-map [?\C-a]  'comint-bol)
 >      (define-key comint-mode-map [?\C-c ?\C-a] 'beginning-of-line)))

should define the following:

C-a to go the beginning of the line (but after any prompt), so cursor
will be at the asterisk

R> *  some text on the current line

whereas C-c C-a will then go to the "real" start of line, i.e. before
the prompt: 

*R> some text on the current line

S




More information about the ESS-help mailing list