lazzalazza / org-footnote-assistant

A minor mode for editing and browsing org-footnotes from an indirect buffer
GNU General Public License v3.0
33 stars 1 forks source link

footnote nav: don't open by default? #5

Open mooseyboots opened 4 months ago

mooseyboots commented 4 months ago

i wonder if opening the footnote editing window shouldn't be optional?

perhaps it just because of getting stuck with the other issue i just opened. i navigate to next footnote, and before i know it i'm in a buffer i don't know how to close which i never wanted to open. "next-footnote" should just take me there, once i'm there i can C-c ' or perhaps C-c C-c or anything else (delete it, change the number, do nothing at all, etc.) the different commands serve different functionality, rather than things doing too much at once.

just some feedback. i'm presently gonna hack a next-footnote function that works as i prefer. not sure how to make it optional, maybe calling org-edit-special cd be a prefix arg.

mooseyboots commented 4 months ago

here's what i'm working with for now (but NB i'm bad with interactive arg specs):

(defun mb/org-goto-next-footnote (&optional show backward)
  "Move point to the next footnote reference.
SHOW is a prefix meaning to also open the editing buffer using
`org-edit-special'.
If BACKWARD is non-nil, move to the previous footnote reference."
  (interactive "P")
  (if (not backward)
      ;; If we're going forward, search for the next footnote reference
      (when (re-search-forward org-footnote-re nil t)
        (backward-char)
        (when show
          (org-edit-special)))
    ;; If we're going backward, search for the previous footnote reference
    (when (re-search-backward org-footnote-re nil t)
      (forward-char)
      (when show
        (org-edit-special)))))

(defun mb/org-goto-previous-footnote (&optional show)
  "Move poinnt to previous footnote reference.
SHOW is a prefix for `mb/org-goto-next-footnote'."
  (interactive "P")
  (mb/org-goto-next-footnote show t))

to my mind, this kind of approach allows for simpler functions, but your users can still combine various little functionalities if they want to.

(note you also needn't wrap a when in a progn, it has one implicitly.)

happy hacking.