summaryrefslogtreecommitdiff
path: root/cider-mode.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.com>2015-11-05 22:16:44 +0200
committerBozhidar Batsov <bozhidar@batsov.com>2015-11-05 22:16:44 +0200
commit27705327ae0575679c93475d794e5e45a2be3843 (patch)
tree34d911af3980f5e124037ca372b71cb8712cf454 /cider-mode.el
parent20d4b80615ce8c2609c037b7d23a9157213da2ad (diff)
[#1337] Unify the REPL clearing behavior in cider-mode and cider-repl-mode
Diffstat (limited to 'cider-mode.el')
-rw-r--r--cider-mode.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/cider-mode.el b/cider-mode.el
index 2b2c6097..e5200dde 100644
--- a/cider-mode.el
+++ b/cider-mode.el
@@ -186,13 +186,16 @@ Clojure buffer and the REPL buffer."
(pop-to-buffer cider-last-clojure-buffer))
(message "Don't know the original Clojure buffer")))
-(defun cider-find-and-clear-repl-buffer ()
+(defun cider-find-and-clear-repl-output (&optional clear-repl)
"Find the current REPL buffer and clear it.
+With a prefix argument CLEAR-REPL the command clears the entire REPL buffer.
Returns to the buffer in which the command was invoked."
- (interactive)
+ (interactive "P")
(let ((origin-buffer (current-buffer)))
(switch-to-buffer (cider-current-repl-buffer))
- (cider-repl-clear-buffer)
+ (if clear-repl
+ (cider-repl-clear-buffer)
+ (cider-repl-clear-output))
(switch-to-buffer origin-buffer)))
@@ -226,7 +229,7 @@ Returns to the buffer in which the command was invoked."
(define-key map (kbd "C-c M-t n") #'cider-toggle-trace-ns)
(define-key map (kbd "C-c C-z") #'cider-switch-to-repl-buffer)
(define-key map (kbd "C-c M-z") #'cider-load-buffer-and-switch-to-repl-buffer)
- (define-key map (kbd "C-c M-o") #'cider-find-and-clear-repl-buffer)
+ (define-key map (kbd "C-c C-o") #'cider-find-and-clear-repl-output)
(define-key map (kbd "C-c C-k") #'cider-load-buffer)
(define-key map (kbd "C-c C-l") #'cider-load-file)
(define-key map (kbd "C-c C-b") #'cider-interrupt)
@@ -285,7 +288,7 @@ Returns to the buffer in which the command was invoked."
["Switch to REPL" cider-switch-to-repl-buffer]
["Switch to Relevant REPL" cider-switch-to-relevant-repl-buffer]
["Toggle REPL Pretty Print" cider-repl-toggle-pretty-printing]
- ["Clear REPL" cider-find-and-clear-repl-buffer]
+ ["Clear REPL output" cider-find-and-clear-repl-output]
"--"
("nREPL"
["Describe session" cider-describe-nrepl-session]