]> git.eshelyaron.com Git - emacs.git/commitdiff
Add abnormal hook tab-bar-post-undo-close-tab-functions
authorshipmints <shipmints@gmail.com>
Tue, 28 Jan 2025 23:24:15 +0000 (18:24 -0500)
committerEshel Yaron <me@eshelyaron.com>
Mon, 3 Feb 2025 11:10:35 +0000 (12:10 +0100)
* lisp/tab-bar.el (tab-bar-undo-close-tab):
Add new abnormal hook tab-bar-post-undo-close-tab-functions (bug#75919).

(cherry picked from commit 815c4dc0e07cfae5398c6145a4b4887b7fa64f42)

lisp/tab-bar.el

index 80294229ffde53f8a5e9a0af7bd6c25199aae783..bb2720297a0d2aa9122dac4db0290dba18cebcf6 100644 (file)
@@ -2169,6 +2169,13 @@ happens interactively)."
       (unless tab-bar-mode
         (message "Deleted all other tabs")))))
 
+(defcustom tab-bar-post-undo-close-tab-functions nil
+  "List of functions to call after a closed tab is restored.
+Each function is called with one argument: the tab that has been restored."
+  :type '(repeat function)
+  :group 'tab-bar
+  :version "31.1")
+
 (defun tab-bar-undo-close-tab ()
   "Restore the most recently closed tab."
   (interactive)
@@ -2192,6 +2199,8 @@ happens interactively)."
             ;; `pushnew' handles the head of tabs but not frame-parameter
             (tab-bar-tabs-set tabs))
           (tab-bar-select-tab (1+ index)))
+        (run-hook-with-args 'tab-bar-post-undo-close-tab-functions
+                            tab)
         (tab-bar--update-tab-bar-lines))
 
     (message "No more closed tabs to undo")))