Skip to content

ghostel should return the buffer #185

Description

@emil-e

ghostel (and ghostel-project) have no meaningful return value — they return whatever ghostel--init-buffer happens to fall through to (a process object for new buffers, nil for existing ones), and neither case is documented.

This forces callers who need the buffer to use a workaround: invoking (current-buffer) immediately after ghostel inside a save-window-excursion, relying on pop-to-buffer having changed the selected buffer as a side-effect:

(let ((buf (save-window-excursion (ghostel t) (current-buffer))))
  ...)

ghostel-exec already returns the process as a documented contract. The equivalent for ghostel would be returning the buffer — consistent with how most Emacs terminal commands behave (eshell, vterm, term all return the buffer).

Proposed change:

(defun ghostel (&optional arg)
  ...
  (pop-to-buffer buffer ...)
  (ghostel--init-buffer buffer identity)
  buffer)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions