summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2023-09-13 19:04:34 +0100
committerJoão Távora <joaotavora@gmail.com>2023-09-13 19:06:43 +0100
commit7444e391c86265bea76649b2bcfe40fe3a2ecbd0 (patch)
tree0d94bacf2159b36aa2d1e28d4cbf3c43a4751a01
parentff5fb77e2556c42aee9f1131f824bdfb955d861f (diff)
Fix #17: Sometimes the cdr of an imenu node is an overlay
Semantic/CEDET does this, apparently (I couldn't get it to in my machine). Anyway, the overlay strat is not as powerful as breadcrumb-region, since it only seems to apply to leaf nodes. So best to keep the code branching to bc--ipath-plain and catch the overlay there. * breadcrumb.el (bc--ipath-plain): Rework.
-rw-r--r--breadcrumb.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/breadcrumb.el b/breadcrumb.el
index 12195c6..7e3546b 100644
--- a/breadcrumb.el
+++ b/breadcrumb.el
@@ -196,7 +196,15 @@ These structures don't have a `breadcrumb-region' property on."
(put-text-property 0 1 'breadcrumb-siblings (cdr siblings) (car ipath))
(setq bc--ipath-plain-cache
(vconcat bc--ipath-plain-cache
- `[,(cons (cdr n) ipath)])))))
+ `[,(cons
+ ;; See github#17 and docstring of
+ ;; `imenu--index-alist' for the
+ ;; "overlay" edge case.
+ (cl-etypecase (cdr n)
+ (number (cdr n))
+ (marker (cdr n))
+ (overlay (overlay-start (cdr n))))
+ ipath)])))))
(unless bc--ipath-plain-cache
(mapc (lambda (i) (dfs i nil index-alist)) index-alist)
(setq bc--ipath-plain-cache (cl-sort bc--ipath-plain-cache #'< :key #'car)))