mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 17:11:41 -05:00
Represent heading level using #'s in Imenu
This commit is contained in:
parent
122ddcebe2
commit
d3d4f1e7c3
1 changed files with 6 additions and 2 deletions
|
@ -1153,10 +1153,14 @@ as usual."
|
|||
|
||||
(defun ein:notebook-imenu-create-index ()
|
||||
"`imenu-create-index-function' for notebook buffer."
|
||||
;; As Imenu does not provide the way to represent level *and*
|
||||
;; position, use #'s to do that.
|
||||
(loop for cell in (ein:filter #'ein:headingcell-p
|
||||
(ein:notebook-get-cells ein:notebook))
|
||||
collect (cons (ein:cell-get-text cell)
|
||||
(ein:cell-input-pos-min cell))))
|
||||
for sharps = (loop repeat (oref cell :level) collect "#")
|
||||
for text = (ein:cell-get-text cell)
|
||||
for name = (ein:join-str "" (append sharps (list " " text)))
|
||||
collect (cons name (ein:cell-input-pos-min cell))))
|
||||
|
||||
(defun ein:notebook-imenu-setup ()
|
||||
"Called via notebook mode hooks."
|
||||
|
|
Loading…
Add table
Reference in a new issue