Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You might be interested in <a href="http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/" rel="nofollow noreferrer">this code</a> by FelipeCsaszar which uses Shift-Enter to do what you want upon loading an R file, plus a little more besides once it's loaded ( If R is running and a region is highlighted, shift-enter sends the region over to R to be evaluated. If R is running and no region is highlighted, shift-enter sends the current line over to R. Repeatedly hitting shift-enter in an R file steps through each line (sending it to R), skipping commented lines. The cursor is also moved down to the bottom of the R buffer after each evaluation.)</p> <pre><code>;; Use shift-enter to split window &amp; launch R (if not running), execute highlighted ;; region (if R running &amp; 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-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) </code></pre> <p>The split done in this code is the C-x-3 one you want --- I always forget that in Emacs horizontal/vertical splitting is backwards from how many people (including me) understand it, referring to the direction the split line "moves in" from and not the orientation of the split line itself.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload