Giter Site home page Giter Site logo

breadcrumb's People

Contributors

chookity-pokk avatar joaotavora avatar josephmturner avatar phikal avatar roife avatar ruijieyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

breadcrumb's Issues

Contribute to Emacs by merging into which-func-mode?

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.

  • which-func only offers a global mode while breadcrumb offers both a global as well as a buffer-local mode.
  • breadcrumb also respects project information from project.el which which-func afaik does not.

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?

Issues with folded org headings support

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.

[FR] Filter buffers based on predicate(s)

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.

Customize node formatting function

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.

This package has the same name as another Emacs package on MELPA

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.

Overall face for header line?

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.

Issue with indirect buffers

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.

  1. Buffer I: timer launches imenu--make-index-alist
  2. Buffer I: lsp-mode sends the request with method="textDocument/documentSymbol" and with textDocument.uri = <path/to/base/file>
  3. Buffer B: timer launches imenu--make-index-alist
  4. Buffer B: lsp-mode sends the request with method="textDocument/documentSymbol" and with textDocument.uri = <path/to/base/file>
  5. Buffer B: lsp-mode receives a response.
  6. Buffer B: imenu--make-index-alist returns imenu alist.
  7. Buffer I: imenu--make-index-alist prints error after 10 seconds
    "Timeout while waiting for response. Method: textDocument/documentSymbol"
    This error is not visible by default, because of ignore-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.

how to shorten the project file path

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.

Bug: Clicking on breadcrumb doesn't switch to clicked window

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.

Bug: Error in buffer with no index-alist

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)

different faces

Can the project.el part and imenu part have different faces (as they represent different things in most languages)

Suggestion: Better Breadcrumb for Org Mode

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)

breadcrumb

File name black backgroud

Greetings, with the latest commits; I see that when I use Mini-Frame or the window goes to inactive, a black label is shown, instead of the file name.

I attach an image

After:
image

Before:
image

Thanks

Performance of breadcrumb-mode in files with many nodes

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?

Error during redisplay

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.

Add cache project-crumbs

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?

Unable to enable breadcrumb-local-mode

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:

  1. emacs -Q
  2. 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)

How to disable buffer title? Possible to add icons to crumbs?

Greetings!

  1. Thank you for creating this package and making it publicly available for the rest of us to use!
  2. I failed to find a way, with my very limited lisp knowledge, to hide the buffer-title in the breadcrumb and therefore I thought I should ask here if it was possible to disable/hide it in any way.
  3. Is it possible to add images (kind-icons?) to breadcrumb?
    • I have noticed sometimes that 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:

Selection 2024-01-02 20:36:33

Versus what I see in Emacs:

Selection 2024-01-02 20:40:20

Incorrectly shortening project directory name

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.

Reducing expensive calculation of project root

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.

YAML documents only show the top-level node name

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.