I would like to change the behavior of the home key within an R session run from emacs. When I press the home key, it takes me all the way to the >
prompt. I'd like the home key to take me to the start of the command entry (i.e., two points in from the start of the line). I assume that I can make this adjustments via my .emacs
file; any guidance for the commands that I would need to add to that file would be appreciated. Thanks!
Asked
Active
Viewed 96 times
1

Charlie
- 2,801
- 3
- 26
- 27
-
If you have two requests, it's generally better to make two questions... – Trey Jackson Sep 12 '11 at 19:12
-
@Trey, Okay, sorry. I thought that they were similar enough to fall under the same heading. I'll edit. – Charlie Sep 12 '11 at 19:14
-
I think these questions are so closely related you may as well keep it as a single question. – Andrie Sep 12 '11 at 19:15
1 Answers
1
The behaviour you want is already available as C-a
. You can rebind the home key with the following line:
(local-set-key (kbd "<home>") 'comint-bol)
There are a number of ways to get this to happen automatically when you are using the R session. I use something like the following:
;; Define the keybinding you want
(defun my-inferior-ess-mode-hook ()
(local-set-key (kbd "<home>") 'comint-bol))
;; add the key-binding to the hook that gets called whenever you start an R session:
(add-hook 'inferior-ess-mode-hook 'my-inferior-ess-mode-hook)
That's a bit much for a single key-binding, but you can extend the definition of my-inferior-ess-mode-hook
to include a number of customizations you'd like to use.

Tyler
- 9,872
- 2
- 33
- 57