[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 22d6821281 5/7: consult--jump-preview: Ensure t
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 22d6821281 5/7: consult--jump-preview: Ensure that buffer position is restored (Fix #858) |
Date: |
Sun, 1 Oct 2023 06:57:41 -0400 (EDT) |
branch: externals/consult
commit 22d682128197d6cbdfa1cbf3c978644a482f1568
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult--jump-preview: Ensure that buffer position is restored (Fix #858)
---
consult.el | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/consult.el b/consult.el
index 7414463710..ea96688be8 100644
--- a/consult.el
+++ b/consult.el
@@ -1513,10 +1513,23 @@ The function can be used as the `:state' argument of
`consult--read'."
(setq restore nil)
(if-let ((pos (or (car-safe cand) cand))) ;; Candidate can be previewed
(when (consult--jump-ensure-buffer pos)
+ (let ((saved-min (point-min-marker))
+ (saved-max (point-max-marker))
+ (saved-pos (point-marker)))
+ (set-marker-insertion-type saved-max t) ;; Grow when text is
inserted
+ (push (lambda ()
+ (when-let ((buf (marker-buffer saved-pos)))
+ (with-current-buffer buf
+ (narrow-to-region saved-min saved-max)
+ (goto-char saved-pos)
+ (set-marker saved-pos nil)
+ (set-marker saved-min nil)
+ (set-marker saved-max nil))))
+ restore))
(unless (= (goto-char pos) (point)) ;; Widen if jump failed
(widen)
(goto-char pos))
- (setq restore (consult--invisible-open-temporarily))
+ (setq restore (nconc (consult--invisible-open-temporarily)
restore))
;; Ensure that cursor is properly previewed
(gh:minad/consult#764)
(unless (eq cursor-in-non-selected-windows 'box)
(let ((orig cursor-in-non-selected-windows)
- [elpa] externals/consult updated (43380042da -> e269bc3c99), ELPA Syncer, 2023/10/01
- [elpa] externals/consult e2ecccd3eb 3/7: consult--jump-ensure-buffer: Rename from consult--jump-to-buffer, refactor, ELPA Syncer, 2023/10/01
- [elpa] externals/consult d1d48bd993 2/7: consult--jump-1: Inline function, ELPA Syncer, 2023/10/01
- [elpa] externals/consult 22d6821281 5/7: consult--jump-preview: Ensure that buffer position is restored (Fix #858),
ELPA Syncer <=
- [elpa] externals/consult 8228075d87 1/7: consult--jump-to-buffer: New function, ELPA Syncer, 2023/10/01
- [elpa] externals/consult 18dc54c25c 6/7: Remove consult--maybe-recenter, ELPA Syncer, 2023/10/01
- [elpa] externals/consult e269bc3c99 7/7: Rename variables to improve readability, ELPA Syncer, 2023/10/01
- [elpa] externals/consult f84da06f7a 4/7: Reuse consult--jump-ensure-buffer for restoration, ELPA Syncer, 2023/10/01