joaotavora / breadcrumb Goto Github PK
View Code? Open in Web Editor NEWEmacs headerline indication of where you are in a large project
Emacs headerline indication of where you are in a large project
GNU Emacs has a which-func-mode
which provides a very similar feature set. breadcrumb.el differs in at least following aspects. But which-func could also benefit from all of these.
Since you are core contributor to GNU Emacs, I suggest to contribute breadcrumb.el to Emacs itself, by moving all its (above mentioned, additional) features to which-func-mode. What do you think?
I have an org file with some headings folded. When I use the breadcrumb in this org file with collapsed headings, it triggers the following error.
Error during redisplay: (eval (+mode-line-normal)) signaled (error "Marker does not point anywhere")
Here's an example org
file:
* a
** aa
aa
** ab
ab
When fold all the second level headings, it's shown as:
* a
** aa
** ab
After typing anything, the error mentioned above is triggered.
Then problem raised from the function breadcrumb--ipath-plain
. breadcrumb--ipath-plain
will compute breadcrumb--ipath-plain-cache
, which turns out to be
[(#<marker in no buffer> aa a) (#<marker in no buffer> ab a)]
I guess #<marker in no buffer>
caused the error.
I have some stale sshx|sudo buffers open. When I enable breadcrumb-mode
, I get prompted for the password for those buffers. Ideally, I should be able to filter buffers based on one or more predicates.
Hi, Thanks for this package. I was looking for something like this and found some discussions from last year and this popping up this week 😃. Happy timing.
I'd like to be able to inject icons before each breadcrumb item based on its type. I'm not really sure how you're managing to detect the completion type but breadcrumb does seem to have it available 🤔.
(breadcrumb-ipath (breadcrumb--ipath-alist) (point))
;; (#("foo" 0 3 (breadcrumb-region (1 . 102) breadcrumb-kind "Namespace")) #("bar" 0 3 (breadcrumb-region (21 . 100) breadcrumb-kind "Namespace")) #("baz" 0 3 (breadcrumb-region (45 . 94) breadcrumb-kind "Namespace")) #("foo" 0 3 (breadcrumb-region (73 . 83) breadcrumb-kind "Function")))
Is there any possibility of opening up the bc--format-node
function as something customizeable so one can inject whatever they'd like into it.
S.N. Any way to use the standard company-kind values instead of this string (I presume that's passed from the imenu backend but if we could update eglot and any of the other builtins to supply this instead (perhaps as a separate field that breadcrumb then ingests) then that would be great).
S.S.N. Whatever we do to add icons to the statusline probably shouldn't influence breadcrumb-jump. If that needs annotations it should come from the standard minibuffer margin functionality like marginalia or consult provide.
Having trouble installing this package in Doom Emacs with
(package! breadcrumb :recipe (:host github :repo "joaotavora/breadcrumb"))
because breadcrumb
gets pulled in from emacsmirror
instead. Not sure if there's another way to install this with Doom Emacs and have it be auto-updated.
Want to take a stab at creating a function breadcrumb-jump-global
that gives you a jump list across all open buffers. Just wanted to ask if it's theoretically possible or if imenu limits this some how.
Self-explanatory I think - I cloned it locally to use with the great "straight" package management system.
Thanks for this lib! Very nice and simple. I'm using it with eglot and in org-mode.
It would be nice if there was a customizable var for the main face for the bc--header-line. (I think this is a different feature request from #9 which is asking for individual face controls for project and imenu faces, but I could be wrong.)
I could use advice to add a :propertize
around the result but it would be nice to just set a face.
Hi, thank you for this package.
I've recently started using this package and noticed occasional freezes for 10 seconds when working with indirect buffers.
I've tracked it down to an imenu update that is launched in the idle timer from bc--ipath-alist
.
My setup: Emacs-30.0.50, imenu is powered by lsp-mode, lsp-server: pyright 1.1.325
So, when you have two windows B (base buffer), I (indirect buffer), and idle for a second after the change, the following will happen.
imenu--make-index-alist
textDocument.uri
= <path/to/base/file>imenu--make-index-alist
textDocument.uri
= <path/to/base/file>imenu--make-index-alist
returns imenu alist.imenu--make-index-alist
prints error after 10 secondsignore-errors
.I'm not expert of lsp-mode or lsp protocol, but I guess that lsp server cancel? the first request after it receives the identical second request and never sends anything back for the first request.
I'm not sure whether it is correct behavior or not, but the consequences, while using it with breadcrumb, are pretty harsh.
I've come up with this fix.
It checks whether the base buffer is visible and if it is then returns imenu--index-alist
from the base buffer.
It seems that it is a good idea in general, since there is no point to update imenu index two times for the same buffer.
But I understand that the actual problem has nothing to do with breadcrumb, so you may feel free to reject this fix.
I have typescript + eglot project. Breadcrumb works great, but I can't customize the file path portion. My file path looks like this
<project name>/native/src/components/common.tsx : <the in-file position>
I tried limiting the breadcrumb-project-max-length
but nothing changes. Probably I have the wrong idea what this variable does.
anyhow, I'd like to have flexibility to how the file path is displayed. Ideally I'd like to be able to provide formatter function, ideally local to the project or the folder? This is monorepo and in each (sub) project I'd shorten different part to help me orient myself better.
When opening a pdf file (w/ pdf-tools), breadcrumb shows a blank sequence. [screenshot](https://github.com/joaotavora/breadcrumb/assets/74098495/fcd6ac02-85bf-4cd8-9872-c4b7e5b28c17.
Hello, I get propertize: Symbol’s function definition is void: project-name
when running breadcrumb-mode
.
Emacs 28.2 on macOS.
I (load "breadcrumb.el)
and hit M-x breadcrumb-mode
.
Hi there, I noticed a small bug.
If I have a 2 window split. LHS containing some code with breadcrumb active. RHS containing something else and being the focused window. And I click on the breadcrumb on the LHS window then my point is moved in the existing RHS window instead of first switching focus to the LHS and then moving point.
Running breadcrumb in a buffer with a mode that doesn't have any breadcrumbs results in a lot of messages being sent in the background:
Error during redisplay: (eval (breadcrumb--header-line)) signaled (args-out-of-range 0 0) [26 times]
Trying to invoke this manually signals thte error deeper into the breadcrumb logic, specifically we don't check whether the alist is populated or not and that raises an error.
Debugger entered--Lisp error: (args-out-of-range 0 0)
get-text-property(0 breadcrumb-region nil)
(if (get-text-property 0 'breadcrumb-region (car (car index-alist))) (breadcrumb--ipath-rich index-alist pos) (breadcrumb--ipath-plain index-alist pos))
breadcrumb-ipath((nil) 237)
(let* ((--cl-var-- (breadcrumb-ipath alist (point))) (p nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq p (car --cl-var--)) (setq --cl-var-- (cons (breadcrumb--format-node p) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--))
(breadcrumb--summarize (let* ((--cl-var-- (breadcrumb-ipath alist (point))) (p nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq p (car --cl-var--)) (setq --cl-var-- (cons (breadcrumb--format-node p) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) breadcrumb-imenu-max-length breadcrumb-imenu-crumb-separator)
(if alist (breadcrumb--summarize (let* ((--cl-var-- (breadcrumb-ipath alist (point))) (p nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq p (car --cl-var--)) (setq --cl-var-- (cons (breadcrumb--format-node p) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) breadcrumb-imenu-max-length breadcrumb-imenu-crumb-separator) nil)
(let* ((alist (and t (breadcrumb--ipath-alist)))) (if alist (breadcrumb--summarize (let* ((--cl-var-- (breadcrumb-ipath alist (point))) (p nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq p (car --cl-var--)) (setq --cl-var-- (cons (breadcrumb--format-node p) --cl-var--)) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)) breadcrumb-imenu-max-length breadcrumb-imenu-crumb-separator) nil))
breadcrumb-imenu-crumbs()
funcall(breadcrumb-imenu-crumbs)
mapcar(funcall (breadcrumb-project-crumbs breadcrumb-imenu-crumbs))
(cl-remove-if #'seq-empty-p (mapcar #'funcall '(breadcrumb-project-crumbs breadcrumb-imenu-crumbs)))
(let ((x (cl-remove-if #'seq-empty-p (mapcar #'funcall '(breadcrumb-project-crumbs breadcrumb-imenu-crumbs))))) (mapconcat #'identity x " : "))
breadcrumb--header-line()
eval-expression((breadcrumb--header-line) nil nil 127)
funcall-interactively(eval-expression (breadcrumb--header-line) nil nil 127)
command-execute(eval-expression)
Can the project.el part and imenu part have different faces (as they represent different things in most languages)
Problem: 'breadcrumb-imenu-crumbs changes the face (style) of the org heading.
Suggestion: Preserve the face (style) of org heading in breadcrumb.
Here is the idea (there is probably better solution)
(defun breadcrumb-org-crumbs ()
"Get the chain from the top level heading down to current heading."
(org-format-outline-path (org-get-outline-path t)
(1- (frame-width))
nil
" > "))
(defun breadcrumb--header-line ()
"Helper for `breadcrumb-headerline-mode'."
(let* ((imenu-crumbs (if (eq major-mode 'org-mode)
'breadcrumb-org-crumbs
'breadcrumb-imenu-crumbs))
(x (cl-remove-if
#'seq-empty-p (mapcar #'funcall
`(breadcrumb-project-crumbs ,imenu-crumbs)))))
(mapconcat #'identity x (propertize " : " 'face 'bc-face))))
Proposed UI (Left) and Current UI (Right)
When opening file types, where many nodes get assigned from the underlying mechanism (it's imenu and project.el?), the performance degrades rather badly.
I noticed this when switching from js-json-mode
to json-ts-mode
where the introspective capabilities of treeesitter populate many nodes to imenu. A file of 380kB, 18000 lines takes on my moderately performant computer about 10 seconds with breadcrumb-mode
enabled, until Emacs becomes responsive again. If I remove breadcrumb-mode from autoload, the files opens about 10 times faster.
I assume this behaviour is not tied to json-ts-mode alone but to every mode, which operates on large files and where the files nature lends to the creation of many nodes, like yaml-ts-mode, xml-modes?
I am not sure why breadcrumb mode does not work for some files.
Here is what I see when using it in a C file:
Error during redisplay: (eval (breadcrumb--header-line)) signaled (wrong-type-argument number-or-marker-p #<overlay from 1 to 33 in 1.c>) [3 times]
Entering a struct like this causes this problem:
struct mystruct {
bool test;
};
Perhaps breadcrumb needs to strip off the overlays from the source file before putting data into the header-line.
The overlay range goes from the start of the struct definition to the end.
Sadly I don't know which package in my setup creates the overlay that causes the error.
I noticed that the breadcrumb--project-crumbs-1
function is being called frequently, which leading to performance overhead. However, the project-crumbs does not change frequently, so how about caching it to optimize the performance?
Thanks for providing such good package. I'm also a eglot user.
When I tried to enable breadcrumb-local-mode
, I met with such error: (void-variable bc-local-mode)
Environment:
OS: ubuntu 16.04
Emacs: 27.1
Procedures to reproduce:
emacs -Q
M-;
and (load "/path/to/breadcrumb")
Debug info (debug-on-error
):
Debugger entered--Lisp error: (void-variable bc-local-mode)
breadcrumb-local-mode(toggle)
funcall-interactively(breadcrumb-local-mode toggle)
call-interactively(breadcrumb-local-mode record nil)
command-execute(breadcrumb-local-mode record)
execute-extended-command(nil "breadcrumb-local-mode" nil)
funcall-interactively(execute-extended-command nil "breadcrumb-local-mode" nil)
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Greetings!
breadcrumb
and therefore I thought I should ask here if it was possible to disable/hide it in any way.kind-icons
?) to breadcrumb
?
breadcrumb
lacks some depth, don't know the cause of this tbh.Example code block:
overlays =
(mapModules ./overlays import)
// {
default = final: prev: {
unstable = pkgs-unstable;
my = self.packages.${system};
};
};
What I see in neovim:
Versus what I see in Emacs:
When working within projects named like a.b
(such as xxx.github.io
), breadcrumb-project-crumbs
shortens names to a
, which incorrectly interpreting .b
as an extension.
However, since this is the name of a directory, this should not occur.
I was looking at the some of the Elisp standard libraries on a nix-based installation of Emacs. These lie under the /nix/store/
directory which may have tens or hundreds of thousands of entries. I think this must cause calculation of the project root to be very expensive. In any event, scrolling with the mouse while in breadcrumb mode is unusable. Caching the return value of bc--project-crumbs-1
results in the usual smooth scrolling experience.
Should it get packaged, you'll need something like the below:
I installed this package hoping it would provide more context when editing long YAML docs like Kubernetes manifests and values files, but when moving my cursor around with the major mode enabled, I only see the current name of the top-level node (node with no indentation) instead of the full hierarchical path—at least the path to the parent of the node my cursor is on.
Is my expected behavior not the intended one?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.