branch: externals/consult
commit 8c6c63b613e5cd22f95a4e1839a9ae01caa4499f
Author: Daniel Mendler <m...@daniel-mendler.de>
Commit: Daniel Mendler <m...@daniel-mendler.de>

    consult--jump: Always copy marker before push-mark to be safe (See #562)
---
 consult.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/consult.el b/consult.el
index fb1d961f90..f164bc0e74 100644
--- a/consult.el
+++ b/consult.el
@@ -1283,6 +1283,9 @@ See `isearch-open-necessary-overlays' and 
`isearch-open-overlay-temporary'."
     ;; 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))))
+      ;; 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))
       (push-mark (point) t))
     (consult--jump-1 pos)
     (consult--invisible-open-permanently)

Reply via email to