@@ -185,8 +185,8 @@ This variable must be set before starting the repl connection."
185
185
186
186
187
187
; ;; Minor mode
188
- (defvar-local cider--debug-mode-commands-alist nil
189
- " Alist from keys to debug commands.
188
+ (defvar-local cider--debug-mode-commands-dict nil
189
+ " An nrepl-dict from keys to debug commands.
190
190
Autogenerated by `cider--turn-on-debug-mode' ." )
191
191
192
192
(defvar-local cider--debug-mode-response nil
@@ -214,16 +214,18 @@ Each element of LOCALS should be a list of at least two elements."
214
214
locals " " ))
215
215
" " ))
216
216
217
- (defun cider--debug-prompt (command-list )
218
- " Return prompt to display for COMMAND-LIST ."
217
+ (defun cider--debug-prompt (command-dict )
218
+ " Return prompt to display for COMMAND-DICT ."
219
219
; ; Force `default' face, otherwise the overlay "inherits" the face of the text
220
220
; ; after it.
221
- (format (propertize " %s" 'face 'default )
222
- (concat
223
- (mapconcat (lambda (x ) (put-text-property 0 1 'face 'cider-debug-prompt-face x) x)
224
- command-list
225
- " " )
226
- " \n " )))
221
+ (format (propertize " %s\n " 'face 'default )
222
+ (cider-string-join
223
+ (nrepl-dict-map (lambda (char cmd )
224
+ (when-let ((pos (cl-search char cmd)))
225
+ (put-text-property pos (1+ pos) 'face 'cider-debug-prompt-face cmd))
226
+ cmd)
227
+ command-dict)
228
+ " " )))
227
229
228
230
(defvar-local cider--debug-prompt-overlay nil )
229
231
@@ -299,10 +301,6 @@ In order to work properly, this mode must be activated by
299
301
; ; A debug session is an ongoing eval, but it's annoying to have the
300
302
; ; spinner spinning while you debug.
301
303
(when spinner-current (spinner-stop))
302
- ; ; `inspect' would conflict with `inject' , so there's no key for it.
303
- (setq input-type (seq-difference input-type '(" inspect" )))
304
- (nrepl-dict-put cider--debug-mode-response " input-type" input-type)
305
-
306
304
(setq-local tool-bar-map cider--debug-mode-tool-bar-map)
307
305
(add-hook 'kill-buffer-hook #'cider--debug-quit nil 'local )
308
306
(add-hook 'before-revert-hook #'cider--debug-quit nil 'local )
@@ -313,13 +311,13 @@ In order to work properly, this mode must be activated by
313
311
(apply-partially #'cider--debug-lexical-eval
314
312
(nrepl-dict-get cider--debug-mode-response " key" )))
315
313
; ; Set the keymap.
316
- (let ((alist ( mapcar ( lambda (k ) ( cons ( string-to- char k) ( concat " : " k)) )
317
- ; ; `here' needs a special command.
318
- ( seq-difference input-type '( " here " ))) ))
319
- ( setq cider--debug-mode-commands-alist alist )
320
- ( dolist (it alist )
321
- ( define-key cider--debug-mode-map ( vector ( upcase ( car it))) # 'cider-debug-mode-send-reply )
322
- ( define-key cider--debug-mode-map ( vector ( car it)) # 'cider-debug-mode-send-reply )) )
314
+ (nrepl-dict-map ( lambda (char cmd )
315
+ ( unless ( string= char " h " ) ; `here' needs a special command.
316
+ ( define-key cider--debug-mode-map char # 'cider-debug-mode-send-reply ))
317
+ ( when ( string= char " o " )
318
+ ( define-key cider--debug-mode-map ( upcase char) # 'cider-debug-mode-send-reply )) )
319
+ input-type )
320
+ ( setq cider--debug-mode-commands-dict input-type )
323
321
; ; Show the prompt.
324
322
(cider--debug-mode-redisplay)
325
323
; ; If a sync request is ongoing, the user can't act normally to
@@ -331,7 +329,7 @@ In order to work properly, this mode must be activated by
331
329
(user-error (substitute-command-keys " Don't call this mode manually, use `\\ [universal-argument] \\ [cider-eval-defun-at-point]' instead" ))
332
330
(error " Attempt to activate `cider--debug-mode' without setting `cider--debug-mode-response' first " )))
333
331
(setq cider-interactive-eval-override nil )
334
- (setq cider--debug-mode-commands-alist nil )
332
+ (setq cider--debug-mode-commands-dict nil )
335
333
(setq cider--debug-mode-response nil )
336
334
; ; We wait a moment before clearing overlays and the read-onlyness, so that
337
335
; ; cider-nrepl has a chance to send the next message, and so that the user
@@ -394,12 +392,15 @@ message."
394
392
(if (symbolp last-command-event)
395
393
(symbol-name last-command-event)
396
394
(ignore-errors
397
- (cdr ( assq ( downcase last-command-event)
398
- cider--debug-mode-commands-alist ))))
395
+ (nrepl-dict-get cider--debug-mode-commands-dict
396
+ ( downcase ( string last-command-event) ))))
399
397
nil
400
398
(ignore-errors
401
399
(let ((case-fold-search nil ))
402
400
(string-match " [[:upper:]]" (string last-command-event))))))
401
+ (unless (or (string-prefix-p " :" command)
402
+ (string-prefix-p " {" command))
403
+ (setq command (concat " :" command)))
403
404
(cider-nrepl-send-unhandled-request
404
405
(append (list " op" " debug-input" " input" (or command " :quit" )
405
406
" key" (or key (nrepl-dict-get cider--debug-mode-response " key" )))
@@ -566,10 +567,12 @@ is a coordinate measure in sexps."
566
567
(let ((out))
567
568
; ; We prefer in-source debugging.
568
569
(when-let ((buf (and file line column
569
- (find-buffer-visiting file))))
570
+ (ignore-errors
571
+ (cider--jump-to-loc-from-info response)
572
+ (current-buffer )))))
570
573
; ; The logic here makes it hard to use `with-current-buffer' .
571
574
(with-current-buffer buf
572
- ; ; This is for retoring point inside buf.
575
+ ; ; This is for restoring point inside buf.
573
576
(save-excursion
574
577
; ; Get to the proper line & column in the file
575
578
(forward-line (- line (line-number-at-pos )))
0 commit comments