all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: "Philip K." <philip@warpmail.net>
Cc: 42386@debbugs.gnu.org
Subject: bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores)
Date: Sat, 18 Jul 2020 01:21:47 +0300	[thread overview]
Message-ID: <0c296186-702e-576d-a609-b3028d093def@yandex.ru> (raw)
In-Reply-To: <87pn8udpur.fsf@warpmail.net>

On 17.07.2020 20:16, Philip K. wrote:
> Dmitry Gutov <dgutov@yandex.ru> writes:
> 
>> On 17.07.2020 18:30, Philip K. wrote:
>>>    (defcustom project-kill-buffers-ignores
>>>      '("\\*Help\\*")
>>
>> You might as well update the default value.
> 
> So what should be added, besides ERC?

Probably nothing, unless you have something else to propose.

At this point, you are the main driver of this feature. I like it in 
theory (a lot), but so far has done little to incorporate in my 
workflow, so you're the foremost person to hit the edge cases. I also 
don't do email/IRC/notes/etc in Emacs.

Speaking of some ideas, though, if you are worried about more unknown 
modes needing the same treatment, we could flip the meaning of this var 
and go with the whitelist approach, like font-lock-global-modes does. It 
can still serve as a blacklist if the first element is `not`.

To give an example:

(defcustom project-kill-buffers-conditions
   '(buffer-file-name ; All file-visiting buffers are included.
     (derived-mode . compilation-mode)
     ;; Most of the temp buffers in the background:
     (major-mode . fundamental-mode)
     ;; A bit questionable (alternatively, include
     ;; xref--xref-buffer-mode, occur-mode,
     ;; vc-dir-mode, log-view-mode, log-edit-mode separately):
     (derived-mode . special-mode))
   "Conditions for buffers `project-kill-buffers' should kill.
Each condition is either a regular expression matching a buffer
name, or a predicate function that takes a buffer object as
argument and returns non-nil if it matches, or a cons cell which <...>.

Buffers that belong to the current project, and match any of the
conditions, will be killed.  If the list starts with `not',
the meaning is negated."
   :type '(repeat (choice regexp function))
   :version "28.1"
   :package-version '(project . "0.6.0"))

If this kind of list can be exhaustive enough, this can be a decent default.

What do you think? If you're not sure, let's go with your patch now.

>> Or I wonder if you should just use memq in the implementation.
> 
> I tried to find out what major-mode hierarchies exist on my system, so I
> wrote
> 
>          (let (tree)
>            (dolist (f features)
>              (require f))
>            (mapatoms
>             (lambda (a)
>               (let ((p (get a 'derived-mode-parent)))
>                 (when p
>                   (push (cons p a)
>                         tree)))))
>            (with-temp-buffer
>              (insert "digraph {\n")
>              (dolist (node tree)
>                (insert (format "\"%s\" -> \"%s\";\n" (car node) (cdr node))))
>              (insert "}\n")
>              (write-file "dep.dot")
>              (shell-command "dot -Tpng dep.dot > dep.png")
>              (delete-file "dep.dot")))
> 
> that generated an image of a tree. It seems it's mostly flat, meaning
> that a majority of the major modes are based on prog-mode, text-mode or
> special-mode. All further levels seem to be connected, such as with
> magit or gnus. So while I get that someone might not find it intuitive
> that major modes other than the one listed are not killed, I think a
> generous interpretation is better than killing more than one might want.

Fair enough. Or we could provide both kinds of checks, like in the 
example above (major-mode vs derived-mode).

>> Both font-lock-global-modes and desktop-modes-not-to-save are not
>> applied to derivatives.
> 
> Hmm, I didn't know about that. As explained, just from looking at my
> system, taking derivations into consideration appears to have more
> advantages than disadvantages, but I'm not dogmatic on that point.

I don't know which is the best approach either.





  reply	other threads:[~2020-07-17 22:21 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16  8:15 bug#42386: [PATCH] Handle symbols in project-kill-buffers-ignores Philip K.
     [not found] ` <handler.42386.B.159488736413990.ack@debbugs.gnu.org>
2020-07-16  8:47   ` bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores) Philip K.
2020-07-16 15:14     ` Eli Zaretskii
2020-07-16 18:08       ` Philip K.
2020-07-16 18:16       ` Philip K.
2020-07-16 19:35         ` Eli Zaretskii
2020-07-16 22:22           ` Philip K.
2020-07-17  6:38             ` Eli Zaretskii
2020-07-17  8:16               ` Philip K.
2020-07-17 10:49                 ` Eli Zaretskii
2020-07-17 11:17                   ` Philip K.
2020-07-17 11:26                     ` Eli Zaretskii
2020-07-17 15:30                       ` Philip K.
2020-07-17 15:43                         ` Dmitry Gutov
2020-07-17 17:16                           ` Philip K.
2020-07-17 22:21                             ` Dmitry Gutov [this message]
2020-07-18 12:48                               ` Philip K.
2020-07-19 23:10                                 ` Dmitry Gutov
2020-07-20 12:07                                   ` Philip K.
2020-07-20 13:39                                     ` Dmitry Gutov
2020-07-21  9:11                                       ` Philip K.
2020-07-21 14:27                                         ` Eli Zaretskii
2020-07-21 18:35                                           ` Philip K.
2020-07-21 18:57                                             ` Eli Zaretskii
2020-07-21 20:47                                               ` Dmitry Gutov
2020-07-21 18:45                                         ` Dmitry Gutov
2020-07-21 18:51                                           ` Philip K.
2020-07-27 16:26                                             ` Dmitry Gutov
2020-07-27 18:33                                               ` Philip K.
2020-07-28 22:33                                                 ` Dmitry Gutov
2020-07-16 18:41       ` Dmitry Gutov
2020-07-16 22:46         ` Juri Linkov
2020-07-17  0:23           ` Dmitry Gutov
2020-07-16 13:43 ` bug#42386: [PATCH] Handle symbols in project-kill-buffers-ignores Dmitry Gutov
2020-07-16 18:00   ` Philip K.

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

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

  git send-email \
    --in-reply-to=0c296186-702e-576d-a609-b3028d093def@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=42386@debbugs.gnu.org \
    --cc=philip@warpmail.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.