Skip to content

Commit e4ab03e

Browse files
vspinubbatsov
authored andcommitted
Explicitly list unfolding parameters in nrepl--pp
1 parent f28ebb7 commit e4ab03e

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ within the scope of your current Emacs session.
2626
* Add option to define exclusions for injected dependecies. Fixes [#1824](https://github.com/clojure-emacs/cider/issues/1824): Can no longer jack-in to an inherited clojure version.
2727
* [#1820](https://github.com/clojure-emacs/cider/issues/1820): Don't try to display eldoc in EDN buffers.
2828
* [#1823](https://github.com/clojure-emacs/cider/issues/1823): Fix column location metadata set by interactive evaluation.
29-
* [#1859](https://github.com/clojure-emacs/cider/issues/1859): Remove the overhead of nREPL message log.
29+
* [#1859](https://github.com/clojure-emacs/cider/issues/1859): Make nREPL message log much faster. `nrepl-dict-max-message-size` custom variable was removed.
3030

3131
## 0.13.0 (2016-07-25)
3232

nrepl-client.el

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,11 +1128,6 @@ If ID is nil, return nil."
11281128
(mod (length nrepl-message-colors))
11291129
(nth nrepl-message-colors))))
11301130

1131-
(defcustom nrepl-dict-max-message-size 5
1132-
"Max number of lines a dict can have before being truncated.
1133-
Set this to nil to prevent truncation."
1134-
:type 'integer)
1135-
11361131
(defun nrepl--expand-button (button)
11371132
"Expand the text hidden under overlay BUTTON."
11381133
(let* ((start (overlay-start button))
@@ -1196,26 +1191,32 @@ FOREGROUND and BUTTON are as in `nrepl--pp'."
11961191
"Pretty print nREPL OBJECT, delimited using FOREGROUND.
11971192
If BUTTON is non-nil, try making a button from OBJECT instead of inserting
11981193
it into the buffer."
1199-
(if-let ((head (car-safe object)))
1200-
;; listlike objects
1201-
(cond
1202-
((memq head '(<-- -->))
1203-
(nrepl--pp-listlike object foreground button))
1204-
((eq head 'dict)
1205-
(if (and button (> (length object) 1))
1206-
(nrepl--insert-button "(dict ...)" object)
1207-
(nrepl--pp-listlike object foreground button)))
1208-
(t
1209-
(if (and button (> (length object) 10))
1210-
(nrepl--insert-button (format "(%s ...)" (prin1-to-string head)) object)
1211-
(pp object (current-buffer)))))
1212-
;; non-list objects
1213-
(if (stringp object)
1214-
(if (and button (> (length object) 80))
1215-
(nrepl--insert-button (format "\"%s...\"" (substring object 0 40)) object)
1216-
(insert (prin1-to-string object) "\n"))
1217-
(pp object (current-buffer))
1218-
(insert "\n"))))
1194+
(let ((min-dict-fold-size 1)
1195+
(min-list-fold-size 10)
1196+
(min-string-fold-size 60))
1197+
(if-let ((head (car-safe object)))
1198+
;; list-like objects
1199+
(cond
1200+
;; top level dicts (always unfolded)
1201+
((memq head '(<-- -->))
1202+
(nrepl--pp-listlike object foreground button))
1203+
;; inner dicts
1204+
((eq head 'dict)
1205+
(if (and button (> (length object) min-dict-fold-size))
1206+
(nrepl--insert-button "(dict ...)" object)
1207+
(nrepl--pp-listlike object foreground button)))
1208+
;; lists
1209+
(t
1210+
(if (and button (> (length object) min-list-fold-size))
1211+
(nrepl--insert-button (format "(%s ...)" (prin1-to-string head)) object)
1212+
(pp object (current-buffer)))))
1213+
;; non-list objects
1214+
(if (stringp object)
1215+
(if (and button (> (length object) min-string-fold-size))
1216+
(nrepl--insert-button (format "\"%s...\"" (substring object 0 min-string-fold-size)) object)
1217+
(insert (prin1-to-string object) "\n"))
1218+
(pp object (current-buffer))
1219+
(insert "\n")))))
12191220

12201221
(defun nrepl-messages-buffer-name (conn)
12211222
"Return the name for the message buffer matching CONN."

0 commit comments

Comments
 (0)