From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Philip K." Newsgroups: gmane.emacs.bugs Subject: bug#42386: Acknowledgement ([PATCH] Handle symbols in project-kill-buffers-ignores) Date: Tue, 21 Jul 2020 20:35:55 +0200 Message-ID: <878sfcaf78.fsf@warpmail.net> References: <878sfjkh8o.fsf@warpmail.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13611"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 42386@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 21 20:37:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxx8Y-0003Rh-GF for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Jul 2020 20:37:11 +0200 Original-Received: from localhost ([::1]:58560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxx8X-0001Zd-53 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 Jul 2020 14:37:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxx8Q-0001ZW-EM for bug-gnu-emacs@gnu.org; Tue, 21 Jul 2020 14:37:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57066) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jxx8Q-0000HA-5b for bug-gnu-emacs@gnu.org; Tue, 21 Jul 2020 14:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jxx8Q-0005vb-3m for bug-gnu-emacs@gnu.org; Tue, 21 Jul 2020 14:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Philip K." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 Jul 2020 18:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42386 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 42386-submit@debbugs.gnu.org id=B42386.159535656722626 (code B ref 42386); Tue, 21 Jul 2020 18:37:02 +0000 Original-Received: (at 42386) by debbugs.gnu.org; 21 Jul 2020 18:36:07 +0000 Original-Received: from localhost ([127.0.0.1]:40361 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jxx7X-0005sr-HW for submit@debbugs.gnu.org; Tue, 21 Jul 2020 14:36:07 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:46947) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jxx7U-0005sK-QO for 42386@debbugs.gnu.org; Tue, 21 Jul 2020 14:36:06 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id BA9BC5C00D2; Tue, 21 Jul 2020 14:35:58 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 21 Jul 2020 14:35:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=warpmail.net; h= from:to:cc:subject:in-reply-to:date:message-id:mime-version :content-type; s=fm1; bh=QRQ9z6mYGMK3or7CkdgaHSH9Rm79/Uy9AJ7nRxs qcsY=; b=N7YT2Rb3hPLBr4AbBbfSAxg/YSEVUFHpmC/zNDMUwWPVTBtF9LhX48p b+jx4WDnAWMWsAOLOfm/hXsh937e0nlnsDL47zch7qhzI5dWTdoxtmDLvDLCWpnG pBhk5tz7v/X7GbFi3gGzfKB1LmZAWa+25zpP4H+6LxDzu4Sxhc9okROZ2XH3P64Q lcfnxOOzGubIWbNtI3P330Lqkm3e9/fSUXuxcKPDvtL0+8e2pm1KteijJ6LvPBWj hKeN2qMAhIMeV9GuGzVGd+Dpu28Dhe3mqYqbowmEjlan7776bmiFWU7klb+HLM5j sy3BH49PLvkUDiZhlZJSpz5yzs4XvYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=QRQ9z6mYGMK3or7Ck dgaHSH9Rm79/Uy9AJ7nRxsqcsY=; b=HqwkQIZQS5eaDSXZRuiShiy/OW+u8tpqY C4p9QUHc9yXuq6nfpEOe88lmLMRw/08HomFWtU3r71xueLyYU7hClfxQZR35N9jb 5XX7WS7qps1NrXGaR1phK3Bc38XmrixRDUpEq7WGyUC60rrhydngpTHzVRI8cOqJ kR30jACt6ZO9GGa26qPXsem9KKWDhh6A43t3ejYgftKNlso9HNbqIdS9XW8EIXgs UR7oX4fj+7OyQDFBT1KWOI/1+ITdNaA3htrdfCVRqmchrQqS9KbpS+IaBa856AUV 4g0FgKcFblJLQVzEAudw5yFritNRvyVAqjyTqnGRs84AAdYlSBEkQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrgeejgddtvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffujgffkfggtgesthdtredttddttdenucfhrhhomhepfdfrhhhilhhiphcu mfdrfdcuoehphhhilhhiphesfigrrhhpmhgrihhlrdhnvghtqeenucggtffrrghtthgvrh hnpeehueeiffevveekteffueefkeefjeekkeekfeejleeufedtudffudfgueeigeffhfen ucfkphepkeejrddugeehrddtrddutdeinecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepphhhihhlihhpseifrghrphhmrghilhdrnhgvth X-ME-Proxy: Original-Received: from localhost (p5791006a.dip0.t-ipconnect.de [87.145.0.106]) by mail.messagingengine.com (Postfix) with ESMTPA id 1E29030600B2; Tue, 21 Jul 2020 14:35:58 -0400 (EDT) In-Reply-To: <838sfdgcy8.fsf@gnu.org> (message from Eli Zaretskii on Tue, 21 Jul 2020 17:27:59 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:183360 Archived-At: Thanks for the input, I'll try to fix everything you mentioned. Eli Zaretskii writes: >> (defun project-kill-buffers () >> "Kill all live buffers belonging to the current project. >> @@ -873,17 +941,13 @@ project-kill-buffers >> (interactive) >> (let ((pr (project-current t)) bufs) >> (dolist (buf (project--buffer-list pr)) >> - (unless (seq-some >> - (lambda (c) >> - (cond ((stringp c) >> - (string-match-p c (buffer-name buf))) >> - ((functionp c) >> - (funcall c buf)))) >> - project-kill-buffers-ignores) >> + (when (project--kill-buffer-check buf project-kill-buffer-conditions) >> (push buf bufs))) >> - (when (yes-or-no-p (format "Kill %d buffers in %s? " >> - (length bufs) (project-root pr))) >> - (mapc #'kill-buffer bufs)))) >> + (if (null bufs) >> + (message "No buffers to kill") >> + (when (yes-or-no-p (format "Kill %d buffers in %s? " >> + (length bufs) (project-root pr))) >> + (mapc #'kill-buffer bufs))))) > > Is this function intended to never be invoked from Lisp? If it can be > invoked from Lisp, then asking the yes-or-no-p question might not be > appropriate in the non-interactive case So would you suggest factoring out that programmatic part or checking if the command was invoked interactively? > (and the "No buffers to kill" message might be spared as well). I added "No buffers to kill", because if you're in a buffer that isn't killed, calling project-kill-buffers seems to have no effect. -- Philip K.