On Windows, `file-truename` and `directory-file-name` downcase driver
label: "C:/" => "c:/", while `expand-file-name` keep the case
unchanged. If `org-roam-directory` use upper case driver label, `org-roam-descendant-of-p` will alway return `nil`. Fix by only using `file-truename` in the function.
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
Let's assume we're evaluating the following region:
```elisp
(org-roam-capture-
:node (org-roam-node-create :title "Org Roam Homepage")
:info '(:ref "https://orgroam.com")
:props '(:immediate-finish nil))
```
Prior to this commit, if you did not require "org-roam-protocol" then
`org-roam-capture-` would ignore the `:info '(:ref
"https://orgroam.com")` parameter. Once you required
"org-roam-protocol" then the callback hooks that process `:info`'s
`:ref` will fire regardless of whether it comes from org-roam-protocol.
After this commit, you no longer need to require "org-roam-protocol" to
ensure that you capture an `:info`'s `:ref`.
Why is this useful? When I'm reading through my elfeed RSS feed, I want
to capture an article. I could use the org-roam-protocol to do this,
but that seems a bit unnecessary given that I'm already in Emacs.
Closesorg-roam/org-roam#2078
When dynamic binding `org-roam-directory` to the "dailies/"
subdirectory also bind `org-roam-dailies-directory` to "./" to prevent
invalid expansions in user-defined hook functions.
Fixes#2070
This is an extension of PR #2028 [1] by @astery, where the `keys`
argument was added to `org-roam-dailies--capture` `org-roam-dailies-capture-today`.
I extended this argument to also be available in other built-in dailies
functions, as I didn't see any reason why not and it results in my opinion in
more consistent behaviour.
The rationale is the same as in #2028: Allow users to add keybindings (or in my
case hydras) to calls of org-roam-dailies functions with specific template keys,
thus circumventing the selection screen.
So far it seems to work for me. I have only one pet-peeve about
the interface, if the user starts adding keys to all their goto-functions, they
might add
(org-roam-dailies-goto-date nil "<key>")
Then the key-string will be interpreted as the value for `prefer-future` and
since it's non-nil, there won't be an error.
[1] https://github.com/org-roam/org-roam/pull/2028
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)))
Adds two customizable variables: org-roam-db-extra-links-elements and
org-roam-db-extra-links-exclude-keys, which govern which elements are to
be considered for link parsing by Org-roam.
Also added sane defaults to org-roam-db-extra-links-exclude-keys.
* (fix):db: pragma foreign keys to work with sqlite3
This commit is follow-up for PR #2009 should fix issues #1927 & #1910.
Currently, `[:pragma (= foreign_keys ON)]` is present only in function
`org-roam-db--init`. This means the `foreign_keys` is turned on only when the db
file is created for the first time. Subsequent Emacs sessions won't turn it on
as the db file is already present and does not evaluate `org-roam-db--init`.
This PRAGMA needs to be turned on each database connection at runtime according
to sqlite's documentation (https://sqlite.org/foreignkeys.html#fk_enable)
```
Foreign key constraints are disabled by default (for backwards compatibility),
so must be enabled separately for each database connection
```
I have observed that on Windows only the Emacs session that initially creates
the Org-roam db file works correctly with the `sqlite3` option. Subsequent Emacs
sessions have the same "Unique constraint failed" error messages.
I have tested this patch on Windows and Ubuntu; both seem to work in the first
and subsequent Emacs sessions.
I am not 100% sure if the location of the PRAGMA is the best; use it as a
proof-of-cocenpt for the fix. Thank you.
* remove: [:pragma (= foreign_keys ON)] from org-roam-db--init
* fix: defconst org-roam--sqlite-available-p outputs error
When `org-roam-database-connector` is not `sqlite`, it outputs an unnecessary
error when Org-roam starts up as `defconst` evaluates
`(emacsql-sqlite-ensure-binary)`.
```
Org-roam initialization: (error "No EmacSQL SQLite binary available, aborting")
```
For other database connectors, this is not relevant.
* chore: rm org-roam--sqlite-available-p
As per our conversation, org-roam--sqlite-available-p not needed.
* docs: Correct how to install gcc on Windows
PATH needs to be manually set on Windows. Previously, it was explicitly
mentioned that it was unnecessary. More recent experience is that it's necessary.
* regenerate texi
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
Previously node caching used org-map-entries: this only mapped over agenda
entries, hence skipping various nodes. Instead, we should be using
org-map-region, which maps over the entire file.
* (docs): fix examples for .dir-locals.el
Two items:
1. The current example does not work; in order to call a function wihtin
`.dir-locals.el`, you should use `eval`.
- [StackExchange](https://emacs.stackexchange.com/questions/21955/calling-functions-in-dir-locals-in-emacs)
- [Working
example buried in an issue](https://github.com/org-roam/org-roam/issues/1527#issuecomment-933674233))
- `(info "(emacs)Directory Variables")`
2. Add clear instruction to use an absolute path to define `org-roam-directory` in
this context (it's buried in this [issue](https://github.com/org-roam/org-roam/issues/1459#issuecomment-817259656).
* (docs)Fix the `eval` example for subdirectories.
Comment: https://github.com/org-roam/org-roam/pull/2002#issuecomment-991830879
The eval form that uses relative path sets the local variable *relative to the
org file*. This means the eval form woudl need to locate the relevant
`.dir-locals` file by traversing the directory tree upwards from the
file (lightly tested to wrok)
Using absolute path (the first example) should be fine without change (not tested)
* update texi
* (docs) minor correction to #2002
Correcting the example of .dir-locals using an absolute path to avoid confusion.
Lightly tested with a real absolute path in my system; works on my end with a
subdir.
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
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.
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