Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix): fall back to org-id search ID face computation #1195

Merged
merged 2 commits into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Document faces, default to only applying to Org-roam notes
  • Loading branch information
jethrokuan committed Oct 19, 2020
commit 497a41f4df90a2b7a13b6c5ae22fda798b9c5318
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- [#1074](https://github.com/org-roam/org-roam/issues/1074) fix `org-roam--extract-links` to handle content boundaries.
- [#1193](https://github.com/org-roam/org-roam/issues/1193) fix `org-roam-db-build-cache` by not killing temporary buffer in `org-roam--extract-links`.
- [#1195](https://github.com/org-roam/org-roam/issues/1195) fix ID face showing as invalid if within Org ID files, but not Org-roam's.

## 1.2.2 (06-10-2020)

Expand Down
20 changes: 19 additions & 1 deletion doc/org-roam.org
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,25 @@ The Org-roam buffer displays backlinks for the currently active Org-roam note.
Org-roam files are created and prefilled using Org-roam's templating
system. The templating system is customizable (see [[*The Templating System][The Templating System]]).

** Org-roam Faces

Org-roam introduces several faces to distinguish links within the same buffer.
These faces are enabled by default in Org-roam notes.

- User Option: org-roam-link-use-custom-faces

When ~t~, use custom faces only inside Org-roam notes.
When ~everywhere~, the custom face is applied additionally to non Org-roam notes.
When ~nil~, do not use Org-roam's custom faces.

The ~org-roam-link~ face is the face applied to links to other Org-roam files.
This distinguishes internal links from external links (e.g. external web links).

The ~org-roam-link-current~ face corresponds to links to the same file it is in.

The ~org-roam-link-invalid~ face is applied to links that are broken. These are
links to files or IDs that cannot be found.

* Inserting Links

The preferred mode of linking is via ~file~ links to files, and ~id~ links for
Expand Down Expand Up @@ -672,7 +691,6 @@ To easily insert ~roam~ links, one may wish to use a package like [[https://gith
harder to edit. Defaults to ~t~.

* Navigating Around

** Index File

As your collection grows, you might want to create an index where you keep links
Expand Down
25 changes: 25 additions & 0 deletions doc/org-roam.texi
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Concepts and Configuration
* Directories and Files::
* The Org-roam Buffer::
* Org-roam Files::
* Org-roam Faces::

Navigating Around

Expand Down Expand Up @@ -783,6 +784,7 @@ All of Org-roam's customization options can be viewed via
* Directories and Files::
* The Org-roam Buffer::
* Org-roam Files::
* Org-roam Faces::
@end menu

@node Directories and Files
Expand Down Expand Up @@ -858,6 +860,29 @@ For example one can prevent the window from being deleted when calling
Org-roam files are created and prefilled using Org-roam's templating
system. The templating system is customizable (see @ref{The Templating System}).

@node Org-roam Faces
@section Org-roam Faces

Org-roam introduces several faces to distinguish links within the same buffer.
These faces are enabled by default in Org-roam notes.

@itemize
@item
User Option: org-roam-link-use-custom-faces

When @code{t}, use custom faces only inside Org-roam notes.
When @code{everywhere}, the custom face is applied additionally to non Org-roam notes.
When @code{nil}, do not use Org-roam's custom faces.
@end itemize

The @code{org-roam-link} face is the face applied to links to other Org-roam files.
This distinguishes internal links from external links (e.g. external web links).

The @code{org-roam-link-current} face corresponds to links to the same file it is in.

The @code{org-roam-link-invalid} face is applied to links that are broken. These are
links to files or IDs that cannot be found.

@node Inserting Links
@chapter Inserting Links

Expand Down
11 changes: 6 additions & 5 deletions org-roam.el
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ This is active when `org-roam-completion-everywhere' is non-nil."
;;;; Function Faces
;; These faces are used by `org-link-set-parameters', which take one argument,
;; which is the path.
(defcustom org-roam-link-use-custom-faces 'everywhere
(defcustom org-roam-link-use-custom-faces t
"Define where to apply custom faces to Org-roam links.

Valide values are:
Expand All @@ -1202,9 +1202,9 @@ everywhere Apply custom faces everywhere.

Otherwise, do not apply custom faces to Org-roam links."
:type '(choice
(const :tag "Use custom faces inside Org-roam notes" t)
(const :tag "Apply custom faces everywhere" everywhere)
(const :tag "Do not apply custom faces" nil))
(const :tag "Use custom faces inside Org-roam notes" t)
(const :tag "Apply custom faces everywhere" everywhere)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about everywhere option. Thanks for adding information to docs!

(const :tag "Do not apply custom faces" nil))
:group 'org-roam)

(defun org-roam--file-link-face (path)
Expand Down Expand Up @@ -1244,7 +1244,8 @@ file."
(eq org-roam-link-use-custom-faces 'everywhere))))
(cond ((and custom
(not (org-roam-id-get-file id))
(not (org-id-find id)))
(not (and (eq org-roam-link-use-custom-faces 'everywhere)
(org-id-find id))))
'org-roam-link-invalid)
((and (org-roam--in-buffer-p)
(org-roam--backlink-to-current-p))
Expand Down