Ignore files or headings with certain property

I would like org-roam to ignore headings (but not the whole file) that have an :id: property.

I think a nice way would to add an an “org-roam-ignore” property to the heading.

Is this possible (with org-roam-file-exclude-regexp)?

What is your use case? You can use a function to ignore certain types of nodes when searching.

Here is an example. I only want to find nodes that have PROJ or AREA todo keyword. I create a function dmg-org-roam-prarea-visit that behaves like org-roam-node-find. You can add a specific tag to those nodes you want to exclude and if the node has that tag, then return nil, otherwise return t

 (defun dmg-org-roam-filter-project-or-area (node)
   "return t if node is PROJ or AREA"
   (member (org-roam-node-todo node) '( "PROJ" "AREA"))
   )
 

 
 (defun dmg-org-roam-prarea-visit ()
   (interactive)
   (org-roam-node-find nil nil  'dmg-org-roam-filter-project-or-area))
 )

I don’t think so. org-roam-file-exclude-regexp works on file names, not headings (headlines) within files.

Why not use "ROAM_EXCLUDE" property? (“What to Cache” section on Org-roam User Manual).

EDIT: Sorry, earlier I missed: "ROAM_EXCLUDE" prop. Custom function is for a more complex scenario.

For more complex conditions, you can also use this customizing variable. You can set your own custom function to it.

(defcustom org-roam-db-node-include-function (lambda () t)
  "A custom function to check if the point contains a valid node.
This function is called each time a node (both file and headline)
is about to be saved into the Org-roam database.

If the function returns nil, Org-roam will skip the node. This
function is useful for excluding certain nodes from the Org-roam
database."
  :type 'function
  :group 'org-roam)
1 Like