org-roam-node-at-point returned the wrong value if point-min is a
level-1 heading node. We make sure that everytime we go up one
heading, the outline-level changes (reduces by 1) to prevent this error.
* Fix undefined incf.
Calling org-roam-extract-subtree failes with "Symbol’s function definition is void: incf"
org-roam.el includes cl-lib. org-roam--h1-count uses a bare incf call, which is undefined. Fix this by using cl-incf.
* Save buffer before promoting it.
After fixing incf in 8ec2e59e67, org-roam-extract-subtree still fails.
The error is now: org-roam-db--file-hash: Opening input file: No such file or directory,...
The buffer with the newly created content is still unsaved at this time, so save it before calling (org-roam-promote-entire-buffer)
Caveat is we now save the buffer two times, before and after promoting it.
Previously we only updated the database on file save, but we need to
update the file's atime on file access, so we hook into `find-file-hook`
to do so. We only update the file atime if the file exists in the file table.
Special care is taken not to move the point if the original point is no
longer the same (i.e. the user moves the cursor after calling the
capture, but before finalizing it). Fixes#2108.
Previously, the file-path of the new node in `org-roam-extract-subtree'
was incorrect in many circumstances. Expanding w.r.t. the initial
prompt directory (ie, `org-roam-directory') fixes that
Revert to a simplified `org-roam-node-display-template`, because on
non-vertical completion frameworks it looks and behaves strangely. To
restore the original default behaviour, set
`org-roam-node-display-template` in your Emacs configuration as such:
(setq org-roam-node-display-template
(concat "${title:*} "
(propertize "${tags:10}" 'face 'org-tag)))
Emacs commit 3f096eb3405b2fce7c35366eb2dcf025dda55783 introduced
`string-glyph-compose` and `string-glyph-decompose`, autoloading these instead
of the (still existing) `ucs-normalize-NFC-region` and
`ucs-normalize-NFD-region`.
There are three cases:
- Emacs where these transitions have not happened yet (e.g. 27.1):
`ucs-normalize-NFC-region` and `ucs-normalize-NFD-region` are still
autoloaded, aliasing the new names to them will keep them usable
and the code still works.
- Emacs where the new functions are defined (not yet released): the new names
are autoloaded, no aliases are installed and the code still works.
- A (hypothetical?) Emacs where `string-glyph-compose` and
`string-glyph-decompose` are renamed. If `ucs-normalize-NFC-region` and
`ucs-normalize-NFD-region` do not get their autoloaded status back, the
aliasing will happen but the functions not autoloaded and the code will
break in the same way as in #1981
* (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)))
* (fix) Use read-from-minibuffer instead of completing-read where appropriate
* (feat) Add separate node and ref completion histories
Using separate histories has the advantage that the history only contains node
names and no other strings from other unrelated minibuffer completions.
* Allow capfs to run after org-roam-complete-everywhere. This is
necessary since org-roam-complete-everywhere gets triggered on every
word, even if no match has been found.
* Simpler hook setup. org-roam-complete-at-point is unnecessary, better
add the capfs directly.
* (fix)org-roam-node-default-sort: Add choice nil
* (fix)Ensure that annotation functions are compiled
* (fix)org-roam-node-read: Preserve sorting if sort-fn is non-nil
If the nodes are sorted by org-roam we don't want the completion UI to change
the order. In order to disable org-roam sorting set org-roam-node-default-sort
to nil. Then the sorting of the completion UI is used.
* (fix)org-roam-graph--build: Use ephermeral buffer name
Ephemeral buffers are hidden by default in the completion lists,
which is usually desired for background processes.
* (fix)capfs: Do not use completion-table-dynamic
completion-table-dynamic serves a different purpose. it should only be used if
the candidates are dynamically generated based on the input. This is not the
case for org-roam where we the list of nodes is already available right at the
beginning of the completion. This change should improve performance.
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.
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).