From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-25 bc55a57: * lisp/menu-bar.el (kill-this-buffer): Doc fix. (Bug#26466) Date: Thu, 13 Apr 2017 01:03:50 +0300 Organization: LINKOV.NET Message-ID: <87shldl1v8.fsf@localhost> 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; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1492034845 1012 195.159.176.226 (12 Apr 2017 22:07:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 12 Apr 2017 22:07:25 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (x86_64-pc-linux-gnu) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 13 00:07:19 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 1cyQQ2-00008U-Mw for ged-emacs-devel@m.gmane.org; Thu, 13 Apr 2017 00:07:18 +0200 Original-Received: from localhost ([::1]:46410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyQQ6-0007GJ-Gu for ged-emacs-devel@m.gmane.org; Wed, 12 Apr 2017 18:07:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cyQPV-0007G9-4A for emacs-devel@gnu.org; Wed, 12 Apr 2017 18:06:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cyQPT-0007ZN-R1 for emacs-devel@gnu.org; Wed, 12 Apr 2017 18:06:45 -0400 Original-Received: from sub3.mail.dreamhost.com ([69.163.253.7]:53115 helo=homiemail-a22.g.dreamhost.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cyQPN-0007Vu-Is; Wed, 12 Apr 2017 18:06:38 -0400 Original-Received: from homiemail-a22.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTP id BEFF6114067; Wed, 12 Apr 2017 15:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=jurta.org; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=jurta.org; bh=TrQKBEA zok5eFH3ie1pgGXwz5ZU=; b=YvnQYE5dP9mPAKj+tQSRdtUpVLsqQsVd1ItIWpw aJyqih5ilRcqqf7fjn74D/H0Fx9jljXukun1LwkrQp9MpUFnaNlXn3kALR0UmXJU 0La5VoZ5RstUa8eKuNS/mCAL8v819H2Ue+VHkktbQPHv69jO89Az1qyjq0h3UzIm Yijw= Original-Received: from localhost.linkov.net (m90-133-225-157.cust.tele2.ee [90.133.225.157]) (Authenticated sender: jurta@jurta.org) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTPA id A9727114066; Wed, 12 Apr 2017 15:06:30 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Wed, 12 Apr 2017 16:27:44 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 69.163.253.7 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:213920 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 c= ase > 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 minib= uffer? I clearly remember that the intention was to discard the minibuffer when the user clicks on the big cross, i.e. the "Close" button in the toolbar, because its mnemonics suggests to close the currently active buffer - if it's the minibuffer, then close the minibuffer. It also makes sense to do the same when the menu item "Close" is selected from the "File" menu due to its definition: (bindings--define-key menu [kill-buffer] '(menu-item "Close" kill-this-buffer :enable (kill-this-buffer-enabled-p) :help "Discard (kill) current buffer")) where "Discard (kill) current buffer" could also apply to the currently active minibuffer. > - Why did we decide to use menu-bar-non-minibuffer-window-p rather than > checking something like (window-minibuffer-p (frame-selected-window))= ? =E2=80=98menu-bar-non-minibuffer-window-p=E2=80=99 already does this, and= additionally takes into account =E2=80=98menu-updating-frame=E2=80=99 and checks for =E2= =80=98frame-live-p=E2=80=99. > 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 i= t > `interactive-only`. ] In any case it makes no sense to add special-casing for the minibuffer in =E2=80=98kill-current-buffer=E2=80=99 since it is necessary only in =E2=80= =98kill-this-buffer=E2=80=99 associated with the tool-bar/menu-bar. =E2=80=98kill-current-buffer=E2=80= =99 should be just an alias for =E2=80=98(kill-buffer (current-buffer))=E2=80=99.