[ESS] R-mode local key binding

Jean Eid jeaneid at chass.utoronto.ca
Sat Jan 29 17:59:11 CET 2005


Hi,

I have two questions that I think are simple.

a) I need to keybind some functions. i would prefer to only make this in
the .R buffers i.e. locally in .R buffers. I tried few things but it did
not work. for example I tried this


(defun R-mode ())
(add-to-list 'auto-mode-alist '("\\.R\\'" . R-mode))
(add-to-list 'auto-mode-alist '("\\.r\\'" . R-mode))
(add-hook 'R-mode
  	  '(lambda()
  	     (load-file "~/.xemacs/my-R.el")
  	     ))


where my-R.el reauires ess and have a function to clean .R buffer: I just
want to set the key binding locally.  any help is appreciated

(defun my-R-comment()
 (interactive)
 (insert "### ")
 )
(global-set-key [(control \#) ] 'my-R-comment)

(defun myess-clean ()
 "Indents R codes for the entire buffer"
 (interactive)
 (point-to-register e)
 (goto-char (point-min))
 (message "cleaning R code")
 (while (not (eobp))
  (ess-indent-command)
  (forward-line 1))
 (jump-to-register e)
 (message "done"))

(global-set-key [(control f8)] 'myess-clean)



Jean




More information about the ESS-help mailing list