Skip to content

Commit

Permalink
[Fix clojure-emacs#22] Add jump to resource command
Browse files Browse the repository at this point in the history
  • Loading branch information
Bozhidar Batsov authored and dgtized committed Jun 24, 2014
1 parent 55ce583 commit a147272
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cider-interaction.el
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ which will use the default REPL connection."
"inspect-start" "inspect-refresh"
"inspect-pop" "inspect-push" "inspect-reset"
"macroexpand" "macroexpand-1" "macroexpand-all"
"stacktrace" "toggle-trace")
"resource" "stacktrace" "toggle-trace")
"A list of nREPL ops required by CIDER to function properly.
All of them are provided by CIDER's nREPL middleware(cider-nrepl).")
Expand Down Expand Up @@ -626,6 +626,17 @@ exists) is added as a prefix to LOCATION."
(interactive "P")
(cider-read-symbol-name "Symbol: " 'cider-jump-to-def query))

(defun cider-jump-to-resource ()
"Jump to resource file at point."
(interactive)
(cider-ensure-op-supported "resource")
(let ((resource (thing-at-point 'filename)))
(-when-let (resource-path (plist-get (nrepl-send-request-sync
(list "op" "resource"
"name" resource)) :value))
(ring-insert find-tag-marker-ring (point-marker))
(find-file resource-path))))

(defalias 'cider-jump-back 'pop-tag-mark)

(defvar cider-completion-last-context nil)
Expand Down
1 change: 1 addition & 0 deletions cider-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
["Macroexpand-all last expression" cider-macroexpand-all]
"--"
["Jump to source" cider-jump]
["Jump to resource" cider-jump-to-resource]
["Jump back" cider-jump-back]
"--"
["Display documentation" cider-doc]
Expand Down

0 comments on commit a147272

Please sign in to comment.