Function: ghostel-project-buffer-list
ghostel-project-buffer-list is a natively compiled function defined in
ghostel.el.
Signature
(ghostel-project-buffer-list)
Documentation
Return ghostel buffers belonging to the current project, sorted by name.
Scoping is controlled by ghostel-project-buffer-scope.
Prompts to choose a project when there is none.
Buffers whose default-directory is remote are skipped in the
default-directory scope branch — querying project-current
against a TRAMP path would walk the remote filesystem
synchronously on every cycle.
Source Code
;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
(defun ghostel-project-buffer-list ()
"Return ghostel buffers belonging to the current project, sorted by name.
Scoping is controlled by `ghostel-project-buffer-scope'.
Prompts to choose a project when there is none.
Buffers whose `default-directory' is remote are skipped in the
`default-directory' scope branch — querying `project-current'
against a TRAMP path would walk the remote filesystem
synchronously on every cycle."
(let* ((proj (project-current t))
(root (project-root proj))
(scope ghostel-project-buffer-scope)
(all (ghostel-buffer-list))
(by-dir
(and (memq scope '(default-directory both))
(cl-remove-if-not
(lambda (b)
(let ((bd (buffer-local-value 'default-directory b)))
(and bd
(not (file-remote-p bd))
(ignore-errors
(let ((bp (project-current nil bd)))
(and bp (equal (project-root bp) root)))))))
all)))
(by-id
(and (memq scope '(identity both))
(let ((pattern `((kind . term)
(project-root . ,(ghostel--normalize-root
root)))))
(cl-remove-if-not
(lambda (b)
(ghostel-identity-match-p
pattern (buffer-local-value 'ghostel-identity b)))
all)))))
(sort (cl-delete-duplicates (append by-dir by-id) :test #'eq)
(lambda (a b) (string< (buffer-name a) (buffer-name b))))))