Function: ghostel-line-mode
ghostel-line-mode is an interactive and natively compiled function
defined in ghostel-line-mode.el.
Signature
(ghostel-line-mode &optional FORCE)
Documentation
Switch to line mode — edit input locally, send to shell on RET.
The user types into an editable region between the last prompt and
point-max. Full Emacs editing (yank, kill-word, transpose,
etc.) works. Pressing M-x ghostel-line-mode-send (ghostel-line-mode-send) sends the input
to the shell in one write.
Completion runs against the editable input and follows OSC 7 / TRAMP directory tracking. The terminal stays live while output streams around the prompt. The window follows new output while point rides the live edge (the input region, or the end of output while a command runs); move point into the scrollback and the view stays put until point returns. After RET, line mode stays active for the next prompt.
On the alt screen, line mode enters at a shell prompt whose OSC 133 markers reach Ghostel; over a raw TUI (vim, less) it arms and resumes when the TUI exits. A prefix arg FORCE forces immediate entry.
Key Bindings
ghostel-mode-map C-c C-l
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-line-mode.el
(defun ghostel-line-mode (&optional force)
"Switch to line mode — edit input locally, send to shell on RET.
The user types into an editable region between the last prompt and
`point-max'. Full Emacs editing (yank, `kill-word', transpose,
etc.) works. Pressing \\[ghostel-line-mode-send] sends the input
to the shell in one write.
Completion runs against the editable input and follows OSC 7 / TRAMP
directory tracking. The terminal stays live while output streams
around the prompt. The window follows new output while point rides
the live edge (the input region, or the end of output while a command
runs); move point into the scrollback and the view stays put until
point returns. After RET, line mode stays active for the next
prompt.
On the alt screen, line mode enters at a shell prompt whose OSC 133
markers reach Ghostel; over a raw TUI (vim, less) it arms and resumes
when the TUI exits. A prefix arg FORCE forces immediate entry."
(interactive "P")
(ghostel--ensure-ghostel-buffer)
(unless ghostel--term
(user-error "No terminal in this buffer"))
(cond
((eq ghostel--input-mode 'line)) ; already in line mode
;; Forced: trust the user, bypass the alt-screen gate.
(force
(if (ghostel--line-mode-enter)
(message "Line mode: RET sends the whole line; C-c C-j to exit")
(user-error "Line mode could not locate the cursor or a prompt")))
;; Alt screen with a real prompt on the cursor row (inner shell) — enter.
((and (ghostel-alt-screen-p)
(ghostel--line-mode-prompt-on-screen-p)
(ghostel--line-mode-enter))
(message "Line mode: RET sends the whole line; C-c C-j to exit"))
;; Alt screen, no detectable prompt (raw TUI) — arm instead.
((ghostel-alt-screen-p)
(ghostel--line-mode-defer-entry))
;; Primary screen — normal entry.
((ghostel--line-mode-enter)
(message "Line mode: RET sends the whole line; C-c C-j to exit"))
(t
(user-error "Line mode could not locate the cursor or a prompt"))))