[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 0a5af92d60 3/5: Ignore display-buffer-in-tab du
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 0a5af92d60 3/5: Ignore display-buffer-in-tab during buffer preview |
Date: |
Sun, 8 Dec 2024 03:57:38 -0500 (EST) |
branch: externals/consult
commit 0a5af92d60efc8bb5727b692f87a0ec042bbf5e8
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Ignore display-buffer-in-tab during buffer preview
---
consult.el | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/consult.el b/consult.el
index 4ad701b127..a582743677 100644
--- a/consult.el
+++ b/consult.el
@@ -4434,19 +4434,23 @@ AS is a conversion function."
(set-window-prev-buffers other-win orig-prev)
(set-window-next-buffers other-win orig-next))
('preview
- (when (and (eq consult--buffer-display
#'switch-to-buffer-other-window)
- (not other-win))
- (switch-to-buffer-other-window orig-buf 'norecord)
- (setq other-win (selected-window)))
- (let ((win (or other-win (selected-window)))
- (buf (or (and cand (get-buffer cand)) orig-buf)))
- (when (and (window-live-p win) (buffer-live-p buf)
- (not (buffer-match-p consult-preview-excluded-buffers
buf)))
- (with-selected-window win
- (unless (or orig-prev orig-next)
- (setq orig-prev (copy-sequence (window-prev-buffers))
- orig-next (copy-sequence (window-next-buffers))))
- (switch-to-buffer buf 'norecord)))))))))
+ ;; Prevent opening the preview in another tab, since restoring the tab
+ ;; status is difficult and also costly.
+ (cl-letf* (((symbol-function #'display-buffer-in-tab) #'ignore)
+ ((symbol-function #'display-buffer-in-new-tab) #'ignore))
+ (when (and (eq consult--buffer-display
#'switch-to-buffer-other-window)
+ (not other-win))
+ (switch-to-buffer-other-window orig-buf 'norecord)
+ (setq other-win (selected-window)))
+ (let ((win (or other-win (selected-window)))
+ (buf (or (and cand (get-buffer cand)) orig-buf)))
+ (when (and (window-live-p win) (buffer-live-p buf)
+ (not (buffer-match-p consult-preview-excluded-buffers
buf)))
+ (with-selected-window win
+ (unless (or orig-prev orig-next)
+ (setq orig-prev (copy-sequence (window-prev-buffers))
+ orig-next (copy-sequence (window-next-buffers))))
+ (switch-to-buffer buf 'norecord))))))))))
(defun consult--buffer-action (buffer &optional norecord)
"Switch to BUFFER via `consult--buffer-display' function.