Skip to content

Commit d0d2a66

Browse files
committed
[Fix #1078] Remove cider-load-fn-into-repl-buffer
This function isn't terrible useful, as it only provides a completing read of all the vars available in the namespace to insert into the repl. Furthermore, company-mode already provides the completing read if you just start typing.
1 parent a914e5d commit d0d2a66

File tree

4 files changed

+2
-68
lines changed

4 files changed

+2
-68
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@
4040
* [#1032](https://github.com/clojure-emacs/cider/issues/1032) New functions, `cider-find-dwim` and
4141
`cider-find-dwim-other-window`. These functions combine the functionality of `cider-jump-to-var` and
4242
`cider-jump-to-resource`. Which are now renamed to `cider-find-var` and `cider-find-resource` respectively.
43-
* [#1014](https://github.com/clojure-emacs/cider/issues/1014) A prefix of <kbd>-</kbd> causes `cider-find-var` and
43+
* [#1014](https://github.com/clojure-emacs/cider/issues/1014) A prefix of <kbd>-</kbd> causes `cider-find-var` and
4444
`cider-find-resource` to show results in other window. Additionally, a double prefix argument <kbd>C-u C-u</kbd>
4545
inverts the meaning of `cider-prompt-for-symbol` and shows the results in other window.
4646

4747
### Changes
4848

49+
* [#1078] Removed `cider-load-fn-into-repl-buffer`, bound to `C-c M-f` in the repl.
4950
* [#1019](https://github.com/clojure-emacs/cider/pull/1019):
5051
<kbd>C-u C-M-x</kbd> no longer does `eval-defun`+print-result. Instead it debugs the form at point.
5152
* [#854](https://github.com/clojure-emacs/cider/pull/854) Error navigation now

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,6 @@ Keyboard shortcut | Description
792792
<kbd>C-c C-d a</kbd> | Apropos search for functions/vars.
793793
<kbd>C-c C-d A</kbd> | Apropos search for documentation.
794794
<kbd>C-c C-z</kbd> | Switch to the previous Clojure buffer. This complements <kbd>C-c C-z</kbd> used in cider-mode.
795-
<kbd>C-c M-f</kbd> | Select a function from the current namespace and insert into the REPL buffer.
796795
<kbd>C-c M-i</kbd> | Inspect expression. Will act on expression at point if present.
797796
<kbd>C-c M-n</kbd> | Select a namespace and switch to it.
798797
<kbd>C-c M-t v</kbd> | Toggle var tracing.

cider-interaction.el

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,71 +1848,6 @@ For example \"foo.bar.tar\" -> \"foo.bar\"."
18481848

18491849
;;; Completion
18501850

1851-
(defun cider-completing-read-var-select (prompt callback ns selected targets)
1852-
"Peform completing read using SELECTED and TARGETS.
1853-
If SELECTED is \"..\" then another selection is made for vars in the parent namespace of
1854-
NS using PROMPT.
1855-
If SELECTED is a namespace then another selection is made against that namespace
1856-
using PROMPT.
1857-
Once a selecton is made CALLBACK is called with SELECTED."
1858-
;; TODO: immediate RET gives "" as selected for some reason
1859-
;; this is an OK workaround though
1860-
(cond ((equal "" selected)
1861-
(cider-completing-read-var-select prompt callback ns (car targets) targets))
1862-
((equal "/" (substring selected -1)) ; selected a namespace
1863-
(cider-completing-read-var prompt (substring selected 0 -1) callback))
1864-
((equal ".." selected)
1865-
(cider-completing-read-var prompt (cider-parent-ns ns) callback))
1866-
;; non ido variable selection techniques don't return qualified symbols, so this shouldn't either
1867-
(t (funcall callback selected))))
1868-
1869-
(defun cider-completing-read-sym-handler (label completing-read-callback buffer)
1870-
"Create an nrepl response handler for BUFFER.
1871-
The handler will parse the response from nrepl to create targets for a completing read.
1872-
The result of the completing read will be passed to COMPLETING-READ-CALLBACK."
1873-
(nrepl-make-response-handler buffer
1874-
(lambda (buffer value)
1875-
;; make sure to eval the callback in the buffer that the symbol was requested from so we get the right namespace
1876-
(with-current-buffer buffer
1877-
(let* ((targets (car (read-from-string value)))
1878-
(selected (completing-read label targets nil t)))
1879-
(funcall completing-read-callback selected targets))))
1880-
nil nil nil))
1881-
1882-
(defun cider-completing-read-sym-form (label form callback)
1883-
"Eval the FORM and pass the result to the response handler."
1884-
(cider-tooling-eval form (cider-completing-read-sym-handler label callback (current-buffer))))
1885-
1886-
(defun cider-completing-read-var (prompt ns callback)
1887-
"Perform completing read var in NS using CALLBACK."
1888-
(cider-completing-read-sym-form prompt (prin1-to-string (cider-fetch-vars-form ns))
1889-
(lambda (selected targets)
1890-
(cider-completing-read-var-select prompt callback ns selected targets))))
1891-
1892-
(defun cider-fetch-fns-form (ns)
1893-
"Construct a Clojure form for reading fns using supplied NS."
1894-
(format "(let [fn-pred (fn [[k v]] (and (fn? (.get v))
1895-
(not (re-find #\"clojure.\" (str v)))))]
1896-
(sort
1897-
(map (comp name key)
1898-
(filter fn-pred
1899-
(concat
1900-
(ns-interns '%s)
1901-
(ns-refers '%s))))))" ns ns))
1902-
1903-
(defun cider-load-fn-into-repl-buffer ()
1904-
"Browse functions available in current repl buffer.
1905-
Once selected, the name of the fn will appear in the repl buffer in parens
1906-
ready to call."
1907-
(interactive)
1908-
(let ((ns (cider-current-ns)))
1909-
(cider-completing-read-sym-form (format "Fn: %s/" ns)
1910-
(cider-fetch-fns-form ns)
1911-
(lambda (f _targets)
1912-
(with-current-buffer (cider-current-repl-buffer)
1913-
(cider-repl--replace-input (format "(%s)" f))
1914-
(goto-char (- (point-max) 1)))))))
1915-
19161851
(defun cider-read-symbol-name (prompt callback)
19171852
"Read a symbol name using PROMPT with a default of the one at point.
19181853
Use CALLBACK as the completing read var callback."

cider-repl.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,6 @@ constructs."
10291029
(define-key map (kbd "C-c M-m") 'cider-macroexpand-all)
10301030
(define-key map (kbd "C-c C-z") 'cider-switch-to-last-clojure-buffer)
10311031
(define-key map (kbd "C-c M-s") 'cider-selector)
1032-
(define-key map (kbd "C-c M-f") 'cider-load-fn-into-repl-buffer)
10331032
(define-key map (kbd "C-c C-q") 'cider-quit)
10341033
(define-key map (kbd "C-c M-i") 'cider-inspect)
10351034
(define-key map (kbd "C-c M-t v") 'cider-toggle-trace-var)

0 commit comments

Comments
 (0)