Skip to content

Commit

Permalink
Merge pull request #941 from llasram/noninteractive-cider-jump-to-var
Browse files Browse the repository at this point in the history
[Fix #921] Non-interactive `cider-jump-to-var`.
  • Loading branch information
bbatsov committed Jan 10, 2015
2 parents af1667d + 2dad9d7 commit 4b40208
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
* [#934](https://github.com/clojure-emacs/cider/issues/934): Remove
`cider-turn-on-eldoc-mode` in favor of simply using `eldoc-mode`.

### Bugs fixed

* [#921](https://github.com/clojure-emacs/cider/issues/921): Fixed
non-functioning `cider-test-jump` from test reports.

## 0.8.2 / 2014-12-21

### Bugs fixed
Expand Down
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 4b40208

Please sign in to comment.