unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Philip K." <philip@warpmail.net>
To: 42386@debbugs.gnu.org
Subject: bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores)
Date: Thu, 16 Jul 2020 10:47:43 +0200	[thread overview]
Message-ID: <875zankfrk.fsf@warpmail.net> (raw)
In-Reply-To: <handler.42386.B.159488736413990.ack@debbugs.gnu.org> (help-debbugs@gnu.org)

[-- Attachment #1: Type: text/plain, Size: 156 bytes --]


Didn't properly test the last patch, sorry for that. The previous
version would try to call the major mode initialisation as a predicate.

-- 
	Philip K.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Handle-symbols-in-project-kill-buffers-ignores.patch --]
[-- Type: text/x-diff, Size: 1867 bytes --]

From 01df630f6bfa8939b2df53f31882e3ef9fd7dfa1 Mon Sep 17 00:00:00 2001
From: Philip K <philip@warpmail.net>
Date: Thu, 16 Jul 2020 10:03:35 +0200
Subject: [PATCH] Handle symbols in project-kill-buffers-ignores

---
 lisp/progmodes/project.el | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 67ce3dc7d9..811c18cb56 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -847,10 +847,11 @@ project-kill-buffers-ignores
   '("\\*Help\\*")
   "Conditions for buffers `project-kill-buffers' should not 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.  Buffers that match
-any of the conditions will not be killed."
-  :type '(repeat (choice regexp function))
+name, a predicate function that takes a buffer object as argument
+and returns non-nil if it matches, or a symbol protecting buffers
+of certain major modes.  Buffers that match any of the conditions
+will not be killed."
+  :type '(repeat (choice regexp function symbol))
   :version "28.1"
   :package-version '(project . "0.5.0"))
 
@@ -877,7 +878,12 @@ project-kill-buffers
                (lambda (c)
                  (cond ((stringp c)
                         (string-match-p c (buffer-name buf)))
-                       ((functionp c)
+                       ((and (symbolp c)
+                             (provided-mode-derived-p
+                              (buffer-local-value 'major-mode buf)
+                              c)))
+                       ((and (not (symbolp c))
+                             (functionp c))
                         (funcall c buf))))
                project-kill-buffers-ignores)
         (push buf bufs)))
-- 
2.20.1


  parent reply	other threads:[~2020-07-16  8:47 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   ` Philip K. [this message]
2020-07-16 15:14     ` bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores) 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
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

  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=875zankfrk.fsf@warpmail.net \
    --to=philip@warpmail.net \
    --cc=42386@debbugs.gnu.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).