From 829fbe6f1a53129a8431a60d311eabe50ffb3432 Mon Sep 17 00:00:00 2001 From: Andrea Richiardi Date: Fri, 29 Dec 2017 19:23:20 -0800 Subject: [PATCH] [Fix #116] Set inf-clojure-buffer REPL type on detect Now the code sets the inf-clojure-repl-type buffer local var in the inf-clojure-buffer when a REPL type is detected. This solves the weird errors that were happening when working within the REPL buffer because inf-clojure-repl-type is nil. --- CHANGELOG.md | 1 + inf-clojure.el | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eca521..da62ab5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * [#83](https://github.com/clojure-emacs/inf-clojure/pull/85): No such namespace: complete.core in lumo REPL. * [#93](https://github.com/clojure-emacs/inf-clojure/pull/93): Slow response from inf-clojure (completions, arglists, ...). * [#101](https://github.com/clojure-emacs/inf-clojure/pull/101): `inf-clojure-set-ns` hangs Emacs. +* [#119](https://github.com/clojure-emacs/inf-clojure/pull/119): Set inf-clojure-buffer REPL type on detect. * [#120](https://github.com/clojure-emacs/inf-clojure/pull/120): Send REPL string always, even if empty. ### New Features diff --git a/inf-clojure.el b/inf-clojure.el index ed6058e..c16f913 100644 --- a/inf-clojure.el +++ b/inf-clojure.el @@ -292,9 +292,10 @@ See http://blog.jorgenschaefer.de/2014/05/race-conditions-in-emacs-process-filte (defun inf-clojure--set-repl-type (proc) "Set the REPL type if has not already been set. It requires a REPL PROC for inspecting the correct type." - (if (not inf-clojure-repl-type) - (setq inf-clojure-repl-type (inf-clojure--detect-repl-type proc)) - inf-clojure-repl-type)) + (with-current-buffer inf-clojure-buffer + (if (not inf-clojure-repl-type) + (setq inf-clojure-repl-type (inf-clojure--detect-repl-type proc)) + inf-clojure-repl-type))) (defun inf-clojure--single-linify (string) "Convert a multi-line STRING in a single-line STRING.