Function: ghostel--find-buffer-by-identity

ghostel--find-buffer-by-identity is a natively compiled function defined in ghostel.el.

Signature

(ghostel--find-buffer-by-identity IDENTITY &optional PREDICATE)

Documentation

Return the first live ghostel buffer whose identity equals IDENTITY, or nil.

Only ghostel-mode buffers are considered: the permanent-local identity outlives a major-mode change, but the slot claim must not. Non-nil PREDICATE further filters candidates (called with the buffer), so several buffers sharing IDENTITY cannot shadow one the caller wants.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel--find-buffer-by-identity (identity &optional predicate)
  "Return the first live ghostel buffer whose identity equals IDENTITY, or nil.
Only `ghostel-mode' buffers are considered: the permanent-local
identity outlives a major-mode change, but the slot claim must not.
Non-nil PREDICATE further filters candidates (called with the buffer),
so several buffers sharing IDENTITY cannot shadow one the caller wants."
  (seq-find (lambda (b)
              (and (buffer-live-p b)
                   (with-current-buffer b
                     (and (derived-mode-p 'ghostel-mode)
                          (ghostel--identity-equal ghostel-identity
                                                   identity)))
                   (if predicate (funcall predicate b) t)))
            (buffer-list)))