Function: ghostel--set-title

ghostel--set-title is a natively compiled function defined in ghostel.el.

Signature

(ghostel--set-title TITLE)

Documentation

Record a terminal TITLE report (OSC 0/2) and rename the buffer.

A nil or empty TITLE clears the title and reverts a title-derived name to the slot's creation-style name. Renames via ghostel-buffer-name-function and ghostel--rename-managed, which declines after a manual rename.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--set-title (title)
  "Record a terminal TITLE report (OSC 0/2) and rename the buffer.
A nil or empty TITLE clears the title and reverts a title-derived
name to the slot's creation-style name.  Renames via
`ghostel-buffer-name-function' and `ghostel--rename-managed', which
declines after a manual rename."
  (setq ghostel-title (and title (not (string= "" title)) title))
  (when ghostel-buffer-name-function
    (ghostel--rename-managed
     (or (funcall ghostel-buffer-name-function ghostel-title)
         ;; Revert only names title tracking has claimed; a clear must
         ;; not rename a buffer it never touched.
         (and (null ghostel-title)
              ghostel--managed-buffer-name
              ghostel--initial-name))))
  (ghostel--buffer-identification-update))