Skip to content

Commit

Permalink
Fix #29 - Report error when jump to definition doesn't find var
Browse files Browse the repository at this point in the history
  • Loading branch information
bbuccianti committed Sep 25, 2020
1 parent b540e13 commit 7c55def
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions monroe.el
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ to the one used on nrepl side.")

(defvar monroe-nrepl-server-project-file "project.clj")

(defvar monroe-var-to-jump nil
"Store the symbol to jump in order to show error if it's not defined.")

(make-variable-buffer-local 'monroe-session)
(make-variable-buffer-local 'monroe-requests)
(make-variable-buffer-local 'monroe-requests-counter)
Expand Down Expand Up @@ -488,9 +491,16 @@ inside a container.")
(meta ,(if ns `(ns-resolve ',(intern ns) ',(intern var))
`(resolve ',(intern var))))))
(lambda (response)
(monroe-dbind-response response (id value status)
(monroe-dbind-response response (id value status ex)
(when (member "done" status)
(remhash id monroe-requests))
(when ex
(message "%s"
(concat
(propertize "Couldn't find symbol: "
'face 'font-lock-warning-face)
(propertize monroe-var-to-jump
'face 'font-lock-variable-name-face))))
(when value
(destructuring-bind (file line)
(append (car (read-from-string value)) nil)
Expand Down Expand Up @@ -555,8 +565,8 @@ as path can be remote location. For remote paths, use absolute path."
(defvar find-tag-marker-ring) ;; etags.el
(require 'etags)
(ring-insert find-tag-marker-ring (point-marker))
(monroe-eval-jump (and (fboundp 'clojure-find-ns)
(funcall 'clojure-find-ns)) var))
(setq monroe-var-to-jump var)
(monroe-eval-jump (monroe-get-clojure-ns) var))

(defun monroe-jump-pop ()
"Return point to the position and buffer before running `monroe-jump'."
Expand Down

0 comments on commit 7c55def

Please sign in to comment.