Skip to content

Commit 2046b12

Browse files
committed
Make inf-clojure-repl-p a bit more flexible
1 parent e1d7007 commit 2046b12

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

inf-clojure.el

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,14 @@ has been found. See also variable `inf-clojure-buffer'."
199199
(unless no-error
200200
(error "No Clojure subprocess; see variable `inf-clojure-buffer'"))))
201201

202-
(defun inf-clojure-repl-p ()
203-
"Indicates if the current buffer is an inf-clojure REPL.
202+
(defun inf-clojure-repl-p (&optional buf)
203+
"Indicates if BUF is an inf-clojure REPL.
204+
If BUF is nil then defaults to the current buffer.
204205
Checks the mode and that there is a live process."
205-
(and (derived-mode-p 'inf-clojure-mode)
206-
(get-buffer-process (current-buffer))
207-
(process-live-p (get-buffer-process (current-buffer)))))
206+
(let ((buf (or buf (current-buffer))))
207+
(and (with-current-buffer buf (derived-mode-p 'inf-clojure-mode))
208+
(get-buffer-process buf)
209+
(process-live-p (get-buffer-process buf)))))
208210

209211
(defun inf-clojure-repls ()
210212
"Return a list of all inf-clojure REPL buffers."

0 commit comments

Comments
 (0)