[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/bufferlo 36f5c68460 26/37: Fix tab movement and duplica
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/bufferlo 36f5c68460 26/37: Fix tab movement and duplication |
|
Date: |
Sun, 5 Nov 2023 09:57:33 -0500 (EST) |
branch: externals/bufferlo
commit 36f5c6846042dd790f8b0e13d8961219e6e0093f
Author: Florian Rommel <mail@florommel.de>
Commit: Florian Rommel <mail@florommel.de>
Fix tab movement and duplication
This commit fixes broken local buffer lists for moved and duplicated
frames. It removes the `bufferlo-desktop-support' custom variable.
Desktop support for local frames is now always enabled when
`bufferlo-mode' is active (was the default before), as deactivation
conflicts with tab movement, and it makes no sense to artificially
disable it.
---
bufferlo.el | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/bufferlo.el b/bufferlo.el
index 77f8bdda0f..f808706a55 100644
--- a/bufferlo.el
+++ b/bufferlo.el
@@ -57,12 +57,6 @@
"Manage frame/tab local buffers."
:group 'convenience)
-(defcustom bufferlo-desktop-support t
- "Enable support for desktop.el.
-Save and restore the frame/tab local buffer lists."
- :group 'bufferlo
- :type 'boolean)
-
(defcustom bufferlo-prefer-local-buffers t
"Use a frame predicate to prefer local buffers over global ones.
This means that a local buffer will be preferred to be displayed
@@ -112,6 +106,7 @@ This is a list of regular expressions that match buffer
names."
:type '(repeat string))
(defvar bufferlo--desktop-advice-active nil)
+(defvar bufferlo--desktop-advice-active-force nil)
(defvar bufferlo--clear-buffer-lists-active nil)
@@ -134,12 +129,12 @@ This is a list of regular expressions that match buffer
names."
;; Include/exclude buffers
(add-hook 'after-make-frame-functions
#'bufferlo--include-exclude-buffers)
(add-hook 'tab-bar-tab-post-open-functions
#'bufferlo--tab-include-exclude-buffers)
- ;; Desktop support
+ ;; Desktop support & duplicate/move tabs
(advice-add #'window-state-get :around #'bufferlo--window-state-get)
(advice-add #'window-state-put :after #'bufferlo--window-state-put)
(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-select-tab :around #'bufferlo--activate-force)
(advice-add #'tab-bar--tab :around #'bufferlo--activate)
;; Switch-tab workaround
(advice-add #'tab-bar-select-tab :around
#'bufferlo--clear-buffer-lists-activate)
@@ -151,12 +146,12 @@ This is a list of regular expressions that match buffer
names."
;; Include/exclude buffers
(remove-hook 'after-make-frame-functions
#'bufferlo--include-exclude-buffers)
(remove-hook 'tab-bar-tab-post-open-functions
#'bufferlo--tab-include-exclude-buffers)
- ;; Desktop support
+ ;; Desktop support & duplicate/move tabs
(advice-remove #'window-state-get #'bufferlo--window-state-get)
(advice-remove #'window-state-put #'bufferlo--window-state-put)
(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-select-tab #'bufferlo--activate-force)
(advice-remove #'tab-bar--tab #'bufferlo--activate)
;; Switch-tab workaround
(advice-remove #'tab-bar-select-tab
#'bufferlo--clear-buffer-lists-activate)
@@ -261,7 +256,9 @@ Includes hidden buffers."
(defun bufferlo--tab-include-exclude-buffers (ignore)
"Include and exclude buffers into buffer-list of the current tab's frame."
(ignore ignore)
- (bufferlo--include-exclude-buffers nil))
+ ;; Reset the local buffer list unless we clone the tab (tab-duplicate).
+ (unless (eq tab-bar-new-tab-choice 'clone)
+ (bufferlo--include-exclude-buffers nil)))
(defun bufferlo--current-buffers (frame)
"Get the buffers of the current tab in FRAME."
@@ -311,13 +308,7 @@ buffers, see `bufferlo-hidden-buffers'."
Ignore buffers that are not able to be persisted in the desktop file."
(let ((ws (apply oldfn (list window writable))))
(if bufferlo--desktop-advice-active
- (let* ((buffers
- (seq-filter
- (lambda (b)
- (desktop-save-buffer-p (buffer-file-name b)
- (buffer-name b)
- (with-current-buffer b major-mode)))
- (bufferlo--current-buffers (window-frame window))))
+ (let* ((buffers (bufferlo--current-buffers (window-frame window)))
(names (mapcar #'buffer-name buffers)))
(if names (append ws (list (list 'bufferlo-buffer-list names))) ws))
ws)))
@@ -329,7 +320,9 @@ Ignore buffers that are not able to be persisted in the
desktop file."
;; `frameset-restore' may pass a window with a non-existing buffer
;; to `window-state-put', which in turn will delete that window
;; before the advice calls us.
- (when (and bufferlo--desktop-advice-active (window-live-p window))
+ ;; This is not the case when we are called from `tab-bar-select-tab'.
+ (when (or bufferlo--desktop-advice-active-force
+ (and bufferlo--desktop-advice-active (window-live-p window)))
;; FIXME: Currently there is no distinction between buffers and
;; buried buffers for dektop.el.
(let ((bl (car (cdr (assq 'bufferlo-buffer-list state)))))
@@ -343,7 +336,13 @@ Ignore buffers that are not able to be persisted in the
desktop file."
(defun bufferlo--activate (oldfn &rest args)
"Activate the advice for `bufferlo--window-state-{get,put}'."
- (let ((bufferlo--desktop-advice-active bufferlo-desktop-support))
+ (let ((bufferlo--desktop-advice-active t))
+ (apply oldfn args)))
+
+(defun bufferlo--activate-force (oldfn &rest args)
+ "Activate the advice for `bufferlo--window-state-{get,put}'."
+ (let ((bufferlo--desktop-advice-active t)
+ (bufferlo--desktop-advice-active-force t))
(apply oldfn args)))
(defun bufferlo-clear (&optional frame)
- [elpa] branch externals/bufferlo created (now 6d27fbd704), ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 387b84d5de 03/37: Fix package-lint issues, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo a1bea7ff9e 01/37: Initial commit, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo f214f92445 08/37: Fix typos, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo e40613cbbc 22/37: Fix buffer selection in empty tabs, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 41e6e56783 27/37: Fix clone-frame, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 36f5c68460 26/37: Fix tab movement and duplication,
ELPA Syncer <=
- [elpa] externals/bufferlo 0254201487 11/37: Add prefix argument to bufferlo-switch-to-buffer, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 778ede4d4b 35/37: Resolve checkdoc warnings, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo d41a6b297b 17/37: Allow hidden buffers, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo bfe906c2aa 12/37: Update README, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 931b9ee346 32/37: Version 0.2, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 1dd04e4b41 14/37: Better ibuffer support, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo c164b26a64 36/37: Compatibility improvements, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 82f51c31ab 23/37: desktop.el support: Fix error on deleted windows, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 8f82be00b1 30/37: Add basic buffer-menu support, ELPA Syncer, 2023/11/05
- [elpa] externals/bufferlo 914c381e9f 16/37: Fix buffer matching, ELPA Syncer, 2023/11/05