From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matthias Meulien Newsgroups: gmane.emacs.bugs Subject: bug#52148: 29.0.50; [PATCH] Make `project-kill-buffers' display list of buffers to kill Date: Sun, 28 Nov 2021 09:21:13 +0100 Message-ID: <87r1b0lmh2.fsf@gmail.com> References: <87zgppl1ag.fsf@gmail.com> <83lf18yd5t.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18397"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 52148@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 28 09:22:15 2021 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 1mrFRv-0004cR-3V for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Nov 2021 09:22:15 +0100 Original-Received: from localhost ([::1]:42434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrFRu-00070Q-70 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Nov 2021 03:22:14 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42864) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrFRk-00070H-GU for bug-gnu-emacs@gnu.org; Sun, 28 Nov 2021 03:22:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51599) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mrFRi-0001wW-HT for bug-gnu-emacs@gnu.org; Sun, 28 Nov 2021 03:22:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mrFRi-0000w3-Bs for bug-gnu-emacs@gnu.org; Sun, 28 Nov 2021 03:22:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matthias Meulien Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Nov 2021 08:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52148 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 52148-submit@debbugs.gnu.org id=B52148.16380876823543 (code B ref 52148); Sun, 28 Nov 2021 08:22:02 +0000 Original-Received: (at 52148) by debbugs.gnu.org; 28 Nov 2021 08:21:22 +0000 Original-Received: from localhost ([127.0.0.1]:34912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mrFR3-0000v4-SB for submit@debbugs.gnu.org; Sun, 28 Nov 2021 03:21:22 -0500 Original-Received: from mail-wm1-f51.google.com ([209.85.128.51]:44933) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mrFR2-0000ur-T2 for 52148@debbugs.gnu.org; Sun, 28 Nov 2021 03:21:21 -0500 Original-Received: by mail-wm1-f51.google.com with SMTP id p27-20020a05600c1d9b00b0033bf8532855so10003724wms.3 for <52148@debbugs.gnu.org>; Sun, 28 Nov 2021 00:21:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=kLLpexZ8+nkhuahuz/Bfng+ag2SxwuXTYsizWo9wM+4=; b=jCsl4hisdFbyMhCyMMk+4bdhyZCHqpWieJ58bynqR40S24dPei6GSHDPUS9rEN+iNU BxFtZkEilU0eIG5iPqESdPywuzxKE1iYEMvW+F+0VRj9cjiENcVB07jDfTXAtsfhMmER 0SexJgqbAJ07B8Yq3m8lf/SOlkREF7x0HrtlWln78jq7sCCz9yXHTkvQk3jw0MSuL3YN O5wMZfVxQTOSP1c0hQUBXeOS+5VAMG8LHsZcpcKsAsAsBKQx1b0r1ItrmyQMS2ffRSV4 TILHO1W6GS7He9mMpTK1zFuQGDWPCnLR7lwQ1rdu54iVG+W5gXqqM84RGI4wWuhwZVML JJFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=kLLpexZ8+nkhuahuz/Bfng+ag2SxwuXTYsizWo9wM+4=; b=JhoIjpUbGzPenA/9Z1G0pBPRUfmhD9vMpQjTeBIdd87nToNticKuczIkb1LzD6CPQh h6Lk+f5VpfWmb+MjAMoWkPpz5+aX4txFMTGSjG1KsoIRT6PtbPCVnYLDvfT+9Ocim7z0 R1Gb1uVrOPx4GA+AGNUXvgET8iqRcbRKlm9UZ2BHZ66zoDANJ7ktTm4h2DuQ4M82TVP7 E8e0H7eBsBsVkboeZE8ACxfGmO1eGt8ZAMJKFiQf5cqWu/yHDRzCQaVo27bVaECP/Myg ecFX2m7CfTGjeAnC1lTC/twfNf11JeZaOvxkFNeGDbrz+VY/+Wvhk9+FEZ/ERzxKgF0g 12XA== X-Gm-Message-State: AOAM531D7ObttQbWBZZdiKXnowlvvH3ljbPMlydJpewIEfNnxspzgRu2 NyBa+O6ctlaZ8jfdTa89T+4x7YWBOYY= X-Google-Smtp-Source: ABdhPJzyIeUf6h2ERtYTiLlOdyf2U72zB3AsjrVfRuEKMG879BvONw+XnwjJbn5SwzUPSbm9pwS4LA== X-Received: by 2002:a05:600c:1990:: with SMTP id t16mr27337295wmq.48.1638087675056; Sun, 28 Nov 2021 00:21:15 -0800 (PST) Original-Received: from carbon.localdomain ([2a01:e0a:245:c850:98f5:429a:aa8e:95bb]) by smtp.gmail.com with ESMTPSA id h27sm17725530wmc.43.2021.11.28.00.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Nov 2021 00:21:14 -0800 (PST) In-Reply-To: <83lf18yd5t.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 28 Nov 2021 09:03:58 +0200") 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:220957 Archived-At: --=-=-= Content-Type: text/plain Minor patch update to remove an unused variable. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-project-kill-buffers-can-display-list-of-buffers-to-.patch >From 22a88c638c0404a5d28b1904edac1462258d9a1e Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Sat, 27 Nov 2021 22:43:20 +0100 Subject: [PATCH] project-kill-buffers can display list of buffers to kill * lisp/progmodes/project.el (project-kill-buffers-display-buffer-list): Option to toggle temporarily display of the list of buffers to kill when calling project-kill-buffers (project-kill-buffers): Handle project-kill-buffers-display-buffer-list option --- etc/NEWS | 4 ++++ lisp/progmodes/project.el | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 87a7a43a5e..2bc1e0046a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -427,6 +427,10 @@ it with new 'term-{faint,italic,slow-blink,fast-blink}' faces. *** 'project-find-file' and 'project-or-external-find-file' now accept a prefix argument which is interpreted to mean "include all files". +*** 'project-kill-buffers' can display the list of buffers to kill. +Customize the user option 'project-kill-buffers-display-buffer-list' +to enable the display of the buffer list. + +++ *** New command 'xref-go-forward'. It is bound to 'C-M-,' and jumps to the location where 'xref-go-back' diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index ed076a683d..f845a01136 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1210,6 +1210,14 @@ project-kill-buffer-conditions :group 'project :package-version '(project . "0.6.0")) +(defcustom project-kill-buffers-display-buffer-list nil + "Non-nil to display list of buffers to kill before killing project buffers." + :type 'boolean + :version "29.0" + :group 'project + :package-version '(project . "0.8.1") + :safe #'booleanp) + (defun project--buffer-list (pr) "Return the list of all buffers in project PR." (let ((conn (file-remote-p (project-root pr))) @@ -1276,14 +1284,34 @@ project-kill-buffers interactively." (interactive) (let* ((pr (project-current t)) - (bufs (project--buffers-to-kill pr))) + (bufs (project--buffers-to-kill pr)) + (query-user (lambda () + (yes-or-no-p + (format "Kill %d buffers in %s? " + (length bufs) + (project-root pr)))))) (cond (no-confirm (mapc #'kill-buffer bufs)) ((null bufs) (message "No buffers to kill")) - ((yes-or-no-p (format "Kill %d buffers in %s? " - (length bufs) - (project-root pr))) + (project-kill-buffers-display-buffer-list + (with-current-buffer-window + (get-buffer-create "*Buffer List*") + `(display-buffer--maybe-at-bottom + (dedicated . t) + (window-height . (fit-window-to-buffer)) + (preserve-size . (nil . t)) + (body-function + . ,#'(lambda (_window) + (list-buffers-noselect nil bufs)))) + #'(lambda (window _value) + (with-selected-window window + (unwind-protect + (funcall query-user) + (when (window-live-p window) + (quit-restore-window window 'kill)))))) + (mapc #'kill-buffer bufs)) + ((funcall query-user) (mapc #'kill-buffer bufs))))) -- 2.30.2 --=-=-= Content-Type: text/plain -- Matthias --=-=-=--