Function: ghostel--terminal-env
ghostel--terminal-env is a natively compiled function defined in
ghostel.el.
Signature
(ghostel--terminal-env)
Documentation
Return list of TERM-related env-var strings for ghostel processes.
Honors ghostel-term and ghostel-ssh-install-terminfo. When
"xterm-ghostty" is requested but the bundled terminfo isn't readable,
falls back to xterm-256color and warns once per session. The SSH
install env var is only exported when the resolved TERM is actually
xterm-ghostty — falling back to xterm-256color must not advertise a
wrapper that would re-claim ghostty over ssh.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--terminal-env ()
"Return list of TERM-related env-var strings for ghostel processes.
Honors `ghostel-term' and `ghostel-ssh-install-terminfo'. When
\"xterm-ghostty\" is requested but the bundled terminfo isn't readable,
falls back to xterm-256color and warns once per session. The SSH
install env var is only exported when the resolved TERM is actually
xterm-ghostty — falling back to xterm-256color must not advertise a
wrapper that would re-claim ghostty over ssh."
(let* ((env (cond
((not (equal ghostel-term "xterm-ghostty"))
(list (concat "TERM=" ghostel-term) "COLORTERM=truecolor"))
(t
(let ((tinfo (ghostel--terminfo-directory)))
(cond
(tinfo
(list "TERM=xterm-ghostty"
(concat "TERMINFO=" tinfo)
"TERM_PROGRAM=ghostty"
"TERM_PROGRAM_VERSION=1.3.2"
"COLORTERM=truecolor"))
(t
(unless ghostel--terminfo-warned
(setq ghostel--terminfo-warned t)
(display-warning
'ghostel
(format
"Bundled terminfo not found in %s; falling back to TERM=xterm-256color. \
Apps like Claude Code may exhibit choppy redraws. Reinstall ghostel \
to restore the terminfo/ directory, or customize `ghostel-term' to silence."
(or (ghostel--package-directory) "<unknown>"))
:warning))
(list "TERM=xterm-256color" "COLORTERM=truecolor"))))))))
(if (and (member "TERM=xterm-ghostty" env)
(ghostel--ssh-install-enabled-p))
(append env (list "GHOSTEL_SSH_INSTALL_TERMINFO=1"))
env)))