joaotavora / breadcrumb

Emacs headerline indication of where you are in a large project
182 stars 10 forks source link

Don't show any function or variable name when point is outside their definitions #37

Open agreselin opened 1 month ago

agreselin commented 1 month ago

Hi and thanks for your packages João. Breadcrumb shows variable or function names even way after their definition, see this screenshot for example, where it displays antideriv_square, whose definition is highlighted at the top of the screen, even with point at the bottom of the screen after several other instructions: Screenshot from 2024-06-03 11-33-41

I find it a bit confusing and I think it would be better if it didn't display any function of variable name outside their definition.

joaotavora commented 1 month ago

Unfortunately, with your particular imenu backend, that's probably all that can be done. Breadcrumb does what it can with the information it has.

If this is a small file, please post the contents of C-h v imenu--index-alist

agreselin commented 1 month ago

Here's the value of imenu--index-alist:

(("Function"
  (#("diff_quot" 0 1
     (breadcrumb-siblings #1=
                          ((#("D" 0 1 (breadcrumb-siblings #1#)) . #<marker at
                            875 in
                            numerical_derivatives_with_higher_order_functions.jl>)
                           (#("antideriv_square" 0 1 (breadcrumb-siblings #1#))
                            . #<marker at 1175 in
                            numerical_derivatives_with_higher_order_functions.jl>))))
   . #<marker at 515 in numerical_derivatives_with_higher_order_functions.jl>)
  . #1#))
joaotavora commented 1 month ago

It's very hard to see due to C-h v 's default setting of print-circle ,but you can see there are only 3 definitions in this file, and only 3 start locations: 515, 875 and 1175. So anything after 1175 is "antideriv_square" as far as breadcrumb is concerned. OTher imenu backends do slightly better.

agreselin commented 1 month ago

I see. I'd like to try out different backends, do you have any suggestions?

joaotavora commented 1 month ago

If you install a language server and use Eglot, the Eglot language server sometimes can decorate that data structure with start and end locations, specifically for breadcrumb.el 's benefit. You can ask julia-ts-mode's authors to do the same (assuming that's what you're using).