;; First pass at context sensitive help.12(defun ess-eval-expanded (&optional head tail commands-buffer)3"Send the expanded current region or word-at-point to the4inferior-ess process after first concating the head and tail.5If the region is active, the function uses the current region.6If the region is not active, the function uses the word-at-point"7(interactive)8(if (not head) (setq head "summary("))9(if (not tail) (setq tail ")"))10(if (not commands-buffer) (setq commands-buffer (get-buffer-create "tmp-buffer")))11(let (kill-ring12current-word)13(if mark-active14(progn15(copy-region-as-kill (region-beginning) (region-end))16(setq current-word (current-kill 1)))17(setq current-word (word-at-point)))18(ess-command (concat head current-word tail) commands-buffer)))1920;; this is probably not the best key or key-map21(define-key ess-mode-map "\C-c\C-w" 'ess-eval-expanded)2223242526;; previous version, sends expanded text to Commands window2728;;;(defun ess-eval-expanded (&optional head tail) ""29;;; (interactive)30;;; (if (not head) (setq head "summary("))31;;; (if (not tail) (setq tail ")"))32;;; (let (kill-ring33;;; current-word)34;;; (if mark-active35;;; (progn36;;; (copy-region-as-kill (region-beginning) (region-end))37;;; (setq current-word (current-kill 1)))38;;; (setq current-word (word-at-point)))39;;; (ess-eval-linewise (concat head current-word tail))))40;;;(define-key ess-mode-map "\C-c\C-w" 'ess-eval-expanded)4142434445;; First working version: set of three functions.46;; The region and word-at-point are in independent functions and47;; and are called by the main function.4849;;(defun ess-eval-expanded (&optional head tail) ""50;; (interactive)51;; (if mark-active (ess-eval-expanded-region52;; (region-beginning) (region-end) head tail)53;; (ess-eval-expanded-word-at-point head tail)))5455;;(defun ess-eval-expanded-region (start end &optional head tail)56;; "Send the expanded current region to the inferior ESS process after57;;first concating the head and tail."58;; (let (kill-ring59;; expanded-region)60;; (copy-region-as-kill start end)61;; (setq expanded-region (concat head (current-kill 1) tail))62;; (ess-eval-linewise expanded-region))63;;)6465;; (setq debug-on-error t)6667;;(defun ess-eval-expanded-word-at-point (&optional head tail)68;; "Send the expanded word-at-point to the inferior ESS process after69;;first concating the head and tail."70;; (let (expanded-region)71;; (setq expanded-region (concat head (word-at-point) tail))72;; (ess-eval-linewise expanded-region))73;;)747576