summaryrefslogtreecommitdiff
path: root/cider-debug.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-06-28 00:19:31 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-07-01 19:17:31 +0100
commit4410610c0c6f70b2613a2dfa6716b0d941b4eed1 (patch)
treeeac4c31aab5516614860d4a244ca77a17ef7ef59 /cider-debug.el
parent02c4e801ecab254778e71eeacc19938229dc541f (diff)
Add partial support for debugging maps
Diffstat (limited to 'cider-debug.el')
-rw-r--r--cider-debug.el12
1 files changed, 11 insertions, 1 deletions
diff --git a/cider-debug.el b/cider-debug.el
index 6c1000c5..3bee1e21 100644
--- a/cider-debug.el
+++ b/cider-debug.el
@@ -279,6 +279,12 @@ This will skip over sexps that don't represent objects, such as ^hints and
(forward-sexp 1)
(setq n (1- n))))
+(defun cider--debug-goto-keyval (key)
+ "Find KEY in current sexp or return nil."
+ (-when-let (limit (ignore-errors (save-excursion (up-list) (point))))
+ (search-forward-regexp (concat "\\_<" (regexp-quote key) "\\_>")
+ limit 'noerror)))
+
(defun cider--debug-move-point (coordinates)
"Place point on POS in FILE, then navigate into the next sexp.
COORDINATES is a list of integers that specify how to navigate into the
@@ -292,7 +298,11 @@ sexp."
(when (looking-back "#(")
(pop coordinates))
(if coordinates
- (cider--forward-sexp (pop coordinates))
+ (let ((next (pop coordinates)))
+ ;; String coordinates are map keys.
+ (if (stringp next)
+ (cider--debug-goto-keyval next)
+ (cider--forward-sexp next)))
;; If that extra pop was the last coordinate, this represents the
;; entire #(...), so we should move back out.
(backward-up-list)))