File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -195,17 +195,23 @@ often connecting to a remote REPL process."
195
195
Its root binding is nil and it can be further customized using
196
196
either `setq-local` or an entry in `.dir-locals.el`." )
197
197
198
- (defun inf-clojure--detect-type (proc )
198
+ (defvar inf-clojure--repl-type-lock nil
199
+ " Global lock for protecting against proc filter race conditions.
200
+ See http://blog.jorgenschaefer.de/2014/05/race-conditions-in-emacs-process-filter.html" )
201
+
202
+ (defun inf-clojure--detect-repl-type (proc )
199
203
" Identifies the current REPL type for PROC."
200
- (cond
201
- ((inf-clojure--lumo-p proc) 'lumo )
202
- (t 'clojure )))
204
+ (when (not inf-clojure--repl-type-lock)
205
+ (let ((inf-clojure--repl-type-lock t ))
206
+ (cond
207
+ ((inf-clojure--lumo-p proc) 'lumo )
208
+ (t 'clojure )))))
203
209
204
210
(defun inf-clojure--set-repl-type (proc )
205
211
" Set the REPL type if has not already been set.
206
212
It requires a REPL PROC for inspecting the correct type."
207
213
(if (not inf-clojure-repl-type)
208
- (setq inf-clojure-repl-type (inf-clojure--detect-type proc))
214
+ (setq inf-clojure-repl-type (inf-clojure--detect-repl- type proc))
209
215
inf-clojure-repl-type))
210
216
211
217
(defun inf-clojure--send-string (proc string )
You can’t perform that action at this time.
0 commit comments