[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 782a90da29: Use compilation-next-error-function
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 782a90da29: Use compilation-next-error-function, see #526 |
Date: |
Sun, 27 Feb 2022 09:57:21 -0500 (EST) |
branch: externals/consult
commit 782a90da29568a79259464c1c11854a3e16ea36e
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Use compilation-next-error-function, see #526
We have to work around its side effects, but besides that, there don't seem
to
be any downsides. On the plus side, the code get simpler, we don't access
double-dashed functions and we take advantage of the early marker
computation
for the entire file implemented in compilation-next-error-function.
---
consult-compile.el | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/consult-compile.el b/consult-compile.el
index 3abf9ccaee..a80cd6c4a3 100644
--- a/consult-compile.el
+++ b/consult-compile.el
@@ -66,20 +66,15 @@
(defun consult-compile--lookup (marker)
"Lookup error position given error MARKER."
- (when-let ((buffer (and marker (marker-buffer marker)))
- (msg (with-current-buffer buffer (get-text-property marker
'compilation-message)))
- (loc (compilation--message->loc msg))
- (default-directory (buffer-local-value 'default-directory
buffer)))
- (consult--position-marker
- ;; taken from compile.el
- (apply #'compilation-find-file
- marker
- (caar (compilation--loc->file-struct loc))
- (cadar (compilation--loc->file-struct loc))
- (compilation--file-struct->formats
- (compilation--loc->file-struct loc)))
- (compilation--loc->line loc)
- (compilation--loc->col loc))))
+ (when-let (buffer (and marker (marker-buffer marker)))
+ (with-current-buffer buffer
+ (let ((next-error-highlight nil)
+ (compilation-current-error marker)
+ (overlay-arrow-position overlay-arrow-position))
+ (ignore-errors
+ (save-window-excursion
+ (compilation-next-error-function 0)
+ (point-marker)))))))
(defun consult-compile--compilation-buffers (file)
"Return a list of compilation buffers relevant to FILE."
@@ -95,8 +90,8 @@
(let ((state (consult--jump-state 'consult-preview-error)))
(lambda (marker restore)
(let ((pos (consult-compile--lookup marker)))
- (when restore
- (with-current-buffer (marker-buffer marker)
+ (when-let (buffer (and restore marker (marker-buffer marker)))
+ (with-current-buffer buffer
(setq compilation-current-error marker
overlay-arrow-position marker)))
(funcall state pos restore)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/consult 782a90da29: Use compilation-next-error-function, see #526,
ELPA Syncer <=