Closed mooseyboots closed 1 year ago
excited about your interest!
I use links instead of tags (essentially tagging but with a page to collect backlinks instead, and I can build the list of links quick enough with zim-wiki-refresh-completions
), so this hasn't been a pain point for me yet.
Getting a list of all the tags is probably painfully slow to do using just the notebook files -- would need to parse each file collecting all `@\S* matches(?). I haven't explored reading zim's sqlite db. That's probably the most efficient path to enumerating tags. Eventually I'd like to get there to extract backlinks anyway. Though I have no timeline.
Despite that, listing all occurrences of a known tags should be pretty easy. I use projectie-ag
bound to SPC s(evil leader as space). Calling it when the cursor is over the word e.g. @mytag
will search the notebook for all instances of mytag
.
outline mode is a good candidate for handing headings and is already enabled b/c zim-wiki-mode extends dokuwiki-mode. see outline-insert-heading
on the difficult default binding C-c @ RET. Unfortunately, outline mode does not handing the ending part of symmetrical ===
heading markup. outline-insert-heading-hook
can probably be used to fix that. but I don't see similar hooks for outline-mode-{promote,demote}
maybe defadvice
will do there? To make things worse, promote and demote work in the opposite direction we want. More =
is higher in doku/zim but outine-mode thinks fewer should be higher level.
For my usage, the journal page is the place I most frequently use multiple headings. zim-wiki-week-template
is an interactive function to make those
;; first pass at promote/demote. NB. zim-promote is on outline-demote
;; for dokuwiki/zim fewer = are lower, outline wants to add = to demote
(defadvice outline-demote (after zim-wiki-mode-promote activate)
(when (derived-mode-p 'zim-wiki-mode)
(save-excursion (move-end-of-line 1) (insert "="))))
(defadvice outline-promote (after zim-wiki-mode-demote activate)
(when (derived-mode-p 'zim-wiki-mode)
(save-excursion (move-end-of-line 1) (delete-backward-char 1))))
more notes for wrapping outline-mode:
it'd be useful to have a function that scraps the ending =
sequence and then just appends the same number of leading =
to the end of the line. Using that for promote, demote, and insert advice would remove the need for any code specific to each
===
at the end of a header zim-wiki-list-tags-refresh
(only works on linux -- haven't looked up where the DB lives for others)i only just caught up to your additions and updates here. really glad the tags via db + capf is working. nice.
i just discovered this package, and would love to be able to edit my zim files in emacs. i can't see any capacity to handle headings or tags though, is that correct? they're both pretty basic and necessary, at least for the way i use zim.
(i see i can just manually insert headings, and they render, but tags not at all.)