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."
195195Its root binding is nil and it can be further customized using
196196either `setq-local` or an entry in `.dir-locals.el`." )
197197
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 )
199203 " 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 )))))
203209
204210(defun inf-clojure--set-repl-type (proc )
205211 " Set the REPL type if has not already been set.
206212It requires a REPL PROC for inspecting the correct type."
207213 (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))
209215 inf-clojure-repl-type))
210216
211217(defun inf-clojure--send-string (proc string )
You can’t perform that action at this time.
0 commit comments