Skip to content

Commit 9fb8e3a

Browse files
committed
Merge pull request #1316 from fice-t/tag
Update xref-push-marker-stack
2 parents 7c406ea + 9ac7077 commit 9fb8e3a

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

haskell-commands.el

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,11 @@ position with `xref-pop-marker-stack'."
352352
(interactive "P")
353353
(let ((initial-loc (point-marker))
354354
(loc (haskell-mode-find-def (haskell-ident-at-point))))
355-
(if loc
356-
(haskell-mode-handle-generic-loc loc)
357-
(call-interactively 'haskell-mode-tag-find))
358-
(unless (equal initial-loc (point-marker))
359-
(save-excursion
360-
(goto-char initial-loc)
361-
(xref-push-marker-stack)))))
355+
(if (not loc)
356+
(call-interactively 'haskell-mode-tag-find)
357+
(haskell-mode-handle-generic-loc loc)
358+
(unless (equal initial-loc (point-marker))
359+
(xref-push-marker-stack initial-loc)))))
362360

363361
;;;###autoload
364362
(defun haskell-mode-goto-loc ()
@@ -379,7 +377,7 @@ Requires the :loc-at command from GHCi."
379377
(forward-char (plist-get span :start-col)))
380378

381379
(defun haskell-process-insert-type ()
382-
"Get the identifer at the point and insert its type.
380+
"Get the identifier at the point and insert its type.
383381
Use GHCi's :type if it's possible."
384382
(let ((ident (haskell-ident-at-point)))
385383
(when ident

haskell-compat.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
(unless (fboundp 'xref-push-marker-stack)
3636
(defalias 'xref-pop-marker-stack 'pop-tag-mark)
3737

38-
(defun xref-push-marker-stack ()
39-
"Add point to the marker stack."
40-
(ring-insert find-tag-marker-ring (point-marker))))
38+
(defun xref-push-marker-stack (&optional m)
39+
"Add point M (defaults to `point-marker') to the marker stack."
40+
(ring-insert find-tag-marker-ring (or m (point-marker)))))
4141

4242
(unless (fboundp 'outline-hide-sublevels)
4343
(defalias 'outline-hide-sublevels 'hide-sublevels))

0 commit comments

Comments
 (0)