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

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

bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffe


From: Philip K.
Subject: bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores)
Date: Fri, 17 Jul 2020 19:16:12 +0200

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?

>> +- a cons-cell, where the car describes how to interpret the cdr.
>> +  If the car contains `major-mode', the cdr has to be the symbol
>> +  of a major mode, that should never be killed.
>
> ...and its derivatives?

I'll add that.

> 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.

> 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.

-- 
        Philip K.





reply via email to

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