joaotavora / breadcrumb

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

Suggestion: Better Breadcrumb for Org Mode #35

Closed whhone closed 6 months ago

whhone commented 6 months ago

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

joaotavora commented 6 months ago

breadcrumb is supposed to be major-mode agnostic. This means it should know nothing about other major modes, org-mode, emacs-lisp-mode, c++-mode, thingamabob-mode, etc. So while I agree your suggestion looks better, you should integrate it in your configuration.

So your solution (or something similar) is what it'll have to be unless you can somehow convince the org-mode developers to add breadcrumb-specific (or somehow agreed-upon) "cookies" to their imenu output. Then breadcrumb.el will read these cookies and propertize the output accordingly.

whhone commented 6 months ago

I see. Thanks for the explanation!