From 06f753515bbd00a7bbab6e744603186259853472 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 3 Jun 2025 18:49:31 +0300 Subject: [PATCH] * lisp/tab-line.el: Use 'consp' on mouse events instead of 'listp'. (tab-line-hscroll-right, tab-line-hscroll-left, tab-line-new-tab) (tab-line-switch-to-prev-tab, tab-line-switch-to-next-tab) (tab-line-close-tab, tab-line-close-other-tabs): Replace '(listp event)' with '(consp event)' that allows calling the functions non-interactively with nil event arguments. (cherry picked from commit 332f733d88bab937120fc4de5679db92d7636d15) --- lisp/tab-line.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 997db3ce7a0..4835a65a8df 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -862,7 +862,7 @@ the selected tab visible." Interactively, ARG is the prefix numeric argument and defaults to 1." (interactive (list current-prefix-arg last-nonmenu-event)) (when (tab-line-track-tap event) - (let ((window (and (listp event) + (let ((window (and (consp event) (posn-window (tab-line-event-start event))))) (tab-line-hscroll arg window) (force-mode-line-update window)))) @@ -872,7 +872,7 @@ Interactively, ARG is the prefix numeric argument and defaults to 1." Interactively, ARG is the prefix numeric argument and defaults to 1." (interactive (list current-prefix-arg last-nonmenu-event)) (when (tab-line-track-tap event) - (let ((window (and (listp event) + (let ((window (and (consp event) (posn-window (tab-line-event-start event))))) (tab-line-hscroll (- (or arg 1)) window) (force-mode-line-update window)))) @@ -888,7 +888,7 @@ corresponding to the new buffer shown in the window." (if (functionp tab-line-new-tab-choice) (funcall tab-line-new-tab-choice) (let ((tab-line-tabs-buffer-groups mouse-buffer-menu-mode-groups)) - (if (and (listp event) + (if (and (consp event) (display-popup-menus-p) (not tty-menu-open-use-tmm)) (mouse-buffer-menu event) ; like (buffer-menu-open) @@ -953,7 +953,7 @@ switches to the previous buffer in the sequence defined by is possible when `tab-line-switch-cycling' is non-nil." (interactive (list last-nonmenu-event (prefix-numeric-value current-prefix-arg))) - (let ((window (and (listp event) (posn-window (event-start event))))) + (let ((window (and (consp event) (posn-window (event-start event))))) (with-selected-window (or window (selected-window)) (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) (previous-buffer arg t) @@ -983,7 +983,7 @@ switches to the next buffer in the sequence defined by is possible when `tab-line-switch-cycling' is non-nil." (interactive (list last-nonmenu-event (prefix-numeric-value current-prefix-arg))) - (let ((window (and (listp event) (posn-window (event-start event))))) + (let ((window (and (consp event) (posn-window (event-start event))))) (with-selected-window (or window (selected-window)) (if (eq tab-line-tabs-function #'tab-line-tabs-window-buffers) (next-buffer arg t) @@ -1096,7 +1096,7 @@ right side of the tab. This command buries the buffer, so it goes out of sight of the tab line." (interactive (list last-nonmenu-event)) (when (tab-line-track-tap event) - (let* ((posnp (and (listp event) + (let* ((posnp (and (consp event) (tab-line-event-start event))) (window (and posnp (posn-window posnp))) (tab (if posnp @@ -1124,7 +1124,7 @@ sight of the tab line." It preforms the same actions on the closed tabs as in `tab-line-close-tab'." (interactive (list last-nonmenu-event)) (when (tab-line-track-tap event) - (let* ((posnp (and (listp event) + (let* ((posnp (and (consp event) (tab-line-event-start event))) (window (and posnp (posn-window posnp))) (keep-tab (if posnp -- 2.39.5