From fa8aadcd66e8ce020b383b14a089a41424db326f Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Tue, 16 Jun 2015 15:54:56 +0100 Subject: [PATCH] Fix corner case with locals display --- README.md | 1 + cider-debug.el | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 902792c87..a32bcf7ed 100644 --- a/README.md +++ b/README.md @@ -885,6 +885,7 @@ Keyboard shortcut | Description o | Move out of the current sexp (like `up-list`) i | Inject a value into running code e | Eval code in current context +l | List local variables q | Quit execution ### Managing multiple sessions diff --git a/cider-debug.el b/cider-debug.el index 8bc651eb1..6ef2af209 100644 --- a/cider-debug.el +++ b/cider-debug.el @@ -114,14 +114,16 @@ Can be toggled while debugging with `l'.") (defun cider--debug-format-locals-list (locals) "Return a string description of list LOCALS. Each element of LOCALS should be a list of at least two elements." - (let ((left-col-width - ;; To right-indent the variable names. - (apply #'max (mapcar (lambda (l) (string-width (car l))) locals)))) - ;; A format string to build a format string. :-P - (mapconcat (lambda (l) (format (format "%%%ds: %%s\n" left-col-width) - (propertize (car l) 'face 'font-lock-variable-name-face) - (cider-font-lock-as-clojure (cadr l)))) - locals ""))) + (if locals + (let ((left-col-width + ;; To right-indent the variable names. + (apply #'max (mapcar (lambda (l) (string-width (car l))) locals)))) + ;; A format string to build a format string. :-P + (mapconcat (lambda (l) (format (format "%%%ds: %%s\n" left-col-width) + (propertize (car l) 'face 'font-lock-variable-name-face) + (cider-font-lock-as-clojure (cadr l)))) + locals "")) + "")) (defun cider--debug-read-command (command-list value prompt locals) "Receive input from the user representing a command to do.