Skip to content

Commit ea23329

Browse files
fromhetenbbatsov
authored andcommitted
Add cider-load-all-files and clojure-files-in-directory functions (#1983)
Useful when the nREPL host is on another machine, and you wish to "force" the state of your local file system onto that remote nREPL all at once.
1 parent b89e18a commit ea23329

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### New Features
66

7+
* Add new function `cider-load-all-files`, along with menu bar update.
78
* Add new customization variable `cider-special-mode-truncate-lines`.
89
* Add an option `cider-inspector-fill-frame` to control whether the cider inspector window fills its frame.
910
* [#1893](https://github.com/clojure-emacs/cider/issues/1893): Add negative prefix argument to `cider-refresh` to inhibit invoking of cider-refresh-functions

cider-interaction.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,9 +1622,18 @@ The heavy lifting is done by `cider-load-buffer'."
16221622
(find-file filename)
16231623
(cider-load-buffer (current-buffer))))
16241624

1625+
(defun cider-load-all-files (directory)
1626+
"Load all files in DIRECTORY (recursively). Useful when the running nREPL on remote host."
1627+
(interactive "DLoad files beneath directory: ")
1628+
(mapcar #'cider-load-file
1629+
(directory-files-recursively directory ".clj$")))
1630+
16251631
(defalias 'cider-eval-file 'cider-load-file
16261632
"A convenience alias as some people are confused by the load-* names.")
16271633

1634+
(defalias 'cider-eval-all-files 'cider-load-all-files
1635+
"A convenience alias as some people are confused by the load-* names.")
1636+
16281637
(defalias 'cider-eval-buffer 'cider-load-buffer
16291638
"A convenience alias as some people are confused by the load-* names.")
16301639

cider-mode.el

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ Configure `cider-cljs-*-repl' to change the ClojureScript REPL to use for your b
235235
"--"
236236
["Load this buffer" cider-load-buffer]
237237
["Load another file" cider-load-file]
238+
["Recursively load all files in directory" cider-load-all-files]
238239
["Load all project files" cider-load-all-project-ns]
239240
["Refresh loaded code" cider-refresh]
240241
["Run project (-main function)" cider-run])
@@ -314,6 +315,7 @@ Configure `cider-cljs-*-repl' to change the ClojureScript REPL to use for your b
314315
(define-key map (kbd "C-c C-o") #'cider-find-and-clear-repl-output)
315316
(define-key map (kbd "C-c C-k") #'cider-load-buffer)
316317
(define-key map (kbd "C-c C-l") #'cider-load-file)
318+
(define-key map (kbd "C-c C-M-l") #'cider-load-all-files)
317319
(define-key map (kbd "C-c C-b") #'cider-interrupt)
318320
(define-key map (kbd "C-c ,") 'cider-test-commands-map)
319321
(define-key map (kbd "C-c C-t") 'cider-test-commands-map)

doc/cider-refcard.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ \subsection{Evaluation}
7979
\begin{keylist}[labelwidth=\widthof{\keyify{C-c RET}}]
8080
\item[C-c C-k] cider-load-buffer
8181
\item[C-c C-l] cider-load-file
82+
\item[C-c C-M-l] cider-load-all-files
8283
\item[C-c C-r] cider-eval-region
8384
\item[C-c C-n] cider-eval-ns-form
8485
\item[C-x C-e] \ns{cider-eval-last-sexp}

doc/interactive_programming.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Here's a list of `cider-mode`'s keybindings:
4141
`cider-find-and-clear-repl-output` |<kbd>C-c C-o</kbd> | Clear the last output in the REPL buffer. With a prefix argument it will clear the entire REPL buffer, leaving only a prompt. Useful if you're running the REPL buffer in a side by side buffer.
4242
`cider-load-buffer` |<kbd>C-c C-k</kbd> | Load (eval) the current buffer.
4343
`cider-load-file` |<kbd>C-c C-l</kbd> | Load (eval) a Clojure file.
44+
`cider-load-all-files` |<kbd>C-c C-M-l</kbd> | Load (eval) all Clojure files below a directory.
4445
`cider-refresh` |<kbd>C-c C-x</kbd> | Reload all modified files on the classpath. If invoked with a prefix argument, reload all files on the classpath. If invoked with a double prefix argument, clear the state of the namespace tracker before reloading.
4546
`cider-doc` |<kbd>C-c C-d d</kbd> <br/> <kbd>C-c C-d C-d</kbd> | Display doc string for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.
4647
`cider-javadoc` |<kbd>C-c C-d j</kbd> <br/> <kbd>C-c C-d C-j</kbd> | Display JavaDoc (in your default browser) for the symbol at point. If invoked with a prefix argument, or no symbol is found at point, prompt for a symbol.

0 commit comments

Comments
 (0)