Function: org-eshell-open

org-eshell-open is a byte-compiled function defined in ol-eshell.el.gz.

Signature

(org-eshell-open LINK _)

Documentation

Switch to an eshell buffer and execute a command line.

The link can be just a command line (executed in the default eshell buffer) or a command line prefixed by a buffer name followed by a colon.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ol-eshell.el.gz
(defun org-eshell-open (link _)
  "Switch to an eshell buffer and execute a command line.
The link can be just a command line (executed in the default
eshell buffer) or a command line prefixed by a buffer name
followed by a colon."
  (let* ((buffer-and-command
          (if (string-match "\\([A-Za-z0-9+*-]+\\):\\(.*\\)" link)
	      (list (match-string 1 link)
		    (match-string 2 link))
            (list eshell-buffer-name link)))
         (eshell-buffer-name (car buffer-and-command))
         (command (cadr buffer-and-command)))
    (if (get-buffer eshell-buffer-name)
        (pop-to-buffer
         eshell-buffer-name
         (if (boundp 'display-comint-buffer-action) ; Emacs >= 29
             display-comint-buffer-action
           '(display-buffer-same-window (inhibit-same-window))))
      (eshell))
    (goto-char (point-max))
    (eshell-kill-input)
    (insert command)
    (eshell-send-input)))