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: Sun, 16 Apr 2017 09:42:04 -0400 Message-ID: References: <20170412194437.19648.75020@vcs0.savannah.gnu.org> <20170412194438.934FD22EE8@vcs0.savannah.gnu.org> <87shldl1v8.fsf@localhost> <83h91sizcn.fsf@gnu.org> <87vaq79903.fsf@localhost> <83r30vh2k3.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1492350486 16094 195.159.176.226 (16 Apr 2017 13:48:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Apr 2017 13:48:06 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Juri Linkov , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 16 15:48:02 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 1czkX3-000450-Tm for ged-emacs-devel@m.gmane.org; Sun, 16 Apr 2017 15:48:02 +0200 Original-Received: from localhost ([::1]:60607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czkX9-0008Od-Ny for ged-emacs-devel@m.gmane.org; Sun, 16 Apr 2017 09:48:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czkWI-0008Fw-LC for emacs-devel@gnu.org; Sun, 16 Apr 2017 09:47:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1czkRL-0001Xs-GY for emacs-devel@gnu.org; Sun, 16 Apr 2017 09:42:11 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:44761) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czkRL-0001Xd-AF; Sun, 16 Apr 2017 09:42:07 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v3GDg48H021291; Sun, 16 Apr 2017 09:42:04 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 5DBE1662BB; Sun, 16 Apr 2017 09:42:04 -0400 (EDT) In-Reply-To: <83r30vh2k3.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 14 Apr 2017 10:27:08 +0300") 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, RV6000=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6000> : inlines <5807> : streams <1741444> : uri <2410629> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:213998 Archived-At: > After so many years that this code existed, I see no reason to rock > the boat now. This bike shed's color was fixed long ago; if we didn't > care during all these years, we should definitely leave it at that > now. I think the patch below would make the function more robust and eliminate the need to warn about weird behaviors in unusual circumstances. Stefan diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 28464f13df..2ee3f4777d 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -1896,16 +1896,13 @@ menu-bar-non-minibuffer-window-p (frame-selected-window menu-frame)))))) (defun kill-this-buffer () ; for the menu bar - "Kill the current buffer. + "Kill the selected window's buffer. When called in the minibuffer, get out of the minibuffer using `abort-recursive-edit'." (interactive) (cond - ;; Don't do anything when `menu-frame' is not alive or visible - ;; (Bug#8184). - ((not (menu-bar-menu-frame-live-and-visible-p))) - ((menu-bar-non-minibuffer-window-p) - (kill-buffer (current-buffer))) + ((window-minibuffer-p (selected-window)) + (kill-buffer (window-buffer))) (t (abort-recursive-edit))))