From d42bbf653638e8092166e37c14434ca12ec95270 Mon Sep 17 00:00:00 2001 From: vemv Date: Mon, 16 Oct 2023 21:43:30 +0200 Subject: [PATCH 1/2] Preserve the font size as one navigates through the CIDER inspector Fixes #3527 --- CHANGELOG.md | 1 + cider-inspector.el | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80b0a37e8..9d9692c9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Example string that is now trimmed away: `(java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IObj is in unnamed module of loader 'app')` - [#3522](https://github.com/clojure-emacs/cider/issues/3522): Introduce a new possible value for [`cider-use-overlays`](https://docs.cider.mx/cider/usage/code_evaluation.html#overlays): `errors-only`. - If specified, only errors will result in an overlay being shown. +- [#3527](https://github.com/clojure-emacs/cider/issues/3527): Preserve the font size as one navigates through the CIDER inspector. ## 1.8.2 (2023-10-15) diff --git a/cider-inspector.el b/cider-inspector.el index 744e0d954..120f3859e 100644 --- a/cider-inspector.el +++ b/cider-inspector.el @@ -388,8 +388,10 @@ MAX-COLL-SIZE if non nil." ;; Render Inspector from Structured Values (defun cider-inspector--render-value (value) "Render VALUE." - (cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary) - (cider-inspector-render cider-inspector-buffer value) + (let ((font-size (when-let ((b (get-buffer cider-inspector-buffer))) + (buffer-local-value 'text-scale-mode-amount b)))) + (cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary) + (cider-inspector-render cider-inspector-buffer value font-size)) (cider-popup-buffer-display cider-inspector-buffer cider-inspector-auto-select-buffer) (when cider-inspector-fill-frame (delete-other-windows)) (ignore-errors (cider-inspector-next-inspectable-object 1)) @@ -408,10 +410,12 @@ MAX-COLL-SIZE if non nil." (when cider-inspector-page-location-stack (goto-char (pop cider-inspector-page-location-stack)))))) -(defun cider-inspector-render (buffer str) +(defun cider-inspector-render (buffer str &optional font-size) "Render STR in BUFFER." (with-current-buffer buffer (cider-inspector-mode) + (when font-size + (text-scale-set font-size)) (let ((inhibit-read-only t)) (condition-case nil (cider-inspector-render* (car (read-from-string str))) From 4084705377037ae8ccd7ac6d92daf8914107e396 Mon Sep 17 00:00:00 2001 From: vemv Date: Tue, 17 Oct 2023 12:13:33 +0200 Subject: [PATCH 2/2] Add comment --- cider-inspector.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cider-inspector.el b/cider-inspector.el index 120f3859e..c8cf1bdab 100644 --- a/cider-inspector.el +++ b/cider-inspector.el @@ -389,6 +389,9 @@ MAX-COLL-SIZE if non nil." (defun cider-inspector--render-value (value) "Render VALUE." (let ((font-size (when-let ((b (get-buffer cider-inspector-buffer))) + ;; The font size is lost between inspector 'screens', + ;; because on each re-rendering, we wipe everything, including the mode. + ;; Enabling cider-inspector-mode is the specific step that loses the font size. (buffer-local-value 'text-scale-mode-amount b)))) (cider-make-popup-buffer cider-inspector-buffer 'cider-inspector-mode 'ancillary) (cider-inspector-render cider-inspector-buffer value font-size))