Function: eshell-exec-visual

eshell-exec-visual is a byte-compiled function defined in em-term.el.gz.

Signature

(eshell-exec-visual &rest ARGS)

Documentation

Run the specified PROGRAM in a terminal emulation buffer.

ARGS are passed to the program. At the moment, no piping of input is allowed.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/em-term.el.gz
(defun eshell-exec-visual (&rest args)
  "Run the specified PROGRAM in a terminal emulation buffer.
ARGS are passed to the program.  At the moment, no piping of input is
allowed."
  (let* (eshell-interpreter-alist
	 (interp (eshell-find-interpreter (car args) (cdr args)))
	 (program (car interp))
	 (args (flatten-tree
		(eshell-stringify-list (append (cdr interp)
					       (cdr args)))))
	 (term-buf
	  (generate-new-buffer
	   (concat "*" (file-name-nondirectory program) "*")))
	 (eshell-buf (current-buffer)))
    (save-current-buffer
      (switch-to-buffer term-buf)
      (term-mode)
      (setq-local term-term-name eshell-term-name)
      (setq-local eshell-parent-buffer eshell-buf)
      (term-exec term-buf program program nil args)
      (let ((proc (get-buffer-process term-buf)))
	(if (and proc (eq 'run (process-status proc)))
	    (set-process-sentinel proc #'eshell-term-sentinel)
	  (error "Failed to invoke visual command")))
      (term-char-mode)
      (when eshell-escape-control-x
        ;; Don't drop existing escape char.
        (let (term-escape-char)
          (term-set-escape-char ?\C-x)))))
  nil)