2016-11-14 71 views

回答

0

您可以使用ess-inf中的ess-command將輸出重定向到另一個緩衝區。一個例子可能如下所示:

(defun redirect-ess-output (command &optional buffer process) 
    (interactive (list (read-from-minibuffer "Command: "))) 
    (let ((buff (get-buffer-create (or buffer "*r-output*"))) 
     ;; 'ess-get-process' defaults to process local to current 
     ;; buffer, so to call from anywhere default to "R" 
     (proc (ess-get-process (or process "R")))) 
    ;; send a trailing newline to process 
    (unless (string-match-p "\n$" command) 
     (setq command (concat command "\n"))) 
    (ess-command command buff 'sleep nil nil proc) 
    (with-current-buffer buff 
     ;; process stuff 
     (pop-to-buffer buff))))