Skip to content

Commit 7143a5c

Browse files
committed
Merge pull request #1135 from Malabarba/fix-locals
Fix corner case with locals display
2 parents 9b19e21 + fa8aadc commit 7143a5c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ Keyboard shortcut | Description
885885
<kbd>o</kbd> | Move out of the current sexp (like `up-list`)
886886
<kbd>i</kbd> | Inject a value into running code
887887
<kbd>e</kbd> | Eval code in current context
888+
<kbd>l</kbd> | List local variables
888889
<kbd>q</kbd> | Quit execution
889890

890891
### Managing multiple sessions

cider-debug.el

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,16 @@ Can be toggled while debugging with `l'.")
114114
(defun cider--debug-format-locals-list (locals)
115115
"Return a string description of list LOCALS.
116116
Each element of LOCALS should be a list of at least two elements."
117-
(let ((left-col-width
118-
;; To right-indent the variable names.
119-
(apply #'max (mapcar (lambda (l) (string-width (car l))) locals))))
120-
;; A format string to build a format string. :-P
121-
(mapconcat (lambda (l) (format (format "%%%ds: %%s\n" left-col-width)
122-
(propertize (car l) 'face 'font-lock-variable-name-face)
123-
(cider-font-lock-as-clojure (cadr l))))
124-
locals "")))
117+
(if locals
118+
(let ((left-col-width
119+
;; To right-indent the variable names.
120+
(apply #'max (mapcar (lambda (l) (string-width (car l))) locals))))
121+
;; A format string to build a format string. :-P
122+
(mapconcat (lambda (l) (format (format "%%%ds: %%s\n" left-col-width)
123+
(propertize (car l) 'face 'font-lock-variable-name-face)
124+
(cider-font-lock-as-clojure (cadr l))))
125+
locals ""))
126+
""))
125127

126128
(defun cider--debug-read-command (command-list value prompt locals)
127129
"Receive input from the user representing a command to do.

0 commit comments

Comments
 (0)