Skip to content

Commit

Permalink
adds eldoc ro R and *R* buffers and a nifty trick for fast R editing
Browse files Browse the repository at this point in the history
I had replace the autoload with require statements to get the eldoc to
work reliably.  I'd prefer to have autoload for all but I couldn't get
it to work.
  • Loading branch information
bmabey committed Jan 16, 2012
1 parent a772428 commit bc9df8a
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions initializers.available/ess.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,80 @@
(add-to-list 'load-path "~/.emacs.d/vendor/ess/lisp")

(autoload 'R-mode "ess-site" "" t nil)
;;(autoload 'R-mode "ess-rutils" "" t nil)
;;(autoload 'R-mode "ess-eldoc" "" t nil)

(autoload 'R "ess-site" "" t nil)
;;(autoload 'R "ess-rutils" "" t nil)
;;(autoload 'R "ess-eldoc" "" t nil)

(load-file "~/.emacs.d/vendor/ess/lisp/ess-site.el")

(autoload 'ess-rdired "ess-rdired"
"View *R* objects in a dired-like buffer." t)

;;http://stackoverflow.com/questions/3164996/emacs-ess-r-how-did-i-do-this
;; Show function argument completion while editing R code and interacting with
;; an inferior R process
(define-key ess-mode-map [f2] 'ess-r-args-show)
(define-key ess-mode-map [f3] 'ess-r-args-insert)
(define-key inferior-ess-mode-map [f2] 'ess-r-args-show)
(define-key inferior-ess-mode-map [f3] 'ess-r-args-insert)

;; https://stat.ethz.ch/pipermail/ess-help/2009-February/005158.html
(setq ess-eval-visibly-p nil)

(define-key ess-mode-map "_" nil)


;; http://stackoverflow.com/questions/2891136/asking-ess-r-users-for-suggestions-for-elisp-codes-in-emacs-file
;; http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/
;; Use shift-enter to split window & launch R (if not running), execute highlighted
;; region (if R running & area highlighted), or execute current line
;; (and move to next line, skipping comments). Nice.
;; See http://www.emacswiki.org/emacs/EmacsSpeaksStatistics,
;; FelipeCsaszar. Adapted to spilit vertically instead of
;; horizontally.

(setq ess-ask-for-ess-directory nil)
(setq ess-local-process-name "R")
(setq ansi-color-for-comint-mode 'filter)
(setq comint-prompt-read-only t)
(setq comint-scroll-to-bottom-on-input t)
(setq comint-scroll-to-bottom-on-output t)
(setq comint-move-point-for-output t)
(defun my-ess-start-R ()
(interactive)
(if (not (member "*R*" (mapcar (function buffer-name) (buffer-list))))
(progn
(delete-other-windows)
(setq w1 (selected-window))
(setq w1name (buffer-name))
(setq w2 (split-window w1 nil t))
(R)
(set-window-buffer w2 "*R*")
(set-window-buffer w1 w1name))))
(defun my-ess-eval ()
(interactive)
(my-ess-start-R)
(if (and transient-mark-mode mark-active)
(call-interactively 'ess-eval-region)
(call-interactively 'ess-eval-line-and-step)))
(add-hook 'ess-mode-hook
'(lambda()
(local-set-key [(shift return)] 'my-ess-eval)))
(add-hook 'inferior-ess-mode-hook
'(lambda()
(local-set-key [C-up] 'comint-previous-input)
(local-set-key [C-down] 'comint-next-input)))


(require 'ess-site)


(require 'ess-rutils)
(require 'ess-eldoc)


(add-hook 'inferior-ess-mode-hook 'ess-use-eldoc)

0 comments on commit bc9df8a

Please sign in to comment.