Skip to content

Add ghostel-query-before-killing defcustom (closes #288)#289

Merged
dakra merged 1 commit into
mainfrom
ghostel-query-before-killing
May 18, 2026
Merged

Add ghostel-query-before-killing defcustom (closes #288)#289
dakra merged 1 commit into
mainfrom
ghostel-query-before-killing

Conversation

@dakra
Copy link
Copy Markdown
Owner

@dakra dakra commented May 18, 2026

Summary

  • New ghostel-query-before-killing defcustom (t / nil / 'auto, default 'auto) controls whether Emacs confirms before killing a live ghostel buffer or exiting Emacs while one is alive. Replaces the hardcoded (set-process-query-on-exit-flag proc nil) reported in confirm before quitting emacs? #288.
  • 'auto toggles the process query-on-exit flag through ghostel's existing OSC 133 C/D hooks: quiet at a prompt, queries while a command is running. The handlers are wired into ghostel-command-start-functions / ghostel-command-finish-functions defaults rather than via top-level add-hook.
  • For comparison: vterm uses Emacs's default (always queries); eat ships an equivalent eat-query-before-killing-running-terminal defcustom with the same auto semantics (toggled from pre-cmd/pre-prompt rather than OSC 133).

Caveat

Programs without OSC 133 (python3, irb, sqlite3, …) never emit a C marker, so 'auto will leave the flag nil for the whole session — same caveat eat has. Users who want a query for those should set the value to t. Documented in the defcustom docstring.

Test plan

  • make -j4 all — 397/399 expected, 0 unexpected, 2 pre-existing skips
  • 4 new ERT tests cover 'auto flip, 'nil no-op, 't no-op, dead-process safety; added to ghostel-test--elisp-tests so they run in the elisp batch
  • Live: with 'auto, C-x k at a prompt → no query; sleep 30 then C-x k → query fires
  • Live: (setq ghostel-query-before-killing t) → query always; nil → never

Replaces the hardcoded `(set-process-query-on-exit-flag proc nil)`
with a defcustom that defaults to `auto`: quiet at the shell prompt,
queries while a command is running (toggled via the existing OSC 133 C/D hooks).
`t` always queries (vterm-style),
`nil` restores the previous never-query behavior.

Closes #288
@dakra dakra force-pushed the ghostel-query-before-killing branch from 149d7a3 to 9e7c8d4 Compare May 18, 2026 13:55
@dakra dakra merged commit 9e7c8d4 into main May 18, 2026
22 checks passed
@dakra dakra deleted the ghostel-query-before-killing branch May 18, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant