From 7c55def7bdcb8cc9ac81dc54e4213bd0493aef8b Mon Sep 17 00:00:00 2001 From: Benjamin Buccianti Date: Fri, 25 Sep 2020 19:16:40 -0300 Subject: [PATCH] Fix #29 - Report error when jump to definition doesn't find var --- monroe.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/monroe.el b/monroe.el index 9cdf3b6..86313b6 100644 --- a/monroe.el +++ b/monroe.el @@ -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) @@ -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) @@ -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'."