emacs - 向 ESS/R 用户询问有关 .emacs 文件中 elisp 代码的建议

标签 emacs r elisp ess

我相信并不是所有的 R 用户都知道 elisp。如果 ESS 用户可以在此处共享 .emacs 文件中的代码,那就太好了。注释良好的代码将特别有用。希望这能促进R用户对ESS的使用。

最佳答案

对我来说,这个东西非常有用:

;; ESS: Emacs Speaks Statistics
(load "~/elisp/vendor/ess/lisp/ess-site.el") 

;; 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)

取自:http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/

关于emacs - 向 ESS/R 用户询问有关 .emacs 文件中 elisp 代码的建议,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2891136/

相关文章:

debugging - 查看/拦截所有 emacs lisp 函数调用

R Shiny 显示输出外部托管的图像

r - 如何使用 kable 将表格中一列中选定行中的文本设为斜体?

lisp - 在另一个函数中调用 flet 定义的函数

Emacs 口齿不清 : Translate characters to standard ASCII transcription

emacs - M-S-<left> 未按预期处理

emacs - 使 Windows 路径在 Emacs Lisp 中有用

performance - 寻找组合的函数优化——内存不足+速度

hook - 连续执行一个emacs lisp函数

unicode - 如何在 Emacs 中为 unicode 字符名称添加缩写名称