From 9ca71a80fca692cb829becdaefaea026dc5853eb Mon Sep 17 00:00:00 2001 From: shipmints Date: Tue, 28 Jan 2025 18:24:15 -0500 Subject: [PATCH] Add abnormal hook tab-bar-post-undo-close-tab-functions * 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 80294229ffd..bb2720297a0 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -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"))) -- 2.39.5