59 Commits

Author SHA1 Message Date
7ce95a286b release 2.3.1 2025-06-26 11:55:56 -07:00
df4e903208 perf: suppress extra org features in the temp buffer
Figuring out how to indent things and folding and clock updates, etc.
consumes a great deal of time especially considering that files
are (currently) processed for /every single backlink/ even if multiple
backlinks come from the same file.

This dramatically improves the load/refresh time for the org-roam
buffer.

Fix: #2399
2025-06-07 19:58:20 -07:00
2ff616fbd8 release 2.3.0 2025-05-24 23:06:32 -07:00
ed272eaf56 Address compiler warnings
Depend on Org 9.6 for `org-fold-show-context'.
2025-02-18 08:56:35 -08:00
551ff3b17e Use org-fold-show-context instead of obsolete function alias
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.
2025-02-18 08:56:35 -08:00
0d51698839 Rely on emacsql-sqlite-open to pick the best available back-end
That function was added two years ago and the first release that
provided it was v4.0.0.  It automatically picks the best available
back-end, `emacsql-sqlite-builtin' or `emacsql-sqlite-module'.
In v4.0.0 it could also fall back to the legacy `emacsql-sqlite'.
The inferior third-party back-ends are no longer supported.

Emacsql v4.1.0, which will be releases in early December, removes
the legacy `emacsql-sqlite' back-end (which used a custom binary).
2025-02-18 08:56:35 -08:00
3e186a8552 (fix): remove dead-code about org-roam-shield feature (#2462)
As described in https://github.com/org-roam/org-roam/issues/2348,
the `org-roam-shield-region` function is not called anymore.

The reverse function and associated face can also be removed.

Fix: #2348
2024-07-15 19:50:52 +02:00
f7dc81e494 Fix org-fold-core-style in org-roam-buffer (#2325) 2023-03-05 09:20:07 -08:00
1981dc3617 utils: descendant-of-p: Defend against nils (#2319)
This has an effect on find-file-hook for totally unrelated files,
through the callchain of `org-roam-db-autosync--setup-file-h ->
org-roam-file-p -> org-roam-descendant-of-p'.

From an org file, inside a project-el project, (find-file
"some/other/file") will intermittently reproduce this error:

   org-roam-descendant-of-p: Wrong type argument: arrayp, nil

If this fix seems inappropriate -- it could amount to surppressing a
valid error in routine calls -- then I would advise throwing an
explicit signal here, or finding a safer way to get the `path` inside
`org-roam-file-p'; the current means:

    (or file (buffer-file-name (buffer-base-buffer)))

.. can result in nil, which then bleeds errors into use elsewhere.

for posterity, here is the full calling context I'm referring to, from
`org-roam-file-p'.

  (let* ((path (or file (buffer-file-name (buffer-base-buffer))))
         (ext (when path (org-roam--file-name-extension path)))
         (ext (if (string= ext "gpg")
                  (org-roam--file-name-extension (file-name-sans-extension path))
                ext))
         (org-roam-dir-p (org-roam-descendant-of-p path
         org-roam-directory))
         ...
2023-02-23 14:43:47 +08:00
e435581215 (fix): remove use of deprecated org-font-lock-ensure (#2238) 2022-07-23 13:58:47 -07:00
nth
917a325dd9 (fix): links not displayed properly in org-roam-buffer (#2236)
Closes #2228.
2022-07-23 08:47:08 -07:00
bbac208fda (feat): org-roam-property-* code duplication removed (#2217) (#2218)
Co-authored-by: Chris Langhans <chris@langhans-coding.de>
2022-06-10 17:08:25 -07:00
007e76725c (chore) fix version numbers (#2182) 2022-05-03 18:06:55 -07:00
3716817618 (utils): add sqlite-connector to diagnostics output (#2162) 2022-04-16 20:32:57 -07:00
3782e88d50 (release): v2.2.1 (#2126) 2022-03-14 23:37:29 -07:00
f6950a9820 (fix)capture: fill-template preserve whitespace content (#2117)
* (fix)capture: fill-template preserve whitespace content

Preserve the whitespace content given in the capture template, by
caching it and then appending it to the output template. For
Org-capture's purposes, we need to separately ensure that a newline is
present. Adds tests to the various helper functions to illustrate changes.

Addresses #2115
2022-03-10 09:46:53 -08:00
f50d6e7376 (fix): caching symlinked files (#2112)
* Revert "(fix): `org-roam-descendant-of-p` bug on Windows (#2089)"

This reverts commit 97a342fd3f.

Reason:

It seems that the `file-in-directory-p` function proposed in #2089 is provided only for
*physical directories*, does not work as we would like with *symlinked directories*.
It dereferences all the symlinks in its path, and previously seemed related paths
cease to be such.

Because of this, such notes are ignored and not indexed, although they
were indexed earlier.
2022-03-03 22:47:24 -08:00
97a342fd3f (fix): org-roam-descendant-of-p bug on Windows (#2089)
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.
2022-02-20 10:05:12 -08:00
c0c240b975 (chore): Drop f.el and s.el dependency (#2025)
Drops the f.el and implicit s.el dependency.

Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
2022-01-15 21:26:20 -08:00
6170cc9928 (release): bump 2021 -> 2022, 2.1.0 -> 2.2.0 2022-01-14 10:53:56 -08:00
8b43093d1a (fix)org-roam-with-file: ensure local variables are respected (#2033)
When visiting a file, ensure that local variables are respected.
2022-01-12 03:38:44 +08:00
023af3ec32 (feat)buffer: add customization variables for buffer (#1990)
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.
2021-11-26 14:43:26 +08:00
c9efbe1dda (fix)db: fix org-roam-db-sync exiting early on unhandled errors (#1983)
When update-file fails, clear the file from the database and show an
error.
2021-11-23 23:47:00 +08:00
e4188179f6 (fix)utils: fix org-roam-with-file changing the major-mode (#1980)
`org-roam-with-file` should not alter the major-mode if the
mode is already derived from org-mode.
2021-11-23 00:23:03 +08:00
a2e46db808 (feat)db: support org-ref v3 (#1977)
Org-ref v3 introduced a new citation syntax, and removed some functions
that org-roam had previously relied upon (e.g. for extracting keys from
multi-citations).

This commit introduces support on two fronts:

1. Add `org-roam-org-ref-path-to-keys` which converts a link path to a
list of keys. This supports both Org-ref v2 and v3.

2. Adds support for parsing multi-citations in refs.
2021-11-20 16:33:12 +08:00
b96efbb444 (minor)chore: fix minor warnings by native compiler (#1959)
* Fix warnings reported by emacs (--with-native-compiler)
* Drive-by fix for org-roam-database-connector's :group
2021-11-11 20:00:07 +08:00
721f167563 (perf)utils: optimize org-roam-plist-map! (#1958)
The old implementation:

- did not handle duplicate keys well (the function would be applied to each value, but only the first value would be updated with the last value's result)
- was quadratic in the length of the input list (for each key, plist-put would search for the first occurrence of the key by going through all previous elements again)
- copied the input sequence even though this was not really needed
- did not provide a result value that could be useful, thus encouraging imperative programming
- did not need to be a macro, and the macro implementation was evaluating fn multiple times and causing warnings in the native compiler because k and v were not bound.
2021-11-11 19:59:36 +08:00
25bc3acce3 (fix)buffer: change preview-content logic (#1955)
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.
2021-11-09 22:32:40 +08:00
d26047e6f7 (minor)db: make check for property drawers case-insensitive (#1949) 2021-11-07 22:29:17 +08:00
84f58cbc12 (perf)db: require optional libraries only once per function (#1944)
Require optional libraries 'org-ref and 'oc only once per function run:
org-roam-db-update-file and org-roam-db-sync will call these requires at
the top level instead of within the link mapper.
2021-11-06 15:03:04 +08:00
3e47f198c7 (fix)utils: org-roam-set-keyword skip over all drawers (#1931)
Previously org-roam-set-keyword was unable to handle the syntax of the
:LOGBOOK: drawer. We introduce `org-roam-end-of-meta-data` to move point
over all drawers, allowing us to set the keyword in the right place.
2021-11-01 14:39:50 +08:00
c789531e36 (chore)utils: standardize org-roam-property-add/remove fn signatures (#1930) 2021-10-30 16:21:43 +08:00
852042436e (feat)db: support different sqlite3 libraries (#1907) 2021-10-17 19:13:03 +08:00
617e0021f5 (fix)completions: fix highlighting of formatted/truncated strings (#1895)
* (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)))
2021-10-13 19:13:45 +08:00
34243a0a90 (feat): allow org-roam-node-display-template to be a closure (#1891) 2021-10-09 21:36:20 +08:00
d25d477b4f (refactor): ensure dependencies are loaded for org-roam-utils.el (#1799)
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`.
2021-08-23 01:41:58 +03:00
f819720c51 v2.1.0 (#1792) 2021-08-21 02:57:40 +08:00
f29a770af3 (feat)org-roam-version: output commit hash when available (#1786)
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.
2021-08-18 16:16:32 +08:00
65b463d3c6 (minor)org-roam-format: Fix code formatting (#1726)
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
2021-08-08 14:03:10 +08:00
2d8dc8e31b (feat): globally restructure and refactor the codebase (#1724)
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.
2021-08-08 13:53:35 +08:00
127d6efa48 (feat)org-roam-format: add default-value (#1709)
Allow specification of default values in org-roam-format of the form ${key=default_val}.
2021-07-29 23:27:55 +08:00
de47f0a28d (fix)autoloads: Point autoloads to org-roam.el file (#1673)
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.
2021-07-27 20:33:50 +08:00
6ce07cdbf7 (fix) org-roam-get-keyword: fix for cjk characters (#1672) 2021-07-25 23:07:51 +08:00
aee3467b3e Org-roam V2 (#1401) 2021-07-17 19:29:30 +08:00
f98e7d22a5 (chore): cleanup and re-order code (#213) 2020-03-01 15:36:39 +08:00
150ae65564 (feature): deprecate roam-protocol, extend org-protocol instead (#203)
Add 2 custom handlers:

1. roam-file?file=path: this simply opens the file at path in Emacs.
2. roam-ref?ref=ref&template=roam-template&title=title&...: attempts to open a roam note with a given ROAM_KEY. If the note doesn't exist, create one. Else, open it.
2020-02-29 22:09:04 +08:00
0c2aaad3df (feature): use sqlite as backing database (#200)
All org-roam related information will now be stored in the database. Henceforth, the cache needs to be built synchronously once (via `M-x org-roam-build-cache`), which is then incrementally updated.
2020-02-29 15:56:08 +08:00
685aa2afcd Ensure cache consistency for refs cache (#194) 2020-02-26 23:04:02 +08:00
92d25b287e (feature): add a cache for ROAM_KEY (#192) 2020-02-26 22:26:02 +08:00
19f16e9c64 (feature): support file aliases (#182)
Closes #91
2020-02-26 00:11:38 +08:00