Commit Graph

1092 Commits

Author SHA1 Message Date
852042436e (feat)db: support different sqlite3 libraries (#1907) 2021-10-17 19:13:03 +08:00
dafcf0dcf8 (feat)insert: add org-roam-node-formatted (#1909)
Format a node into a string using a templated string (e.g. "${title}")
or using a function.
2021-10-17 16:15:58 +08:00
2b6f8ce615 (perf)db: don't require (probably non-existent) 'oc feature for each org file (#1908)
Instead check if the (autoloaded) function `org-cite-insert' is bound.

This prevents a lot of unnecessary filesystem I/O when generating the
org roam database.
2021-10-16 17:49:26 +08:00
5651f4598c (chore)libraries: s/s-join/string-join/g (#1906)
Remove usages of s-join. s.el is currently pulled in implicitly by f.el.
2021-10-16 16:25:03 +08:00
e9299297f9 (fix)completion: annotation fixes (#1904)
* (fix)Formatter: Ensure that strings are always padded up to the field width

* (feat)Colorize tags by default with org-tag face
2021-10-14 00:24:39 +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
f80515ab5f (feat)completions: separate completion history (#1901)
* (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.
2021-10-13 12:47:19 +08:00
4af5ff662e Update documentation on migrating from v1 (#1900)
* Update documentation on migrating from v1

* update texi

Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
2021-10-12 00:53:32 +08:00
73dfeb60cf (chore): update slack url (#1899) 2021-10-11 17:35:14 +08:00
5b933bd8ec (fix)completions: improve completion-at-point slightly (#1896)
* 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.
2021-10-11 13:57:24 +08:00
3a54182bb1 (fix)completion: minor fixes around completing-read (#1893)
* (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.
2021-10-10 19:37:57 +08:00
34243a0a90 (feat): allow org-roam-node-display-template to be a closure (#1891) 2021-10-09 21:36:20 +08:00
54d17cc50f (docs): add space so that list item displays correctly (#1880) 2021-10-03 14:02:40 +08:00
54b63db350 (fix)graph: fix default value of org-roam-graph-node-extra-config (#1884) 2021-10-03 13:57:55 +08:00
8f2c51ad21 (refactor)completions: simplify org-roam-node-read--format-entry (#1850)
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.
2021-10-01 16:03:36 +08:00
3b93c83b23 (fix)db: Require 'oc to get org-cite functionality. (#1849) 2021-10-01 15:45:02 +08:00
a101c548c1 fix(org-roam-node-read): add aliases (#1883) 2021-10-01 15:44:09 +08:00
1b8ece0219 fix(org-roam-node-read): fix regression introduced in #1876 (#1882)
Fix `filter-fn` not working like its supposed to.
2021-10-01 15:09:10 +08:00
0ecbd3a104 fix(org-roam-extract-subtree): Use file-name-as-directory (#1871)
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.
2021-09-30 19:08:08 +08:00
66e10df943 (fix)dailies: stop asking for time, only date (#1877)
There is no reason `org-roam-dailies-capture-date' should ask for a
time as only a date is necessary.
2021-09-30 18:54:46 +08:00
d2fc4be73b optimize(core) linear->constant time filter-fn (#1876)
in org-roam-node-read, there is no need to check filter-fn for each node, move the branch up, O(n) to O(1)
2021-09-30 18:54:25 +08:00
17d8e84ea5 (docs): fix typo in README (#1842)
instuctions != instructions
2021-09-26 15:36:15 +08:00
777f969b50 (docs): fix typo in docs (#1834) 2021-09-26 15:35:53 +08:00
bc833a9ff4 (fix)capture: ignore file template upon capture goto. (#1858)
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.
2021-09-26 15:00:53 +08:00
ec8d250f6c feat(org-roam-db-map-links): Consider links in properties drawers (#1868)
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.
2021-09-26 14:44:16 +08:00
1795039ab9 (perf)db: wrap update-file in sql transaction (#1827)
This should lead to some performance gains on buffers with lots of
inserts required (e.g. when the buffer has a lot of links).
2021-09-01 19:43:19 +08:00
a8a36a420b (fix)org-roam-node-visit: pass correctly optional force parameter (#1821)
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).
2021-08-30 02:30:04 +03:00
340215a16a (feat) core: support new org-mode citations (#1806)
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
2021-08-29 19:33:14 +08:00
941bd1f6b4 (fix)compat: resolve all the missing compile-time dependencies (#1820)
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.
2021-08-29 05:41:36 +03:00
48a5d01726 (fix)capture: refactor org-roam-capture--get-if-new-target-a (#1818)
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.
2021-08-28 16:48:56 +03:00
0e6b93a253 (fix)db: prevent invalid refs from crashing db update (#1816)
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.
2021-08-28 13:42:30 +08:00
cfabe0ec38 (feat)capture: rename :if-new template property to :target (#1809)
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.
2021-08-27 19:45:50 +08:00
ab87a08e17 (fix)db: prevent empty aliases sql expression (#1813) 2021-08-27 19:01:43 +08:00
714ea7a3fc (chore): upgrade dependency of magit-section to 3.0.0 (#1808)
Closes #1803.
2021-08-26 19:15:16 +08:00
4c4b024b49 (fix)capture: always trigger :if-new template for existing nodes (#1807)
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).
2021-08-26 19:04:46 +08:00
5dde894a0c (fix)org-id: condition-case instead of unwind-protect the error handler
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.
2021-08-26 02:29:03 +03:00
74a6fd598a (fix)org-id-locations-file: use :test instead of :type when recovering
The latter is incorrect construct for the make-hash-table.
2021-08-25 19:00:50 +03:00
e9ae19c01c (chore): adding changelog entry (#1800)
Related to #1693 and #1681
2021-08-23 14:34:50 +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
04b7780ff9 fix: Do not skip invisible headings when getting node at point. (#1798) 2021-08-22 00:01:52 +08:00
858f531d96 (feat)buffer: optimize reflinks fetch (#1795)
Use SQL join instead of iterating over each ref and running another sql query.
2021-08-21 16:18:41 +08:00
f819720c51 v2.1.0 (#1792) v2.1.0 2021-08-21 02:57:40 +08:00
887c49c89c (docs)readme: update installation section (#1787) 2021-08-19 22:05:18 +08:00
d4cbb1d499 (feat): don't move the point when revisiting already visited nodes (#1788)
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>
2021-08-19 15:16:02 +03: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
4a7ecfbed8 (fix): remove duplicate edges from graphs (#1768)
When a node links to the another node twice, two edges appear in the
graph. To keep the graph clean, remove all duplicate edges.
2021-08-18 15:50:57 +08:00
df65654b2f (fix)completions: allow empty field-width (#1785)
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.
2021-08-18 14:03:16 +08:00
b627298171 (fix){preview,grep}-visit: always navigate to the source of the preview
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.
2021-08-18 00:39:42 +03:00
b8a66deae9 (docs): link to org-roam-ui (#1782)
Closes #1780
2021-08-18 00:29:53 +08:00
aafc8606bb (feat): add generalized template prefixes (#1723)
Adds org-roam-node-template-prefixes to split and prefix node properties
as a query language during completions, and allow 0-width template portions.
2021-08-17 23:40:56 +08:00