Function: ghostel-create
ghostel-create is a natively compiled function defined in ghostel.el.
Signature
(ghostel-create &optional NAME DISPLAY IDENTITY)
Documentation
Create and return a new ghostel terminal running ghostel-shell.
NAME is the buffer name (default ghostel-buffer-name), uniquified
when already taken. DISPLAY, when non-nil, is a display-buffer
ACTION used to show the buffer. The terminal starts in
default-directory.
Always creates a fresh terminal; reuse is the caller's job.
IDENTITY, when non-nil, is stored verbatim as the buffer's ghostel-identity;
it defaults to the plain-terminal slot identity for NAME with the next free
instance - the same slot ghostel would allocate.
To run a specific program instead of a shell, see ghostel-exec.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-create (&optional name display identity)
"Create and return a new ghostel terminal running `ghostel-shell'.
NAME is the buffer name (default `ghostel-buffer-name'), uniquified
when already taken. DISPLAY, when non-nil, is a `display-buffer'
ACTION used to show the buffer. The terminal starts in
`default-directory'.
Always creates a fresh terminal; reuse is the caller's job.
IDENTITY, when non-nil, is stored verbatim as the buffer's `ghostel-identity';
it defaults to the plain-terminal slot identity for NAME with the next free
instance - the same slot `ghostel' would allocate.
To run a specific program instead of a shell, see `ghostel-exec'."
(ghostel--load-module t)
;; An empty name (a create-on-miss minibuffer submission) would make
;; `generate-new-buffer' signal; treat it as nil.
(let* ((name (if (and name (not (string= name ""))) name
ghostel-buffer-name))
(buf-name name))
(unless identity
(let* ((context `((kind . term) (name . ,name)))
(instance (ghostel--next-instance context)))
(setq identity `(,@context (instance . ,instance)))
;; Keep `ghostel--start's NAME<N> = instance N convention, so the
;; name suffix and the slot number cannot drift apart after a
;; kill-then-create.
(when (> instance 1)
(setq buf-name (format "%s<%d>" name instance)))))
(let ((buffer (ghostel--create buf-name display)))
(condition-case err
(with-current-buffer buffer
(setq ghostel--managed-buffer-name (buffer-name)
ghostel--initial-name (buffer-name)
ghostel-identity identity)
(ghostel--start-process)
(ghostel--apply-initial-input-mode))
((error quit)
(when (buffer-live-p buffer) (kill-buffer buffer))
(signal (car err) (cdr err))))
buffer)))