From c67aa2d1ce3adb60a42e69ecfdd99f514ff30a96 Mon Sep 17 00:00:00 2001 From: Daniel Bergey Date: Sat, 14 May 2016 21:56:55 -0400 Subject: [PATCH] fallback to tags if there is no haskell-session The function name & docs suggest this is the intended behavior. `haskell-mode-find-def` errors if there is no session, so we need to only call it if there is a session. closes https://github.com/haskell/haskell-mode/issues/1180 --- haskell-commands.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/haskell-commands.el b/haskell-commands.el index d2d798510..57c60c897 100644 --- a/haskell-commands.el +++ b/haskell-commands.el @@ -350,13 +350,13 @@ If the definition or tag is found, the location from which you jumped will be pushed onto `xref--marker-ring', so you can return to that position with `xref-pop-marker-stack'." (interactive "P") - (let ((initial-loc (point-marker)) - (loc (haskell-mode-find-def (haskell-ident-at-point)))) - (if (not loc) - (call-interactively 'haskell-mode-tag-find) - (haskell-mode-handle-generic-loc loc) - (unless (equal initial-loc (point-marker)) - (xref-push-marker-stack initial-loc))))) + (if (haskell-session-maybe) + (let ((initial-loc (point-marker)) + (loc (haskell-mode-find-def (haskell-ident-at-point)))) + (haskell-mode-handle-generic-loc loc) + (unless (equal initial-loc (point-marker)) + (xref-push-marker-stack initial-loc))) + (call-interactively 'haskell-mode-tag-find))) ;;;###autoload (defun haskell-mode-goto-loc ()