emacs-diffs
[Top][All Lists]
Advanced

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

master 4e36767: * lisp/tab-bar.el: Check for minibuffer-depth in tab-bar


From: Juri Linkov
Subject: master 4e36767: * lisp/tab-bar.el: Check for minibuffer-depth in tab-bar-history-mode.
Date: Mon, 28 Oct 2019 17:55:25 -0400 (EDT)

branch: master
commit 4e3676726a64018cd4688d2669657878a2975f2c
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>

    * lisp/tab-bar.el: Check for minibuffer-depth in tab-bar-history-mode.
    
    * lisp/tab-bar.el (tab-bar-history--pre-change): Store also 
minibuffer-depth.
    (tab-bar-history-change): Check stored minibuffer-depth for zero.
    (tab-bar-history-mode): Use prefix -- for internal functions.
---
 lisp/tab-bar.el | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 1151df9..c476333 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -870,17 +870,23 @@ function `tab-bar-tab-name-function'."
 (defvar tab-bar-history-forward (make-hash-table)
   "History of forward changes in every tab per frame.")
 
-(defvar tab-bar-history-pre-change nil
-  "Window configuration before the current command.")
+(defvar tab-bar-history--pre-change nil
+  "Window configuration and minibuffer depth before the current command.")
 
-(defun tab-bar-history-pre-change ()
-  (setq tab-bar-history-pre-change (current-window-configuration)))
+(defun tab-bar-history--pre-change ()
+  (setq tab-bar-history--pre-change
+        (list (current-window-configuration)
+              (minibuffer-depth))))
 
-(defun tab-bar-history-change ()
+(defun tab-bar--history-change ()
   (when (and (not tab-bar-history-omit)
+             tab-bar-history--pre-change
+             ;; Entering the minibuffer
+             (zerop (nth 1 tab-bar-history--pre-change))
+             ;; Exiting the minibuffer
              (zerop (minibuffer-depth)))
     (puthash (selected-frame)
-             (cons tab-bar-history-pre-change
+             (cons (nth 0 tab-bar-history--pre-change)
                    (gethash (selected-frame) tab-bar-history-back))
             tab-bar-history-back))
   (when tab-bar-history-omit
@@ -934,10 +940,10 @@ function `tab-bar-tab-name-function'."
                                                 :ascent center))
                                tab-bar-forward-button))
 
-        (add-hook 'pre-command-hook 'tab-bar-history-pre-change)
-        (add-hook 'window-configuration-change-hook 'tab-bar-history-change))
-    (remove-hook 'pre-command-hook 'tab-bar-history-pre-change)
-    (remove-hook 'window-configuration-change-hook 'tab-bar-history-change)))
+        (add-hook 'pre-command-hook 'tab-bar-history--pre-change)
+        (add-hook 'window-configuration-change-hook 'tab-bar--history-change))
+    (remove-hook 'pre-command-hook 'tab-bar-history--pre-change)
+    (remove-hook 'window-configuration-change-hook 'tab-bar--history-change)))
 
 
 ;;; Short aliases



reply via email to

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