[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3cb06145070: * lisp/tab-bar.el (tab-bar-tab-post-select-functions
From: |
Juri Linkov |
Subject: |
master 3cb06145070: * lisp/tab-bar.el (tab-bar-tab-post-select-functions): New hook (bug#69093). |
Date: |
Tue, 5 Mar 2024 12:16:04 -0500 (EST) |
branch: master
commit 3cb06145070ff5d4a220f1144434f1ba6c1976f7
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/tab-bar.el (tab-bar-tab-post-select-functions): New hook (bug#69093).
(tab-bar-select-tab): Call tab-bar-tab-post-select-functions at the end.
---
etc/NEWS | 4 ++++
lisp/tab-bar.el | 13 ++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/etc/NEWS b/etc/NEWS
index a4b42263c36..b4343a7941b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -275,10 +275,14 @@ selected or deselected at the end of executing the
current command.
** Tab Bars and Tab Lines
+---
*** New user option 'tab-bar-tab-name-format-functions'.
It can be used to add, remove and reorder functions that change
the appearance of every tab on the tab bar.
+---
+*** New hook 'tab-bar-tab-post-select-functions'.
+
+++
** New optional argument for modifying directory-local variables.
The commands 'add-dir-local-variable', 'delete-dir-local-variable' and
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 3e1d8278b04..61efa332e0b 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1385,6 +1385,14 @@ inherits the current tab's `explicit-name' parameter."
tabs))))
+(defcustom tab-bar-tab-post-select-functions nil
+ "List of functions to call after selecting a tab.
+Two arguments are supplied: the previous tab that was selected before,
+and the newly selected tab."
+ :type '(repeat function)
+ :group 'tab-bar
+ :version "30.1")
+
(defvar tab-bar-minibuffer-restore-tab nil
"Tab number for `tab-bar-minibuffer-restore-tab'.")
@@ -1499,7 +1507,10 @@ Negative TAB-NUMBER counts tabs from the end of the tab
bar."
(tab-bar--current-tab-make (nth to-index tabs)))
(unless tab-bar-mode
- (message "Selected tab '%s'" (alist-get 'name to-tab))))
+ (message "Selected tab '%s'" (alist-get 'name to-tab)))
+
+ (run-hook-with-args 'tab-bar-tab-post-select-functions
+ from-tab to-tab))
(force-mode-line-update))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 3cb06145070: * lisp/tab-bar.el (tab-bar-tab-post-select-functions): New hook (bug#69093).,
Juri Linkov <=