branch: elpa/inf-clojure commit 2046b12083ad7059ed8410e7623baa8b74c09c21 Author: Bozhidar Batsov <bozhi...@batsov.com> Commit: Bozhidar Batsov <bozhi...@batsov.com>
Make inf-clojure-repl-p a bit more flexible --- inf-clojure.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inf-clojure.el b/inf-clojure.el index 92812b7..58dda37 100644 --- a/inf-clojure.el +++ b/inf-clojure.el @@ -199,12 +199,14 @@ has been found. See also variable `inf-clojure-buffer'." (unless no-error (error "No Clojure subprocess; see variable `inf-clojure-buffer'")))) -(defun inf-clojure-repl-p () - "Indicates if the current buffer is an inf-clojure REPL. +(defun inf-clojure-repl-p (&optional buf) + "Indicates if BUF is an inf-clojure REPL. +If BUF is nil then defaults to the current buffer. Checks the mode and that there is a live process." - (and (derived-mode-p 'inf-clojure-mode) - (get-buffer-process (current-buffer)) - (process-live-p (get-buffer-process (current-buffer))))) + (let ((buf (or buf (current-buffer)))) + (and (with-current-buffer buf (derived-mode-p 'inf-clojure-mode)) + (get-buffer-process buf) + (process-live-p (get-buffer-process buf))))) (defun inf-clojure-repls () "Return a list of all inf-clojure REPL buffers."