]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/tab-bar.el (tab-bar-handle-mouse): Handle close button.
authorJuri Linkov <juri@linkov.net>
Sun, 15 Dec 2019 23:08:45 +0000 (01:08 +0200)
committerJuri Linkov <juri@linkov.net>
Sun, 15 Dec 2019 23:08:45 +0000 (01:08 +0200)
lisp/tab-bar.el

index 180db4d3e0ce90e5dd65acd28dbfd916a99ab0fd..92e11dec394e9ed2b54755ed53f96dbf958546a3 100644 (file)
@@ -174,11 +174,14 @@ on a console which has no window system but does have a mouse."
     (when x-position
       (unless (catch 'done
                 (map-keymap
-                 (lambda (_key binding)
+                 (lambda (key binding)
                    (when (eq (car-safe binding) 'menu-item)
                      (when (> (+ column (length (nth 1 binding))) x-position)
-                       ;; TODO: handle close
-                       (unless (get-text-property (- x-position column) 'close-tab (nth 1 binding))
+                       (if (get-text-property (- x-position column) 'close-tab (nth 1 binding))
+                           (let* ((close-key (vector (intern (format "C-%s" key))))
+                                  (close-def (lookup-key keymap close-key)))
+                             (when close-def
+                               (call-interactively close-def)))
                          (call-interactively (nth 2 binding)))
                        (throw 'done t))
                      (setq column (+ column (length (nth 1 binding))))))