[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 6c098ba9c9: corfu-popupinfo--get-location: Ensure
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu 6c098ba9c9: corfu-popupinfo--get-location: Ensure that previewed buffer is killed |
Date: |
Tue, 22 Nov 2022 12:57:28 -0500 (EST) |
branch: externals/corfu
commit 6c098ba9c96d43a0f93d53ebf582693fdf47bfcf
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
corfu-popupinfo--get-location: Ensure that previewed buffer is killed
---
extensions/corfu-popupinfo.el | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el
index 11512373a1..bd1064d14d 100644
--- a/extensions/corfu-popupinfo.el
+++ b/extensions/corfu-popupinfo.el
@@ -164,21 +164,23 @@ all values are in pixels relative to the origin. See
(defun corfu-popupinfo--get-location (candidate)
"Get source at location of CANDIDATE."
- (let (cleanup)
- (unwind-protect
- (save-excursion
+ (save-excursion
+ (let ((old-buffers (buffer-list)) (buffer nil))
+ (unwind-protect
(when-let* ((fun (plist-get corfu--extra :company-location))
;; BUG: company-location may throw errors if location is
not found
(loc (ignore-errors (funcall fun candidate)))
- (res (or (and (bufferp (car loc)) (car loc))
- (get-file-buffer (car loc))
- (let ((inhibit-message t)
- (enable-dir-local-variables nil)
- (enable-local-variables :safe)
- (non-essential t)
- (delay-mode-hooks t))
- (setq cleanup (find-file-noselect (car loc)
t))))))
- (with-current-buffer res
+ ((setq buffer
+ (or (and (bufferp (car loc)) (car loc))
+ (get-file-buffer (car loc))
+ (let ((inhibit-message t)
+ (enable-dir-local-variables nil)
+ (enable-local-variables :safe)
+ (non-essential t)
+ (delay-mode-hooks t)
+ (find-file-hook
'(global-font-lock-mode-check-buffers)))
+ (find-file-noselect (car loc) t))))))
+ (with-current-buffer buffer
(save-excursion
(save-restriction
(widen)
@@ -192,9 +194,10 @@ all values are in pixels relative to the origin. See
(forward-line (* 10 corfu-popupinfo-max-height))
(when jit-lock-mode
(jit-lock-fontify-now beg (point)))
- (setq res (buffer-substring beg (point)))
- (and (not (string-blank-p res)) res)))))))
- (when cleanup (kill-buffer cleanup)))))
+ (let ((res (buffer-substring beg (point))))
+ (and (not (string-blank-p res)) res)))))))
+ (when (and buffer (not (memq buffer old-buffers)))
+ (kill-buffer buffer))))))
(defun corfu-popupinfo--get-documentation (candidate)
"Get the documentation for CANDIDATE."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/corfu 6c098ba9c9: corfu-popupinfo--get-location: Ensure that previewed buffer is killed,
ELPA Syncer <=