summaryrefslogtreecommitdiff
path: root/cider-popup.el
diff options
context:
space:
mode:
authorak-coram <ak@coram.pub>2017-07-10 04:34:09 +0200
committerBozhidar Batsov <bozhidar.batsov@gmail.com>2017-07-10 05:34:09 +0300
commitd445ffcd3627980bbb44842aedc1bff4933dfa7b (patch)
treeb7cd1477dc1d737f09badac376fcdb220fa00e6e /cider-popup.el
parent2dafa650194708d07a77dd56ce3691826704abd4 (diff)
[Fix #2023] Make popup-buffer sexp indentation optional (#2038)
- Add optional inhibit-indent argument to cider-emit-into-popup-buffer. - Inhibit indentation where output is already indented (pprint) or not sexps.
Diffstat (limited to 'cider-popup.el')
-rw-r--r--cider-popup.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/cider-popup.el b/cider-popup.el
index c0069bd1..f4ebba78 100644
--- a/cider-popup.el
+++ b/cider-popup.el
@@ -103,8 +103,9 @@ and automatically removed when killed."
nil 'local))
(current-buffer)))
-(defun cider-emit-into-popup-buffer (buffer value &optional face)
- "Emit into BUFFER the provided VALUE optionally using FACE."
+(defun cider-emit-into-popup-buffer (buffer value &optional face inhibit-indent)
+ "Emit into BUFFER the provided VALUE optionally using FACE.
+Indents emitted sexp value unless INHIBIT-INDENT is specified and non-nil."
;; Long string output renders Emacs unresponsive and users might intentionally
;; kill the frozen popup buffer. Therefore, we don't re-create the buffer and
;; silently ignore the output.
@@ -121,7 +122,8 @@ and automatically removed when killed."
(add-face-text-property 0 (length value-str) face nil value-str)
(add-text-properties 0 (length value-str) (list 'face face) value-str)))
(insert value-str))
- (indent-sexp)
+ (unless inhibit-indent
+ (indent-sexp))
(set-marker cider-popup-output-marker (point)))
(when moving (goto-char cider-popup-output-marker))))))