Skip to content

Commit

Permalink
Query text-scale-mode-amount safely
Browse files Browse the repository at this point in the history
  • Loading branch information
vemv committed Oct 21, 2023
1 parent f85d5c1 commit 4c99c02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Bugs fixed

- Inspector: avoid `Symbol's value as variable is void: text-scale-mode-amount` under certain Emacs clients.

## 1.8.3 (2023-10-18)

### Changes
Expand Down
6 changes: 4 additions & 2 deletions cider-inspector.el
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,13 @@ MAX-COLL-SIZE if non nil."
;; Render Inspector from Structured Values
(defun cider-inspector--render-value (value)
"Render VALUE."
(let ((font-size (when-let ((b (get-buffer cider-inspector-buffer)))
(let ((font-size (when-let* ((b (get-buffer cider-inspector-buffer))
(variable 'text-scale-mode-amount)
(continue (local-variable-p variable b)))
;; 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))))
(buffer-local-value variable 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)
Expand Down

0 comments on commit 4c99c02

Please sign in to comment.