[ESS] Viewing data frames

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Sun Feb 27 21:27:16 CET 2011


> I think that'd be quite helpful -- not for emacs to resize R's width
> automagically (though some might like an option for that), but to have
> a function that tells R to set options(width=(window-width)) or some
> such that we can bind to a key-combo.

ok, here is a suggestion:

(defun ess-r-set-width ()
  "Set width option for R based on current window width.
Only sensible when called from within an *R* buffer."
  (interactive)
  (let ((wid (window-width)))
    (ess-command (format "options(width=%d)\n" wid))
    (message (format "Window width set to %d" wid))))


& for those who want it automatically updated:

(add-hook 'inferior-ess-mode-hook
	  '(lambda ()
	     (add-hook 'window-configuration-change-hook
		       'ess-r-set-width nil 'local)))

Stephen



More information about the ESS-help mailing list