Function: treemacs--flatten-org-mode-imenu-index
treemacs--flatten-org-mode-imenu-index is a byte-compiled function
defined in treemacs-tag-follow-mode.el.
Signature
(treemacs--flatten-org-mode-imenu-index INDEX &optional PATH)
Documentation
Specialisation of treemacs--flatten-imenu-index for org mode.
An index produced in an org-mode buffer is special in that tag sections act
not just as a means of grouping tags (being bags of functions, classes etc).
Each tag section is instead also a headline which can be moved to. The
flattening algorithm must therefore be slightly adjusted.
INDEX: Org Imenu Tag Index PATH: String List
Source Code
;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-tag-follow-mode.el
(defun treemacs--flatten-org-mode-imenu-index (index &optional path)
"Specialisation of `treemacs--flatten-imenu-index' for org mode.
An index produced in an `org-mode' buffer is special in that tag sections act
not just as a means of grouping tags (being bags of functions, classes etc).
Each tag section is instead also a headline which can be moved to. The
flattening algorithm must therefore be slightly adjusted.
INDEX: Org Imenu Tag Index
PATH: String List"
(declare (pure t) (side-effect-free t))
(let (result)
(--each index
(let ((is-subalist? (imenu--subalist-p it)))
(setq result (cons (cons (if is-subalist? (car it) it) (nreverse (copy-sequence path))) result))
(when is-subalist?
(setq result (append result (treemacs--flatten-org-mode-imenu-index (cdr it) (cons (car it) path)))))))
result))