|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; This file:
;; http://angg.twu.net/elisp/eepitch-vterm.el.html
;; http://angg.twu.net/elisp/eepitch-vterm.el
;; (find-angg "elisp/eepitch-vterm.el")
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
(defvar eepitch-line 'nil) ; cheap indirection
(defun eepitch-line (line)
"Send LINE to the target window and run the key binding for RET there.
If the value in the variable `eepitch-line' is non-nil then call
the function in that variable instead of running the default code.
This is a low-level function used by `eepitch-this-line'."
(if eepitch-line
(funcall eepitch-line line)
(eepitch-eval-at-target-window ; Default behavior:
'(progn (goto-char (point-max)) ; at the end of buffer
(insert line) ; "type" the line
(call-interactively (key-binding "\r")))))) ; then do a RET
(defun eepitch (code)
"Set up a target for eepitch and make sure it is displayed in another window.
The argument CODE must be a \"shell-like sexp\", i.e., one that
when evaluated always switches to a buffer with a fixed name, and
when that buffer does not exists it creates it.\n
This function sets `eepitch-code' to CODE and sets the variables
`eepitch-window-show' and `eepitch-kill' to defaults that are
good for two-window settings, and then calls `eepitch-prepare',
which does all the hard work."
(setq eepitch-code code)
(setq eepitch-buffer-name "") ; so that `eepitch-buffer-exists' will fail
(setq eepitch-window-show ; set the way to set up windows to the
'(eepitch-window-show)) ; default two-window setting
(setq eepitch-kill ; set the behavior of `eepitch-kill'
'(eepitch-kill-buffer)) ; to just kill the target buffer
(setq eepitch-line nil) ; use the default `eepitch-line'
(eepitch-prepare)
(list 'Target: eepitch-buffer-name)) ; feedback (for <f8> and `M-e')
(defun eepitch-line-vterm (line)
"Send LINE to the vterm buffer and run the key binding for RET there."
(eepitch-eval-at-target-window
'(progn (vterm-send-string line) ; "type" the line
(vterm-send-return)))) ; then do a RET
(defun eepitch-vterm ()
(interactive)
(eepitch '(vterm))
(setq eepitch-line 'eepitch-line-vterm))
;; (load (buffer-file-name))
'(
* (eepitch-vterm)
* (eepitch-kill)
* (eepitch-vterm)
ls
cd /tmp/
)