branch: externals/consult commit 4b3e4bb7c8cf1d13dad17711ef7eb0d7305c5338 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Convert marker to number instead of copying it unnecessarily --- consult.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/consult.el b/consult.el index f164bc0e74..2d12e71a8f 100644 --- a/consult.el +++ b/consult.el @@ -1280,12 +1280,13 @@ See `isearch-open-necessary-overlays' and `isearch-open-overlay-temporary'." (defun consult--jump (pos) "Push current position to mark ring, go to POS and recenter." (when pos - ;; When the marker is in the same buffer, - ;; record previous location such that the user can jump back quickly. - (unless (and (markerp pos) (not (eq (current-buffer) (marker-buffer pos)))) + ;; When the marker is in the same buffer, record previous location + ;; such that the user can jump back quickly. + (when (or (not (markerp pos)) (eq (current-buffer) (marker-buffer pos))) ;; push-mark mutates markers in the mark-ring and the mark-marker. - ;; Therefore we copy the marker to be safe. We all love side effects! - (setq pos (copy-marker pos)) + ;; Therefore we transform the marker to a number to be safe. + ;; We all love side effects! + (setq pos (+ pos 0)) (push-mark (point) t)) (consult--jump-1 pos) (consult--invisible-open-permanently)