Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #29 - Report error when jump to definition doesn't find var #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 " correct-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