From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-25 bc55a57: * lisp/menu-bar.el (kill-this-buffer): Doc fix. (Bug#26466) Date: Wed, 12 Apr 2017 16:27:44 -0400 Message-ID: References: <20170412194437.19648.75020@vcs0.savannah.gnu.org> <20170412194438.934FD22EE8@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1492028909 14297 195.159.176.226 (12 Apr 2017 20:28:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 12 Apr 2017 20:28:29 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 12 22:28:22 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cyOsH-0003Tp-IY for ged-emacs-devel@m.gmane.org; Wed, 12 Apr 2017 22:28:21 +0200 Original-Received: from localhost ([::1]:46132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyOsI-0000KS-Dr for ged-emacs-devel@m.gmane.org; Wed, 12 Apr 2017 16:28:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyOrm-0000KC-6q for emacs-devel@gnu.org; Wed, 12 Apr 2017 16:27:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyOri-0004OS-84 for emacs-devel@gnu.org; Wed, 12 Apr 2017 16:27:50 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:38382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyOri-0004O2-2F; Wed, 12 Apr 2017 16:27:46 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v3CKRiV8007289; Wed, 12 Apr 2017 16:27:44 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 40DC7602AA; Wed, 12 Apr 2017 16:27:44 -0400 (EDT) In-Reply-To: <20170412194438.934FD22EE8@vcs0.savannah.gnu.org> (Eli Zaretskii's message of "Wed, 12 Apr 2017 15:44:38 -0400 (EDT)") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV5997=0 X-NAI-Spam-Version: 2.3.0.9418 : core <5997> : inlines <5804> : streams <1740911> : uri <2408525> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:213919 Archived-At: > +This command can be reliably invoked only from the menu bar, > +otherwise it could decide to silently do nothing." All this is due to: commit a86b330f8fa754c4b919ea14d0c5dcf261f055c4 Author: Juri Linkov Date: Sun Mar 16 17:44:20 2008 +0000 (kill-this-buffer): Use menu-bar-non-minibuffer-window-p to check if the current buffer is the minibuffer, and in this case call abort-recursive-edit to kill the minibuffer. Doc fix. (kill-this-buffer-enabled-p): Allow this function to return non-nil when the current buffer is the minibuffer. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1444,1 +1446,3 @@ - (kill-buffer (current-buffer))) + (if (menu-bar-non-minibuffer-window-p) + (kill-buffer (current-buffer)) + (abort-recursive-edit))) Jury, do you remember why we wanted this behavior? There are two questions here: - Why would we want to run abort-recursive-edit when we're in the minibuffer? - Why did we decide to use menu-bar-non-minibuffer-window-p rather than checking something like (window-minibuffer-p (frame-selected-window))? I think there should be a way to make kill-this-buffer behave sanely just as much when called from the menu-bar as called from M-x [ I'm not concerned about calling it from Elisp and I'm perfectly happy to mark it `interactive-only`. ] Stefan