Skip to content

Commit 6f292d7

Browse files
authored
Add customization recipes (weirdNox#89)
1 parent 68646b6 commit 6f292d7

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/customization-recipes.org

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
org-noter is already very configurable via configuration flags/variables. There's more that can be customized using hooks and advice.
2+
3+
* Customizing note opening process
4+
5+
By default org-noter likes to store the notes in =Notes.org= file.
6+
7+
Say you want to change that to be dynamically generated, perhaps with =completing-read= of some sort.
8+
9+
Override the =org-noter-create-session-from-document-hook=. The hook will call a function of two arguments, =ARG= and =DOC-PATH=.
10+
11+
=arg= is not used, and =DOC-PATH= is the complete file path to the pdf (document).
12+
13+
This terminates the normal org-noter flow. At this point, org-roam integration generates a new notes file, creates an org-noter heading and reinvokes =(org-noter)=.
14+
15+
See the =org-noter--create-session-from-document-file-supporting-org-roam= in [org-noter-org-roam.el](https://github.com/org-noter/org-noter/blob/master/modules/org-noter-org-roam.el#L45).
16+
17+
18+
* Customizing the content of precise notes
19+
20+
21+
When I take precise notes, I like the idea of having the content of the highlight stored below the fold of a heading.
22+
23+
This allows me to paraphrase the headline while preserving the original content in the =QUOTE= block.
24+
25+
This is achieved with an advise:
26+
27+
#+begin_src elisp
28+
29+
(define-advice org-noter--insert-heading (:after (level title &optional newlines-number location) add-full-body-quote)
30+
"Advice for org-noter--insert-heading.
31+
32+
When inserting a precise note insert the text of the note in the body as an org mode QUOTE block.
33+
34+
=org-noter-max-short-length= should be set to a large value to short circuit the normal behavior:
35+
=(setq org-noter-max-short-length 80000)="
36+
37+
;; this tells us it's a precise note that's being invoked.
38+
(if (consp location)
39+
(insert (format "#+BEGIN_QUOTE\n%s\n#+END_QUOTE" title))))
40+
41+
42+
#+end_src

0 commit comments

Comments
 (0)