branch: externals/breadcrumb
commit 7444e391c86265bea76649b2bcfe40fe3a2ecbd0
Author: João Távora <joaotav...@gmail.com>
Commit: João Távora <joaotav...@gmail.com>

    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.
---
 breadcrumb.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/breadcrumb.el b/breadcrumb.el
index 12195c69d3..7e3546b827 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)))

Reply via email to