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 27, 2020
1 parent b540e13 commit c3f124f
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions monroe.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; -*- indent-tabs-mode: nil -*-
;;; -*- indent-tabs-mode: nil; lexical-binding: t -*-
;;; monroe.el --- Yet another client for nREPL

;; Copyright (c) 2014-2018 Sanel Zukan
Expand Down Expand Up @@ -487,17 +487,28 @@ inside a container.")
(format "%s" `((juxt (comp str clojure.java.io/resource :file) :line)
(meta ,(if ns `(ns-resolve ',(intern ns) ',(intern var))
`(resolve ',(intern var))))))
(lambda (response)
(monroe-dbind-response response (id value status)
(when (member "done" status)
(remhash id monroe-requests))
(when value
(destructuring-bind (file line)
(append (car (read-from-string value)) nil)
(monroe-jump-find-file (funcall monroe-translate-path-function file))
(when line
(goto-char (point-min))
(forward-line (1- line)))))))))
(let ((correct-var var)
(correct-ns ns))
(lambda (response)
(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 (concat correct-var
(when ns (concat " (in " ns ")")))
'face 'font-lock-variable-name-face))))
(when value
(destructuring-bind (file line)
(append (car (read-from-string value)) nil)
(monroe-jump-find-file (funcall monroe-translate-path-function
file))
(when line
(goto-char (point-min))
(forward-line (1- line))))))))))

(defun monroe-get-stacktrace ()
"When error happens, print the stack trace"
Expand Down Expand Up @@ -555,8 +566,7 @@ 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))
(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 c3f124f

Please sign in to comment.