diff options
-rw-r--r-- | cider-browse-ns.el | 2 | ||||
-rw-r--r-- | cider-client.el | 35 | ||||
-rw-r--r-- | cider-find.el | 35 | ||||
-rw-r--r-- | cider-macroexpansion.el | 2 | ||||
-rw-r--r-- | cider-mode.el | 2 | ||||
-rw-r--r-- | cider-repl.el | 1 | ||||
-rw-r--r-- | cider-stacktrace.el | 2 | ||||
-rw-r--r-- | cider-test.el | 2 |
8 files changed, 46 insertions, 35 deletions
diff --git a/cider-browse-ns.el b/cider-browse-ns.el index 46409e82..42c22ea1 100644 --- a/cider-browse-ns.el +++ b/cider-browse-ns.el @@ -209,6 +209,8 @@ be displayed." (cider-doc-lookup value)))) (declare-function cider-find-ns "cider-find") +(declare-function cider-find-var "cider-find") + (defun cider-browse-ns-find-at-point () "Find the definition of the thing at point." (interactive) diff --git a/cider-client.el b/cider-client.el index 02e4587f..9e4d260c 100644 --- a/cider-client.el +++ b/cider-client.el @@ -346,41 +346,6 @@ unless ALL is truthy." (when (and class member) (cider-sync-request:info nil class member))) -(defun cider--find-var-other-window (var &optional line) - "Find the definition of VAR, optionally at a specific LINE. - -Display the results in a different window." - (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 t)) - (user-error "Symbol `%s' not resolved" var))) - -(defun cider--find-var (var &optional line) - "Find 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)) - (user-error "Symbol `%s' not resolved" var))) - -(defun cider-find-var (&optional arg var line) - "Find definition for VAR at LINE. -Prompt according to prefix ARG and `cider-prompt-for-symbol'. -A single or double prefix argument inverts the meaning of -`cider-prompt-for-symbol'. A prefix of `-` or a double prefix argument causes -the results to be displayed in a different window. The default value is -thing at point." - (interactive "P") - (cider-ensure-op-supported "info") - (if var - (cider--find-var var line) - (funcall (cider-prompt-for-symbol-function arg) - "Symbol" - (if (cider--open-other-window-p arg) - #'cider--find-var-other-window - #'cider--find-var)))) - ;;; Requests diff --git a/cider-find.el b/cider-find.el index a70461ae..739de9ab 100644 --- a/cider-find.el +++ b/cider-find.el @@ -31,6 +31,41 @@ (require 'thingatpt) +(defun cider--find-var-other-window (var &optional line) + "Find the definition of VAR, optionally at a specific LINE. + +Display the results in a different window." + (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 t)) + (user-error "Symbol `%s' not resolved" var))) + +(defun cider--find-var (var &optional line) + "Find 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)) + (user-error "Symbol `%s' not resolved" var))) + +(defun cider-find-var (&optional arg var line) + "Find definition for VAR at LINE. +Prompt according to prefix ARG and `cider-prompt-for-symbol'. +A single or double prefix argument inverts the meaning of +`cider-prompt-for-symbol'. A prefix of `-` or a double prefix argument causes +the results to be displayed in a different window. The default value is +thing at point." + (interactive "P") + (cider-ensure-op-supported "info") + (if var + (cider--find-var var line) + (funcall (cider-prompt-for-symbol-function arg) + "Symbol" + (if (cider--open-other-window-p arg) + #'cider--find-var-other-window + #'cider--find-var)))) + (defun cider--find-dwim (symbol-file callback &optional other-window) "Find the SYMBOL-FILE at point. CALLBACK upon failure to invoke prompt if not prompted previously. diff --git a/cider-macroexpansion.el b/cider-macroexpansion.el index d2fef819..8123932a 100644 --- a/cider-macroexpansion.el +++ b/cider-macroexpansion.el @@ -167,6 +167,8 @@ and point is placed after the expanded form." (cider-macroexpansion-mode 1) (current-buffer))) +(declare-function cider-find-var "cider-find") + (defvar cider-macroexpansion-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "g") #'cider-macroexpand-again) diff --git a/cider-mode.el b/cider-mode.el index 85095f3a..ff8782a8 100644 --- a/cider-mode.el +++ b/cider-mode.el @@ -433,6 +433,8 @@ If invoked with a prefix ARG eval the expression after inserting it." (declare-function cider-find-resource "cider-find") (declare-function cider-find-ns "cider-find") (declare-function cider-find-keyword "cider-find") +(declare-function cider-find-var "cider-find") + (defconst cider-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-c C-d") 'cider-doc-map) diff --git a/cider-repl.el b/cider-repl.el index 52ef83b0..7740eda1 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -1567,6 +1567,7 @@ constructs." (declare-function cider-find-resource "cider-find") (declare-function cider-find-ns "cider-find") (declare-function cider-find-keyword "cider-find") +(declare-function cider-find-var "cider-find") (declare-function cider-switch-to-last-clojure-buffer "cider-mode") (declare-function cider-macroexpand-1 "cider-macroexpansion") (declare-function cider-macroexpand-all "cider-macroexpansion") diff --git a/cider-stacktrace.el b/cider-stacktrace.el index 9fb3cee3..4738ef12 100644 --- a/cider-stacktrace.el +++ b/cider-stacktrace.el @@ -584,6 +584,8 @@ Achieved by destructively manipulating the `cider-stacktrace-suppressed-errors' (forward-line line-shift) (back-to-indentation))) +(declare-function cider-find-var "cider-find") + (defun cider-stacktrace-jump (&optional arg) "Find definition for stack frame at point, if available. The prefix ARG and `cider-prompt-for-symbol' decide whether to diff --git a/cider-test.el b/cider-test.el index 06a6061a..a84c3053 100644 --- a/cider-test.el +++ b/cider-test.el @@ -255,6 +255,8 @@ Add to this list to have CIDER recognize additional test defining macros." (when-let* ((pos (next-single-property-change pos 'type))) (goto-char pos)))))) +(declare-function cider-find-var "cider-find") + (defun cider-test-jump (&optional arg) "Find definition for test at point, if available. The prefix ARG and `cider-prompt-for-symbol' decide whether to |