Skip to content

Commit

Permalink
[Fix clojure-emacs#921] Non-interactive cider-jump-to-var.
Browse files Browse the repository at this point in the history
Commit b130451 broke non-interactive use of `cider-jump-to-var`, which in turn
broke `cider-test-jump`.  This commit fixes the former issue and thus also fixes
the latter.
  • Loading branch information
llasram committed Jan 10, 2015
1 parent af1667d commit e721eac
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -717,16 +717,22 @@ OTHER-WINDOW is passed to `cider-jamp-to'."
(cider-jump-to buffer (cons line nil) other-window)
(message "No source location"))))

(defun cider--jump-to-var (var &optional line)
"Jump to the definition of VAR, optionally at a specific LINE."
(-if-let (info (cider-var-info var))
(progn
(if line (setq info (nrepl-dict-put info "line" line)))
(cider--jump-to-loc-from-info info))
(message "Symbol %s not resolved" var)))

(defun cider-jump-to-var (&optional var line)
"Jump to the definition of VAR, optionally at a specific LINE.
When called interactively, this operates on point, or falls back to a prompt."
(interactive)
(cider-ensure-op-supported "info")
(cider-read-symbol-name
"Symbol: " (lambda (var)
(-if-let (info (cider-var-info var))
(cider--jump-to-loc-from-info info)
(message "Symbol %s not resolved" var)))))
(if var
(cider--jump-to-var var line)
(cider-read-symbol-name "Symbol: " #'cider--jump-to-var)))

(define-obsolete-function-alias 'cider-jump 'cider-jump-to-var "0.7.0")
(defalias 'cider-jump-back 'pop-tag-mark)
Expand Down

0 comments on commit e721eac

Please sign in to comment.