@@ -1848,71 +1848,6 @@ For example \"foo.bar.tar\" -> \"foo.bar\"."
1848
1848
1849
1849
; ;; Completion
1850
1850
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
-
1916
1851
(defun cider-read-symbol-name (prompt callback )
1917
1852
" Read a symbol name using PROMPT with a default of the one at point.
1918
1853
Use CALLBACK as the completing read var callback."
0 commit comments