[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[eev] eethrow-*

From: rubikitch
Subject: [eev] eethrow-*
Date: Mon, 09 Jan 2006 03:47:24 +0900 (JST)


`eethrow' prepares to throw the input to the target buffer.
`eethrow-do-this-line' actually throws the input.

And I defined some eethrow-* commands for shortcut purpose.

;;;; [2005/12/14] eethrow
(defvar eethrow-send-buffer nil)
(defvar eethrow-display-buffer-function nil)
(defmacro eethrow (&rest body)
  `(let ((pop-up-windows t)
         (same-window-buffer-names nil)
         (display-buffer-function eethrow-display-buffer-function))
     (save-window-excursion             ; rearrange new window
       (setq eethrow-send-buffer (current-buffer))) ; record the target buffer
     (display-buffer eethrow-send-buffer)))
(defun eethrow-do-this-line () (interactive)
  (let ((line (buffer-substring (ee-bol) (ee-eol)))) ; contents of this line
    (if (string-match "^\\(.*\\)" line)             ; lines with a red star
        (ee-eval-string (match-string 1 line))       ; are eval'ed
        (select-window (get-buffer-window eethrow-send-buffer))
        (goto-char (point-max))                      ; at the EOB
        (insert line)                                ; other lines are "typed"
        (call-interactively (key-binding "\r"))))    ; and then we do a RET
    (next-line 1)))

;; [2006/01/07]
(defun eethrow-invisible ()
  (with-current-buffer eethrow-send-buffer
    (call-interactively 'send-invisible)))

;; [2006/01/08]
(defun eethrow-shell ()
  (eethrow (shell)))
;; [2006/01/09]
(defun eethrow-su ()
  (eethrow (ee-su)))
(defun eethrow-ruby ()
  (eethrow (ee-ruby)))

;;;; [2006/01/07] 
(defun ee-comint (name program &rest switches)
  (apply 'make-comint name program nil switches)
  (switch-to-buffer (format "*%s*" name)))
(defun ee-su ()
  (ee-comint "su" "su"))

;;;; [2006/01/09]
(defun ee-ruby ()
  (require 'inf-ruby)
  (cond ((fboundp 'find-irbsh)
        ((fboundp 'irbsh)
         (call-interactively 'irbsh))
         (call-interactively 'run-ruby))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]