emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tab-bar.el: add defcustoms for functions to call after openi


From: Robert Cochran
Subject: Re: [PATCH] tab-bar.el: add defcustoms for functions to call after opening and before closing
Date: Wed, 11 Dec 2019 10:32:26 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Juri Linkov <address@hidden> writes:

>> I've fixed it in this version of the patch.
>
> Thanks, now your patch is pushed to master.

Thanks.

Just realized though that I forgot to change tab-bar-close-other-tabs to
also use the new custom variables, so here's a patch for that.

Cheers,
-- 
~Robert Cochran

>From b777800d60c02745b20ea31ce4b10cf010168889 Mon Sep 17 00:00:00 2001
From: Robert Cochran <address@hidden>
Date: Wed, 11 Dec 2019 10:29:00 -0800
Subject: [PATCH] * lisp/tab-bar.el (tab-bar-close-other-tabs): Use tab close
 customs

---
 lisp/tab-bar.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index ba4bc0afcd..59cba2c877 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -896,11 +896,18 @@ tab-bar-close-other-tabs
          (current-index (tab-bar--current-tab-index tabs)))
     (when current-index
       (dotimes (index (length tabs))
-        (unless (eq index current-index)
+        (unless (or (eq index current-index)
+                    (run-hook-with-args-until-success
+                     'tab-bar-tab-prevent-close-functions
+                     (nth index tabs)
+                     ; last-tab-p logically can't ever be true if we
+                     ; make it this far
+                     nil))
           (push `((frame . ,(selected-frame))
                   (index . ,index)
                   (tab . ,(nth index tabs)))
-                tab-bar-closed-tabs)))
+                tab-bar-closed-tabs)
+          (run-hook-with-args 'tab-bar-tab-pre-close-functions (nth index 
tabs) nil)))
       (set-frame-parameter nil 'tabs (list (nth current-index tabs)))
 
       (when (and tab-bar-mode
-- 
2.23.0


reply via email to

[Prev in Thread] Current Thread [Next in Thread]