This commit simplifies the code in org-roam-node-read--format-entry,
saving the entire processing of display properties when no
field-length is specified and thus no truncation needs to happen.
Since in this case, we don't truncate, the bug fixed in #1759 won't
reappear.
This has the beneficial side-effect that existing display properties
in the field-value, e.g., display properties that replace text by
images/icon, are not overridden by us when no field-length is
specified. Note that images anyway don't need truncation of the text
they replace.
This commit also fixes a wrong word in the comment.
The current implementation doesn't cover the scenario where
org-roam-directory doesn't have a trailing slash. Because of this,
users are enforced to make org-roam-directory end with a trailing
slash.
Currently, roam allows file template *nominally*, but, if one tries to set
up, it causes trouble.
`goto` functions, like `org-roam-dailies-goto-*`, tries to expand file
template with `org-roam-format-template`, which assumes template is
string. Hence, complains about it.
This commit suppress such malfunctions by do nothing for non-string template.
The current implementation uses org-element-map to iterate through all
links in the current buffer. This function doesn't consider links
within properties drawer. This implementation does consider such
links.
This function ignored the `force' optional argument because it always
quoted it, resulting in a non-nil value every time.
This makes the suggested code snippet in
https://github.com/org-roam/org-roam/issues/597#issuecomment-907743125
work as expected (not resetting point to the beginning of the "Index"
buffer on every invocation).
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
48a5d01726 was wrong, and the closure wasn't the cause. The source of
the issue stems from a missing compile-time dependency on subr-x.
Emacs 28 doesn't seem to require it for the needed functions anymore,
while older Emacsen still do. What even worse, the byte compiler doesn't
seem to complain about such thing on older Emacsen and the error message
produced at the run-time isn't helpful to identify the cause.
Fixes#1814.
It looks like Emacs' byte compiler is very naive and cannot properly
sometimes compile closures, which causes error like in #1814, at least
on Emacsen <28. One of the possible solutions is to write the code using
less abstractions in between, so the byte compiler would do the right
thing when arranging instructions.
Possibly addresses #1814.
Previously when ROAM_REFS is non-empty, but the refs are invalid, this
will cause an empty SQL expression and crash the db caching. This fixes
that scenario.
This name will better reflect the current purpose of the property. At
the beginning of the v2 it would only trigger for the new nodes (hence
:if-new), but through the development it's no longer the case, though
the behavior various from each type of the target.
As for now, this will be soft deprecated and won't be strictly enforced
at the user.
Previously, if org-roam-capture- would be triggered for an existing node
it would just move the point to the beginning of the node, ignoring the
target from the :if-new part of the template.
This patch will now also run the :if-new part of the template for
existing nodes, just like it does right now in case of daily
templates (which happened to be never recognized as existing nodes
during the capture process).
unwind-protect will still propagate the initial error, which isn't
desirable and can confuse both, the end-user and us when resolving
issues.
To keep the backtrace clean (in case of other errors), just
automatically detatch the advice once it ran in the error handling
branch. If the user change the file at the runtime, org-id shouldn't
fail with the error as long as it was handled at least once, and it
still will be handled by us during the next session. At the end of the
day it's a very niche edge case, which most of the users shouldn't ever
see.
Fixes#1805.
If org-roam-utils.el is byte-compiled when org-macs is not loaded (`org-with-point-at` macro missing), error can appear about missing `org-with-point-at`.
This is now the default behavior for `org-roam-find-noselect` and
`org-roam-node-visit`, unless FORCE parameter set to non-nil.
Co-authored-by: Duncan Burke <duncankburke@gmail.com>
Output the commit hash when it's available (e.g. when using straight to
install packages). This comes in handy during debugging during error
reporting.
This allows the empty field-width to be used, but using an empty
field-width will result in misalignment. This is useful for people who
use completion frameworks like Ido.
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.
(condition-case nil
(test)
(t nil))
Is a construct that's only available starting from Emacs 27. Since
Org-roam supports Emacs 26, gotta use what's given.
Note: ignore-errors isn't exactly the same as the construct above from
Emacs 27. Compare to ignore-errors to would trap all possible signals,
while ignore-errors will only trap "error" signals. This, however,
shouldn't affect us in case of this refactoring.
Fixes#1777.
This should be more useful than telling the user to run something
like (org-id-update-id-locations (directory-files-recursively ..))
org-id normally stores the org-id-locations-file in
user-emacs-directory, which should always exist if Emacs is installed.
If the path to the location exists, org-id will be able to create the
file on its own, however, configurations often change the location of
this file to a different one, in which case its path might not be
constructed of existing directories (on the file system) and org-id
won't be able to laydown this path for the user.
This causes org-id to throw unhelpful errors (like in #1734, #1700,
\#1688) that don't allow Org-roam to complete capture process or
properly finish migration, and possibly add malfunctions at other
layers.
Ideally this problem should be handled by org-id itself, but for now
this will be only patched in Org-roam.
Fixes#1700 and fixes#1638.
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
Co-authored-by: David Wilson <david@daviwil.com>
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".
Recent changes to how candidates are formatted (using a display property
to allow for searching in the full candidate while only showing enough
to fit in the frame), #1754, causes problems when the field value is already
preformatted (a user function, like the one provided in doom emacs,
already applies some faces with `propertize`). Generally the display
string get messed up and formatting gets applied to the whole display.
This PR updates the call that add the display property to the candidate
to remove all the styling from the candidate before the styled (and
truncated) display string is added as a property. This allows the
display string to look correct according to the properties a user has
already assigned.
This PR also fixes another bug from this change, where if a
`field-value` is and empty string `""` it would not get padded out to
the `field-width` causing misalignments between candidates.
When strings in org-roam-node-display-template are truncated, they are
no longer searchable using completions, resulting in suprising
behaviour. This change allows truncated strings to still be searched
according to their original value. Closes#1728.
When inserting the GPG decrypted org buffer to to DB, make sure that
the hash of the encrypted file is stored.
This prevents reparsing of GPG files over and over again when
synchronizing the database with the filesystem.
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>