Exlude org-noter-insert notes from being cached as nodes

Right now I am using org-noter to annotate PDFs, mostly by calling org-noter-insert-precise-note (which generates an org-heading with an ID).

Currently org-roam is capturing each annotation as an individual node, which is leading to an unmanageable number of nodes in my database.

I am aware of org-roam-db-node-include-function from the manual, but am not sure how/whether I can use it to exclude org-noter notes from being cached as nodes in my database.


As far as I can see, org-noter itself does not add an ID to notes by with org-noter-insert-precise-note. (My PDF notes have no IDs).

I believe you have additional packages, probably org-noter-pdftools, which has this customizing variable:

(defcustom org-noter-pdftools-use-org-id t
  "When non-nil, an org-id is generated for each heading for linking with PDF annotations and record entry parents."
  :group 'org-noter
  :type 'boolean)

If you don’t need IDs, I guess you can try turning it off and see what happens.

Alternatively, Section 6.1 of the Org-roam manual mentions ROAM_EXCLUDE so you should be able to add an additional property either manually or automatically via some custom function.

* Foo
  :ID:       foo

Option 3 would be to use org-roam-db-node-include-function.

The section referenced above contains this sample code:

(setq org-roam-db-node-include-function
      (lambda ()
        (not (member "ATTACH" (org-get-tags)))))

As your Org-noter headings contain NOTER_PAGE property, I think you can add something like this.

(setq org-roam-db-node-include-function
      (lambda ()
        (not (cdr  (assoc "NOTER_PAGE" (org-entry-properties)))))))

I don’t have time to test this idea; perhaps someone can jump in.


Thanks @nobiot.
I tried the first two options by myself and they worked. However, the option 3 is what I was looking for.
I think in your code there is some mismatches for parentheses, and I used the following in my init.el:

(setq org-roam-db-node-include-function
          (lambda ()
            (not (cdr  (assoc "NOTER_PAGE" (org-entry-properties))))))

@gnohz Thank you! So your version works, right?


1 Like

You are right this was an org-noter-pdftools function, and option 3 is also exactly what I was looking for!