Skip to content

Commit 1b97fe3

Browse files
authored
Inspector: retain truncate-lines values across screens (#3579)
1 parent a35170b commit 1b97fe3

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Changes
66

77
- [#3576](https://github.com/clojure-emacs/cider/issues/3576): CIDER [Inspector](https://docs.cider.mx/cider/debugging/inspector.html): display Java class/method/field block tags (Returns/Throws/Params info) when available.
8+
- CIDER [Inspector](https://docs.cider.mx/cider/debugging/inspector.html): retain [`truncate-lines`](https://www.gnu.org/software/emacs/manual/html_node/emacs/Line-Truncation.html) values across screens.
89

910
## 1.11.1 (2023-11-11)
1011

cider-inspector.el

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,19 @@ instead of just its \"value\" entry."
536536
;; The font size is lost between inspector 'screens',
537537
;; because on each re-rendering, we wipe everything, including the mode.
538538
;; Enabling cider-inspector-mode is the specific step that loses the font size.
539-
(buffer-local-value variable b))))
539+
(buffer-local-value variable b)))
540+
(truncate-lines-defined (when-let* ((b (get-buffer cider-inspector-buffer)))
541+
(local-variable-p 'truncate-lines b)))
542+
(truncate-lines-p (when-let* ((b (get-buffer cider-inspector-buffer))
543+
(continue truncate-lines-defined))
544+
(buffer-local-value 'truncate-lines b))))
540545
(cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary)
541-
(cider-inspector-render cider-inspector-buffer value font-size fragments block-tags))
546+
(cider-inspector-render cider-inspector-buffer value
547+
:font-size font-size
548+
:truncate-lines-defined truncate-lines-defined
549+
:truncate-lines-p truncate-lines-p
550+
:fragments fragments
551+
:block-tags block-tags))
542552
(cider-popup-buffer-display cider-inspector-buffer cider-inspector-auto-select-buffer)
543553
(when cider-inspector-fill-frame (delete-other-windows))
544554
(ignore-errors (cider-inspector-next-inspectable-object 1))
@@ -557,12 +567,14 @@ instead of just its \"value\" entry."
557567
(when cider-inspector-page-location-stack
558568
(goto-char (pop cider-inspector-page-location-stack))))))
559569

560-
(defun cider-inspector-render (buffer str &optional font-size fragments block-tags)
570+
(cl-defun cider-inspector-render (buffer str &key font-size truncate-lines-defined truncate-lines-p fragments block-tags)
561571
"Render STR in BUFFER."
562572
(with-current-buffer buffer
563573
(cider-inspector-mode)
564574
(when font-size
565575
(text-scale-set font-size))
576+
(when truncate-lines-defined
577+
(setq-local truncate-lines truncate-lines-p))
566578
(let ((inhibit-read-only t))
567579
(condition-case nil
568580
(cider-inspector-render* (car (read-from-string str))
@@ -574,7 +586,7 @@ instead of just its \"value\" entry."
574586
(defvar cider-inspector-looking-at-java-p nil)
575587

576588
(defun cider-inspector-render* (elements &optional fragments block-tags)
577-
"Render ELEMENTS, and FRAGMENTS if present."
589+
"Render ELEMENTS, and FRAGMENTS, BLOCK-TAGS if present."
578590
(setq cider-inspector-looking-at-java-p nil)
579591
(dolist (el elements)
580592
(cider-inspector-render-el* el))

0 commit comments

Comments
 (0)