bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59153: List project buffers


From: Akib Azmain Turja
Subject: bug#59153: List project buffers
Date: Thu, 10 Nov 2022 01:22:30 +0600

Juri Linkov <juri@linkov.net> writes:

> What is still missing is a command to list project buffers:
>
>   C-x C-b (list-buffers)   - C-x p C-b (project-list-buffers)
>
> project-kill-buffers already shows a list of project buffers,
> but only as a part of confirmation for killing buffers.
>
> Here is a patch that adds the missing command.  Its argument
> has exactly the same meaning as in 'list-buffers'.
>  
> +;;;###autoload
> +(defun project-list-buffers (&optional arg)
> +  "Display a list of project buffers.
> +The list is displayed in a buffer named \"*Buffer List*\".
> +
> +By default, all buffers are listed except those whose names start
> +with a space (which are for internal use).  With prefix argument
> +ARG, show only buffers that are visiting files."
> +  (interactive "P")
> +  (let* ((pr (project-current t))
> +         (bufs (mapcan
> +                (lambda (buf)
> +                  (when (and (project--buffer-check buf '("\\`[^ ]"))
> +                             (or (not arg)
> +                                 (project--buffer-check buf 
> '(buffer-file-name))))
> +                    (list buf)))
> +                (project-buffers pr))))
> +    (display-buffer (list-buffers-noselect arg bufs))))

This won't survive a revert buffer, I think.  (I'll show all buffers
then.)

-- 
Akib Azmain Turja, GPG key: 70018CE5819F17A3BBA666AFE74F0EFA922AE7F5
Fediverse: akib@hostux.social
Codeberg: akib
emailselfdefense.fsf.org | "Nothing can be secure without encryption."

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]