From d3995a5e52c9785afe242329de2d74c0c9c37b6b Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Sat, 12 Sep 2015 11:18:39 +1200 Subject: [PATCH] Don't spuriously set mark on xref push This fixes #863, whereby jumping to the definition of a symbol in the same file was incorrectly activating the mark and region. This commit also simplifies the original code, since the initial position marker can simply be passed to xref-push-marker-stack. (The haskell-compat shim for that function is also fixed here accordingly.) --- haskell-commands.el | 7 +------ haskell-compat.el | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/haskell-commands.el b/haskell-commands.el index 052f89e86..553d738d0 100644 --- a/haskell-commands.el +++ b/haskell-commands.el @@ -364,12 +364,7 @@ position with `xref-pop-marker-stack'." (haskell-mode-handle-generic-loc loc) (call-interactively 'haskell-mode-tag-find)) (unless (equal initial-loc (point-marker)) - (with-current-buffer (marker-buffer initial-loc) - (save-excursion - (goto-char initial-loc) - (set-mark-command nil) - ;; Store position for return with `xref-pop-marker-stack' - (xref-push-marker-stack)))))) + (xref-push-marker-stack initial-loc)))) ;;;###autoload (defun haskell-mode-goto-loc () diff --git a/haskell-compat.el b/haskell-compat.el index f83985458..b08254325 100644 --- a/haskell-compat.el +++ b/haskell-compat.el @@ -43,9 +43,9 @@ A process is considered alive if its status is `run', `open', (unless (fboundp 'xref-push-marker-stack) (defalias 'xref-pop-marker-stack 'pop-tag-mark) - (defun xref-push-marker-stack () + (defun xref-push-marker-stack (&optional m) "Add point to the marker stack." - (ring-insert find-tag-marker-ring (point-marker)))) + (ring-insert find-tag-marker-ring (or m (point-marker))))) (unless (fboundp 'outline-hide-sublevels) (defalias 'outline-hide-sublevels 'hide-sublevels))