Node titles with special characters (single quotes, dollar signs, etc.)
break the ripgrep command because the regex pattern is passed through
the shell. This causes silent failures that show up as unlinked
references not being present for a given node.
This change writes the regex pattern to a temp file and uses ripgrep's
--file option instead of shell command line. `shell-quote-argument` is
replaced with `regexp-quote` since we're no longer passing through
shell. Wrapped in unwind-protect for cleanup.
Fix: #2407Close: #2408
Not all links to a node come from another node. Persisting OLP data
allows us to build backlinks with information about these non-node
headings.
Revert: db4170a459.
As it happens, turning sexps into strings is one of the
computationally expensive steps in EmacSQL.
With an enormous number of links in the database, that's a lot
of (:outline nil) to stringify into "(:outline nil)".
Its only use was in org-roam-node-insert-section,
where the information is very cheap to reconstruct.
It's already in one of the other arguments!
This has passed unnoticed because org-roam-db-sync has other
performance tarpits, but it will probably be noticed eventually after
those get fixed.
To avoid having to create a wrapper function and silence the byte-
compiler for both when using a pre-rename and post-rename Org, keep
it simple and just depend on Org 9.6.
* (test): add "org-roam--list-files-search-globs"
* (feat): extract rg-command builder function from unlinked-references
Users can now advice this command to tweak the flag pased to ripgrep.
The current one have been expanded to long-form.
It's a follow up to the fix about shell quoting
* (docs): update CHANGELOG
`org-roam-unlinked-references-section` would get nil org-roam-node-title
when create a headline node, which caused the issue #1625. This commit
add a check to make `org-roam-unlinked-references-section` work
correctly.
Prior to this commit, when we would render backlinks in the
`org-buffer`, we would render each reference. This meant that if a
source file referenced the node 5 times, there would be 5 backlink
references in the `org-buffer` (one for each position of the reference).
With this change, we add a parameter that specifies that backlink
sources should be unique. In the above example, that would mean instead
of 5 backlinks we'd see 1. And, as a concession, we'd use the lowest
position (e.g. the first reference in the source).
Closes#2119
This commit adds 3 custom variables:
1. org-roam-buffer-postrender-functions
This list of functions are run within the Org-roam buffer after the
Org-roam buffer is rendered. For example, one can produce latex previews
for all content within the Org-roam buffer:
(add-hook
'org-roam-buffer-postrender-functions (lambda () (org--latex-preview-region
(point-min) (point-max))))
2. org-roam-preview-function
This is the function used to extract the content to populate the buffer.
It defaults to `org-roam-preview-default-function`, which extracts all
contents within the headline up to the next headline.
3. org-roam-preview-postprocess-functions
This is a list of functions run to post-process the content retrieved
from org-roam-preview-function. It can be used to strip additional
content from the buffer, or perform sentence-unwrapping.
Some commit in Org 9.5 changed the AST structure, so we our previous
preview content logic was borked and started showing the full contents
of the file. To be forward compatible we change the content preview
logic, and extract everything within the section.
Fixes#1934.
* (fix)org-roam-unlinked-references-section: Use truncate-string-ellipsis
The variable can be set to a unicode ellipsis.
* (fix)org-roam-node-read--format-entry: Fix highlighting for truncation
Fix#1801. The truncated part of the string is made invisible. Matching
on the whole string remains possible.
* (fix)org-roam-format-template: Preserve string properties like format
If the variable value carries properties itself, these properties
take precedence. Display templates can be properties with this change.
(setq org-roam-node-display-template
(concat (propertize "${title:*}" 'face 'font-lock-keyword-face)
" "
(propertize "${tags:10}" 'face 'font-lock-constant-face)))
Support caching the new Org 9.5 citations.
Because citations now has first-class support, and are treated
differently from links, they are now cached in their own table.
Org-ref citations, instead of being stored in the links table, are now
stored in the citations table instead.
To use a citation as a ROAM_REF, use the `@citeKey` syntax
Previously when the preview and buffer would be opened, it would just
display the buffer at the last visited position without performing any
repositiong.
To enforce the correct behavior, the point should be always moved after
the buffer is visited, and not before.
So if the user have folded content it will will automatically unfold the
surrounded context and reveal the thing at point. This should be very
useful for people who alter initial visibility of headings with
:VISIBILITY: property and of the whole file with something like
"#+startup: fold".
Detangle the codebase and change how dependencies are resolved to
allow the package to better modularize and load itself without
introducing circular dependencies, especially when autoloads involved.
At the current state autoloads from non `org-roam.el` unable to start
loading of the package from their own file. See the following to learn
more about the problem:
https://github.com/org-roam/org-roam/issues/1590#issuecomment-885817825
This is no more than a workaround to bandage a more deeper underlying
problem. Until the more fundamental problem won't be fixed, all autoload
cookies from non "org-roam.el" file will need to manually point to the
main entry point of the package -- "org-roam.el" file, to load it
without causing errors.
Fixes#1590, #1620, #1600 and other similar issues.
This adds the whole new section in `org-roam-mode.el` for node dedicated
buffers, with a new global command `org-roam-buffer-display-dedicated`,
which supersedes `org-roam-buffer` command.
Along the way this also refactors the code for the persistent buffers to
clean it up, make it more clear in what it does, improve its robustness,
and to make it play nice with the dedicated buffers.
Non-ASCII characters are displayed incorrectly because
`org-roam-unlinked-references-preview-line` uses
`insert-file-contents-literally` which ignores the encoding.
Use `insert-file-contents` which does the right thing.
fixes#1575