summaryrefslogtreecommitdiff
path: root/lisp/tab-bar.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2019-12-16 01:08:45 +0200
committerJuri Linkov <juri@linkov.net>2019-12-16 01:08:45 +0200
commit468c8719945f3dc92a24d2ecc32f3f24f2f49491 (patch)
tree50f5f364a9b85257a917255b1ce6ae4212508159 /lisp/tab-bar.el
parentb73c21fa97a4417eeced4b52e9c73100d0693ba9 (diff)
downloademacs-468c8719945f3dc92a24d2ecc32f3f24f2f49491.tar.gz
* lisp/tab-bar.el (tab-bar-handle-mouse): Handle close button.
Diffstat (limited to 'lisp/tab-bar.el')
-rw-r--r--lisp/tab-bar.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 180db4d3e0c..92e11dec394 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -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))))))