]> git.eshelyaron.com Git - emacs.git/commitdiff
Amend last change to 'kill-this-buffer'
authorStephen Berman <stephen.berman@gmx.net>
Wed, 9 Jul 2025 08:59:13 +0000 (10:59 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 24 Jul 2025 07:54:31 +0000 (09:54 +0200)
* lisp/menu-bar.el (kill-this-buffer): Take using window tool bar
into account (bug#78809).

(cherry picked from commit 8b86978895b2dacce2830de0cdc680a00b274b58)

lisp/menu-bar.el

index 8e9b9b1103872885bd6540070f8ac3a96003ef13..21d70b9e6421e53333d58dd719eb271fdba5f54e 100644 (file)
@@ -2203,9 +2203,16 @@ to invoke a similar command with `M-x', use `kill-current-buffer'."
   ;; This colossus of a conditional is necessary to account for the wide
   ;; variety of this command's callers.
   (if (let ((lce last-command-event))
-        (eq (if (atom lce)              ; Selected menu item.
-                lce
-              (car lce))                ; Clicked tool bar icon.
+        (eq (cond
+             ((atom lce)                ; Selected menu item.
+              lce)
+             ((mouse-event-p lce)       ; Clicked window tool bar icon.
+              ;; Code from window-tool-bar--call-button.
+              (let* ((posn (event-start lce))
+                     (str (posn-string posn)))
+                (get-text-property (cdr str) 'tool-bar-key (car str))))
+             (t
+              (car lce)))               ; Clicked tool bar icon.
             'kill-buffer))
       (if (let* ((window (or (posn-window (event--posn-at-point))
                              last-event-frame