*** empty log message ***
[ess.git] / lisp / ess-send.el
blob324036fb9a22f4b2991b515e41fac2e7b2af0f35
1 ;; First pass at context sensitive help.
3 (defun ess-eval-expanded (&optional head tail commands-buffer)
4 "Send the expanded current region or word-at-point to the
5 inferior-ess process after first concating the head and tail.
6 If the region is active, the function uses the current region.
7 If the region is not active, the function uses the word-at-point"
8 (interactive)
9 (if (not head) (setq head "summary("))
10 (if (not tail) (setq tail ")"))
11 (if (not commands-buffer) (setq commands-buffer (get-buffer-create "tmp-buffer")))
12 (let (kill-ring
13 current-word)
14 (if mark-active
15 (progn
16 (copy-region-as-kill (region-beginning) (region-end))
17 (setq current-word (current-kill 1)))
18 (setq current-word (word-at-point)))
19 (ess-command (concat head current-word tail) commands-buffer)))
21 ;; this is probably not the best key or key-map
22 (define-key ess-mode-map "\C-c\C-w" 'ess-eval-expanded)
27 ;; previous version, sends expanded text to Commands window
29 ;;;(defun ess-eval-expanded (&optional head tail) ""
30 ;;; (interactive)
31 ;;; (if (not head) (setq head "summary("))
32 ;;; (if (not tail) (setq tail ")"))
33 ;;; (let (kill-ring
34 ;;; current-word)
35 ;;; (if mark-active
36 ;;; (progn
37 ;;; (copy-region-as-kill (region-beginning) (region-end))
38 ;;; (setq current-word (current-kill 1)))
39 ;;; (setq current-word (word-at-point)))
40 ;;; (ess-eval-linewise (concat head current-word tail))))
41 ;;;(define-key ess-mode-map "\C-c\C-w" 'ess-eval-expanded)
46 ;; First working version: set of three functions.
47 ;; The region and word-at-point are in independent functions and
48 ;; and are called by the main function.
50 ;;(defun ess-eval-expanded (&optional head tail) ""
51 ;; (interactive)
52 ;; (if mark-active (ess-eval-expanded-region
53 ;; (region-beginning) (region-end) head tail)
54 ;; (ess-eval-expanded-word-at-point head tail)))
56 ;;(defun ess-eval-expanded-region (start end &optional head tail)
57 ;; "Send the expanded current region to the inferior ESS process after
58 ;;first concating the head and tail."
59 ;; (let (kill-ring
60 ;; expanded-region)
61 ;; (copy-region-as-kill start end)
62 ;; (setq expanded-region (concat head (current-kill 1) tail))
63 ;; (ess-eval-linewise expanded-region))
64 ;;)
66 ;; (setq debug-on-error t)
68 ;;(defun ess-eval-expanded-word-at-point (&optional head tail)
69 ;; "Send the expanded word-at-point to the inferior ESS process after
70 ;;first concating the head and tail."
71 ;; (let (expanded-region)
72 ;; (setq expanded-region (concat head (word-at-point) tail))
73 ;; (ess-eval-linewise expanded-region))
74 ;;)