weirdNox / org-noter

Emacs document annotator, using Org-mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a hook after "Inserting on an existing note" in org-noter-insert-note

abvbv opened this issue · comments

commented

I'd like to run some code after (insert selected-text) in org-noter-insert-note.

My use case:

  1. Open an EPUB book with nov.el.
  2. Make a note (i / org-noter-insert-note).
  3. Mark some text in the book, press i to insert it into the existing note.
  4. The marked text is filled with a particular window width in mind [1] and so is the inserted text. I prefer it to be non-filled in my org files. So I have to mark the inserted paragraph (M-h / org-mark-element) and join the lines (M-^ / org-delete-indentation).

What's the best option to automate the last step?

[1] nov.el uses shr.el to render books and it fills all lines (shr-fill-lines). I tried to turn it off, but for an unrelated reason I found it less convenient.

commented

This works for now:

(define-key nov-mode-map (kbd "f")
      (lambda ()
        (interactive)
        (org-noter-insert-note)
        (org-mark-element)
        (org-delete-indentation)
        (end-of-line)
        (newline 2)
        (other-window 1)
        (keyboard-quit))

Don't forget to mark some text before using it.

Gonçalo, I'm ok with this issue to be closed.

commented

Did you try adding hook to org-noter-insert-heading-hook?