Function: ghostel-exec
ghostel-exec is a natively compiled function defined in ghostel.el.
Signature
(ghostel-exec BUFFER PROGRAM &optional ARGS IDENTITY)
Documentation
Run PROGRAM with ARGS as a ghostel terminal in BUFFER.
BUFFER is switched into ghostel-mode and sized to its displayed
window, or 80x24 if BUFFER is not displayed. PROGRAM and ARGS are
passed as distinct argv entries, so shell metacharacters are not
interpreted. Shell integration is not applied.
IDENTITY, when non-nil, is stored verbatim as the buffer's
ghostel-identity; include a command key to make bookmarks respawn the
program. It defaults to ((kind . exec) (command . (PROGRAM . ARGS))).
Returns the lifecycle process object.
Signals user-error if BUFFER already has a live ghostel process.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-exec (buffer program &optional args identity)
"Run PROGRAM with ARGS as a ghostel terminal in BUFFER.
BUFFER is switched into `ghostel-mode' and sized to its displayed
window, or 80x24 if BUFFER is not displayed. PROGRAM and ARGS are
passed as distinct argv entries, so shell metacharacters are not
interpreted. Shell integration is not applied.
IDENTITY, when non-nil, is stored verbatim as the buffer's
`ghostel-identity'; include a `command' key to make bookmarks respawn the
program. It defaults to \((kind . exec) (command . (PROGRAM . ARGS))).
Returns the lifecycle process object.
Signals `user-error' if BUFFER already has a live ghostel process."
(ghostel--load-module t)
(when (with-current-buffer buffer
(process-live-p ghostel--process))
(user-error "Buffer %s already has a running ghostel process"
(buffer-name buffer)))
(let* ((window (get-buffer-window buffer t))
;; Use `window-screen-lines' (not `window-body-height') so the
;; height matches the unit `window-adjust-process-window-size-smallest'
;; uses — see `ghostel--init-buffer' for why.
(height (if window
(max 1 (with-selected-window window
(floor (window-screen-lines))))
24))
(width (if window
(max 1 (window-max-chars-per-line window))
80)))
(with-current-buffer buffer
(ghostel--init-buffer buffer height width)
(setq ghostel--initial-name (buffer-name)
ghostel-identity
(or identity
;; Copy ARGS so a caller reusing its list cannot mutate
;; the identity in place.
`((kind . exec) (command . (,program . ,(copy-sequence args))))))
(let ((remote-p (file-remote-p default-directory)))
(ghostel--spawn-pty program args nil remote-p)))))