@@ -90,6 +90,7 @@ mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
90
90
[" Show source for var" inf-clojure-show-var-source t]
91
91
" --"
92
92
[" Clear REPL" inf-clojure-clear-repl-buffer]
93
+ [" Restart" inf-clojure-restart]
93
94
[" Quit" inf-clojure-quit]
94
95
" --"
95
96
[" Version" inf-clojure-display-version]))
@@ -134,6 +135,7 @@ mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
134
135
[" Apropos" inf-clojure-apropos t]
135
136
[" Macroexpand" inf-clojure-macroexpand t]
136
137
" --"
138
+ [" Restart REPL" inf-clojure-restart]
137
139
[" Quit REPL" inf-clojure-quit]))
138
140
map))
139
141
@@ -828,13 +830,30 @@ Useful for commands that can invoked outside of an inf-clojure buffer
828
830
((= (length repl-buffers) 1 ) (car repl-buffers))
829
831
(t (get-buffer (completing-read " Select target inf-clojure buffer: " (mapcar #'buffer-name repl-buffers))))))))
830
832
831
- (defun inf-clojure-quit ()
832
- " Kill the REPL buffer and its underlying process."
833
+ (defun inf-clojure-quit (&optional buffer )
834
+ " Kill the REPL buffer and its underlying process.
835
+
836
+ You can pass the target BUFFER as an optional parameter
837
+ to suppress the usage of the target buffer discovery logic."
833
838
(interactive )
834
- (let ((target-buffer (inf-clojure-select-target-repl)))
835
- (delete-process target-buffer)
839
+ (let ((target-buffer (or buffer (inf-clojure-select-target-repl))))
840
+ (when (get-buffer-process target-buffer)
841
+ (delete-process target-buffer))
836
842
(kill-buffer target-buffer)))
837
843
844
+ (defun inf-clojure-restart (&optional buffer )
845
+ " Restart the REPL buffer and its underlying process.
846
+
847
+ You can pass the target BUFFER as an optional parameter
848
+ to suppress the usage of the target buffer discovery logic."
849
+ (interactive )
850
+ (let* ((target-buffer (or buffer (inf-clojure-select-target-repl)))
851
+ (target-buffer-name (buffer-name target-buffer)))
852
+ ; ; TODO: Try to recycle the old buffer instead of killing and recreating it
853
+ (inf-clojure-quit target-buffer)
854
+ (inf-clojure inf-clojure-program)
855
+ (rename-buffer target-buffer-name)))
856
+
838
857
(provide 'inf-clojure )
839
858
840
859
; ;; inf-clojure.el ends here
0 commit comments