unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Manuel Uberti <manuel.uberti@inventati.org>, 54100@debbugs.gnu.org
Subject: bug#54100: 29.0.50; Allow project-buffers to ignore some buffers
Date: Fri, 25 Feb 2022 04:33:53 +0200	[thread overview]
Message-ID: <93b67902-a322-d0f1-e25a-97ff3ac70785@yandex.ru> (raw)
In-Reply-To: <d7f23f47-c3e4-96a1-39a7-c4442af2f389@inventati.org>

On 24.02.2022 09:18, Manuel Uberti via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> Find attached yet a better approach to avoid repetition.

The patch looks good except for this part:

           (predicate
-          (lambda (buffer)
-            ;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist.
-            (memq (cdr buffer) buffers))))
+          (or predicate
+              (lambda (buffer)
+                ;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of 
Vbuffer_alist.
+                (memq (cdr buffer) buffers)))))

Doesn't this mean that it won't do the (memq ... buffers) check and thus 
ignore the result of the (project-buffers pr) call?

Instead, it could be a lambda like

           (lambda (buffer)
             ;; BUFFER is an entry (BUF-NAME . BUF-OBJ) of Vbuffer_alist.
             (and (memq (cdr buffer) buffers)
                  (funcall predicate buffer)))

Does that make sense?

(I would also try to shorten the new defcustom's docstring by referring 
to the existing one, but I can make that change myself.)

> Note that the above mention problem about multiple conditions remains, 
> though. Help appreciated. :)

As described in the docstring:

   If any of these conditions are satisfied ...

So when you use this value

   '(mu-project-buffer-p
     (not (derived-mode . comint-mode)))

it means "either satisfies my-project-buffer-p or not derived from 
comint-mode". Whereas you probably wanted to combine them with "and":

   (setq-default project-switch-to-buffer-conditions
                 '(and mu-project-buffer-p
                       (not (derived-mode . comint-mode))))

And IDK, maybe the "and" top-level combination would work better for 
project-switch-to-buffer-conditions. It might trip up a user who's 
customizing both vars, though.

Or if you wanted to stay on "or" but make it easier for certain usage 
pattern, you could call the var 'project-ignore-buffer-conditions' (or 
"hide" or etc), and change its use appropriately. Then the value could 
contain

   '((not mu-project-buffer-p)
     (derived-mode . comint-mode))

...and (not mu-project-buffer-p) could obviously be rewritten in a 
negated way in the function's definition.





  reply	other threads:[~2022-02-25  2:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22  8:27 bug#54100: 29.0.50; Allow project-buffers to ignore some buffers Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-22  9:41 ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-22 14:23   ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-23  2:49     ` Dmitry Gutov
2022-02-23  6:56       ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-23  9:48         ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-23  9:55           ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-23 15:00 ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-24  7:18 ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-25  2:33   ` Dmitry Gutov [this message]
2022-02-25  6:44     ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-26  1:50       ` Dmitry Gutov
2022-02-26  6:32         ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-27  3:27           ` Dmitry Gutov
2022-02-27  7:09             ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-27  7:41               ` Eli Zaretskii
2022-02-27  7:43                 ` Manuel Uberti via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93b67902-a322-d0f1-e25a-97ff3ac70785@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=54100@debbugs.gnu.org \
    --cc=manuel.uberti@inventati.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).