summaryrefslogtreecommitdiff
path: root/cider-repl.el
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@tradeo.com>2014-08-13 15:32:38 +0300
committerBozhidar Batsov <bozhidar@tradeo.com>2014-08-13 15:32:38 +0300
commit0d1153c3fa1921c21282d69b2196121d226f2dcc (patch)
tree3f0752c35c733d870726389d79bfc214b4f6bfdb /cider-repl.el
parentb110e522e32776b9728a9bb1465f6a3aa3291def (diff)
Remove some code duplication
Diffstat (limited to 'cider-repl.el')
-rw-r--r--cider-repl.el19
1 files changed, 10 insertions, 9 deletions
diff --git a/cider-repl.el b/cider-repl.el
index f5edad0d..05a273d4 100644
--- a/cider-repl.el
+++ b/cider-repl.el
@@ -426,22 +426,23 @@ If BOL is non-nil insert at the beginning of line."
"Emit STRING as interactive err output."
(cider-repl--emit-interactive-output string 'cider-repl-err-output-face))
-(defun cider-repl-emit-output (buffer string &optional bol)
- "Using BUFFER, emit STRING.
+(defun cider-repl--emit-output (buffer string face &optional bol)
+ "Using BUFFER, emit STRING font-locked with FACE.
If BOL is non-nil, emit at the beginning of the line."
(with-current-buffer buffer
(let ((pos (1- (cider-repl--input-line-beginning-position))))
- (cider-repl-emit-output-at-pos buffer string 'cider-repl-output-face cider-repl-input-start-mark bol)
+ (cider-repl-emit-output-at-pos buffer string face cider-repl-input-start-mark bol)
(ansi-color-apply-on-region pos (point-max)))))
-;; TODO: Factor out repeated code
+(defun cider-repl-emit-output (buffer string &optional bol)
+ "Using BUFFER, emit STRING as standard output.
+If BOL is non-nil, emit at the beginning of the line."
+ (cider-repl--emit-output buffer string 'cider-repl-output-face))
+
(defun cider-repl-emit-err-output (buffer string &optional bol)
- "Using BUFFER, emit STRING.
+ "Using BUFFER, emit STRING as error output.
If BOL is non-nil, emit at the beginning of the line."
- (with-current-buffer buffer
- (let ((pos (1- (cider-repl--input-line-beginning-position))))
- (cider-repl-emit-output-at-pos buffer string 'cider-repl-err-output-face cider-repl-input-start-mark bol)
- (ansi-color-apply-on-region pos (point-max)))))
+ (cider-repl--emit-output buffer string 'cider-repl-err-output-face))
(defun cider-repl-emit-prompt (buffer)
"Emit the REPL prompt into BUFFER."