[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bufferlo ef806d7155 19/37: Fix bug when switching to a
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/bufferlo ef806d7155 19/37: Fix bug when switching to a tab with empty local buffer list |
|
Date: |
Sun, 5 Nov 2023 09:57:32 -0500 (EST) |
branch: externals/bufferlo
commit ef806d715555190e51355bf400bcce589b009c2d
Author: Florian Rommel <mail@florommel.de>
Commit: Florian Rommel <mail@florommel.de>
Fix bug when switching to a tab with empty local buffer list
On `tab-bar-select-tab', when wc-bl or wc-bbl is nil, the
corresponding buffer-list / buried-buffer-list frame parameter is not
set. As a result the previous tab's value is used. This is a
workaround to clear buffer-list and buried-buffer-list when switching.
---
bufferlo.el | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/bufferlo.el b/bufferlo.el
index 7d09669b16..b2f0e0d0b5 100644
--- a/bufferlo.el
+++ b/bufferlo.el
@@ -112,6 +112,8 @@ This is a list of regular expressions that match buffer
names."
(defvar bufferlo--desktop-advice-active nil)
+(defvar bufferlo--clear-buffer-lists-active nil)
+
;;;###autoload
(define-minor-mode bufferlo-mode
"Manage frame/tab-local buffers."
@@ -137,7 +139,10 @@ This is a list of regular expressions that match buffer
names."
(advice-add #'frameset--restore-frame :around #'bufferlo--activate)
(advice-add #'frameset-save :around #'bufferlo--activate)
(advice-add #'tab-bar-select-tab :around #'bufferlo--activate)
- (advice-add #'tab-bar--tab :around #'bufferlo--activate))
+ (advice-add #'tab-bar--tab :around #'bufferlo--activate)
+ ;; Switch-tab workaround
+ (advice-add #'tab-bar-select-tab :around
#'bufferlo--clear-buffer-lists-activate)
+ (advice-add #'tab-bar--tab :after #'bufferlo--clear-buffer-lists))
;; Prefer local buffers
(dolist (frame (frame-list))
(bufferlo--reset-buffer-predicate frame))
@@ -151,7 +156,10 @@ This is a list of regular expressions that match buffer
names."
(advice-remove #'frameset--restore-frame #'bufferlo--activate)
(advice-remove #'frameset-save #'bufferlo--activate)
(advice-remove #'tab-bar-select-tab #'bufferlo--activate)
- (advice-remove #'tab-bar--tab #'bufferlo--activate)))
+ (advice-remove #'tab-bar--tab #'bufferlo--activate)
+ ;; Switch-tab workaround
+ (advice-remove #'tab-bar-select-tab
#'bufferlo--clear-buffer-lists-activate)
+ (advice-remove #'tab-bar--tab #'bufferlo--clear-buffer-lists)))
(defun bufferlo-local-buffer-p (buffer &optional frame tabnum include-hidden)
"Return whether BUFFER is in the list of local buffers.
@@ -169,6 +177,22 @@ a tab index in the given frame. If INCLUDE-HIDDEN is set,
include hidden
buffers, see `bufferlo-hidden-buffers'."
(not (bufferlo-local-buffer-p buffer frame tabnum include-hidden)))
+(defun bufferlo--clear-buffer-lists (&optional frame)
+ "This is a workaround advice function to fix tab-bar's tab switching
behavior.
+On `tab-bar-select-tab', when wc-bl or wc-bbl is nil, the corresponding
+buffer-list / buried-buffer-list parameter is not set.
+As a result the previous tab's value is used.
+This functions clears buffer-list and buried-buffer-list. It should be called
+after `tab-bar--tab' but only when it is called from `tab-bar-select-tab'."
+ (when bufferlo--clear-buffer-lists-active
+ (set-frame-parameter frame 'buffer-list nil)
+ (set-frame-parameter frame 'buried-buffer-list nil)))
+
+(defun bufferlo--clear-buffer-lists-activate (oldfn &rest args)
+ "See `bufferlo--clear-buffer-lists'."
+ (let ((bufferlo--clear-buffer-lists-active t))
+ (apply oldfn args)))
+
(defun bufferlo--buffer-predicate (buffer)
(bufferlo-local-buffer-p buffer nil nil t))
- [elpa] externals/bufferlo d74f2c1ece 21/37: Add bufferlo-remove-non-exclusive-buffers, (continued)
- [elpa] externals/bufferlo d74f2c1ece 21/37: Add bufferlo-remove-non-exclusive-buffers, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 2fc945a81b 10/37: Update README, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 79eba76029 06/37: Include buried buffers, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo ecae697601 18/37: Fix local ibuffer buffer name, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 2bcbde24be 29/37: Update documentation, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 6d27fbd704 37/37: Add COPYING to elpaignore, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 1c16e19694 25/37: Fix frame predicate to include hidden buffers, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 795ef9e937 13/37: Fix README, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 1660b52975 24/37: Cleanup documentation, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 93154c1bc1 05/37: Add interactive auxiliary functions, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo ef806d7155 19/37: Fix bug when switching to a tab with empty local buffer list,
ELPA Syncer <=
- [elpa] externals/bufferlo a777218a3c 34/37: Stylistic improvements, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 521339ae25 20/37: Fix window-state-put, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 43e03ee793 33/37: Add .elpaignore, ELPA Syncer, 2023/11/05