154
154
(macroexpand . " (clojure.core/macroexpand '%s)" )
155
155
(macroexpand-1 . " (clojure.core/macroexpand-1 '%s)" )))))
156
156
157
+ (defvar-local inf-clojure-repl-type nil
158
+ " Symbol to define your REPL type.
159
+ Its root binding is nil and it can be further customized using
160
+ either `setq-local` or an entry in `.dir-locals.el`." )
161
+
162
+ (defvar inf-clojure-buffer nil
163
+ " The current `inf-clojure' process buffer.
164
+
165
+ MULTIPLE PROCESS SUPPORT
166
+ ===========================================================================
167
+ To run multiple Clojure processes, you start the first up
168
+ with \\ [inf-clojure]. It will be in a buffer named `*inf-clojure*' .
169
+ Rename this buffer with \\ [rename-buffer]. You may now start up a new
170
+ process with another \\ [inf-clojure]. It will be in a new buffer,
171
+ named `*inf-clojure*' . You can switch between the different process
172
+ buffers with \\ [switch-to-buffer].
173
+
174
+ Commands that send text from source buffers to Clojure processes --
175
+ like `inf-clojure-eval-defun' or `inf-clojure-show-arglists' -- have to choose a
176
+ process to send to, when you have more than one Clojure process around. This
177
+ is determined by the global variable `inf-clojure-buffer' . Suppose you
178
+ have three inferior Clojures running:
179
+ Buffer Process
180
+ foo inf-clojure
181
+ bar inf-clojure<2>
182
+ *inf-clojure* inf-clojure<3>
183
+ If you do a \\ [inf-clojure-eval-defun] command on some Clojure source code,
184
+ what process do you send it to?
185
+
186
+ - If you're in a process buffer (foo, bar, or *inf-clojure*),
187
+ you send it to that process.
188
+ - If you're in some other buffer (e.g., a source file), you
189
+ send it to the process attached to buffer `inf-clojure-buffer' .
190
+ This process selection is performed by function `inf-clojure-proc' .
191
+
192
+ Whenever \\ [inf-clojure] fires up a new process, it resets
193
+ `inf-clojure-buffer' to be the new process's buffer. If you only run
194
+ one process, this does the right thing. If you run multiple
195
+ processes, you might need to change `inf-clojure-buffer' to
196
+ whichever process buffer you want to use." )
197
+
157
198
(defun inf-clojure--get-feature (repl-type feature no-error )
158
199
" Get FEATURE for REPL-TYPE from repl-features.
159
200
If no-error is truthy don't error if feature is not present."
@@ -232,11 +273,6 @@ buffers after they are created with `rename-buffer'."
232
273
(setq inf-clojure-buffer (get-buffer repl-buffer)))
233
274
(user-error " No buffers have an inf-clojure process" )))))
234
275
235
- (defvar-local inf-clojure-repl-type nil
236
- " Symbol to define your REPL type.
237
- Its root binding is nil and it can be further customized using
238
- either `setq-local` or an entry in `.dir-locals.el`." )
239
-
240
276
(defvar inf-clojure--repl-type-lock nil
241
277
" Global lock for protecting against proc filter race conditions.
242
278
See http://blog.jorgenschaefer.de/2014/05/race-conditions-in-emacs-process-filter.html" )
@@ -544,42 +580,6 @@ See command `inf-clojure-minor-mode'."
544
580
(with-current-buffer buffer
545
581
(inf-clojure-minor-mode -1 ))))
546
582
547
- (defvar inf-clojure-buffer nil
548
- " The current `inf-clojure' process buffer.
549
-
550
- MULTIPLE PROCESS SUPPORT
551
- ===========================================================================
552
- To run multiple Clojure processes, you start the first up
553
- with \\ [inf-clojure]. It will be in a buffer named `*inf-clojure*' .
554
- Rename this buffer with \\ [rename-buffer]. You may now start up a new
555
- process with another \\ [inf-clojure]. It will be in a new buffer,
556
- named `*inf-clojure*' . You can switch between the different process
557
- buffers with \\ [switch-to-buffer].
558
-
559
- Commands that send text from source buffers to Clojure processes --
560
- like `inf-clojure-eval-defun' or `inf-clojure-show-arglists' -- have to choose a
561
- process to send to, when you have more than one Clojure process around. This
562
- is determined by the global variable `inf-clojure-buffer' . Suppose you
563
- have three inferior Clojures running:
564
- Buffer Process
565
- foo inf-clojure
566
- bar inf-clojure<2>
567
- *inf-clojure* inf-clojure<3>
568
- If you do a \\ [inf-clojure-eval-defun] command on some Clojure source code,
569
- what process do you send it to?
570
-
571
- - If you're in a process buffer (foo, bar, or *inf-clojure*),
572
- you send it to that process.
573
- - If you're in some other buffer (e.g., a source file), you
574
- send it to the process attached to buffer `inf-clojure-buffer' .
575
- This process selection is performed by function `inf-clojure-proc' .
576
-
577
- Whenever \\ [inf-clojure] fires up a new process, it resets
578
- `inf-clojure-buffer' to be the new process's buffer. If you only run
579
- one process, this does the right thing. If you run multiple
580
- processes, you might need to change `inf-clojure-buffer' to
581
- whichever process buffer you want to use." )
582
-
583
583
(define-derived-mode inf-clojure-mode comint-mode " Inferior Clojure"
584
584
" Major mode for interacting with an inferior Clojure process.
585
585
Runs a Clojure interpreter as a subprocess of Emacs, with Clojure
@@ -1253,19 +1253,6 @@ every other EXPR will be discarded and nil will be returned."
1253
1253
(inf-clojure--read-or-nil)
1254
1254
(inf-clojure--list-or-nil)))
1255
1255
1256
- (defun inf-clojure-completions (expr )
1257
- " Return completions for the Clojure expression starting with EXPR.
1258
-
1259
- Under the hood it calls the function
1260
- \\ [inf-clojure-completions-fn] passing in the result of
1261
- evaluating \\ [inf-clojure-completion-form] at the REPL."
1262
- (let* ((proc (inf-clojure-proc 'no-error ))
1263
- (completion-form (inf-clojure-get-feature proc 'completion t )))
1264
- (when (and proc completion-form (not (string-blank-p expr)))
1265
- (let ((completion-expr (format completion-form (substring-no-properties expr))))
1266
- (funcall inf-clojure-completions-fn
1267
- (inf-clojure--process-response completion-expr proc " (" " )" ))))))
1268
-
1269
1256
(defcustom inf-clojure-completions-fn 'inf-clojure-list-completions
1270
1257
" The function that parses completion results.
1271
1258
@@ -1290,6 +1277,19 @@ you might want to use in your customization."
1290
1277
:type 'function
1291
1278
:package-version '(inf-clojure . " 2.1.0" ))
1292
1279
1280
+ (defun inf-clojure-completions (expr )
1281
+ " Return completions for the Clojure expression starting with EXPR.
1282
+
1283
+ Under the hood it calls the function
1284
+ \\ [inf-clojure-completions-fn] passing in the result of
1285
+ evaluating \\ [inf-clojure-completion-form] at the REPL."
1286
+ (let* ((proc (inf-clojure-proc 'no-error ))
1287
+ (completion-form (inf-clojure-get-feature proc 'completion t )))
1288
+ (when (and proc completion-form (not (string-blank-p expr)))
1289
+ (let ((completion-expr (format completion-form (substring-no-properties expr))))
1290
+ (funcall inf-clojure-completions-fn
1291
+ (inf-clojure--process-response completion-expr proc " (" " )" ))))))
1292
+
1293
1293
(defconst inf-clojure-clojure-expr-break-chars " ^[] \" '`><,;|&{()[@\\ ^]"
1294
1294
" Regexp are hard.
1295
1295
0 commit comments