[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 102d1d2d1e 334/355: refactor!: Default Org front
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 102d1d2d1e 334/355: refactor!: Default Org front-matter to use org-id style ID property |
Date: |
Sun, 26 Jun 2022 23:58:37 -0400 (EDT) |
branch: externals/denote
commit 102d1d2d1e82c21fcad6548eb25194efeef775a3
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
refactor!: Default Org front-matter to use org-id style ID property
Move `denote-use-org-id` from denote.el to `denote-link-use-org-id` in
denote-link.el. Rationale for this change is that the ID property
style will always work for Org files and doesn't need any
customization; also that style doesn't add any org-id dependency.
The org-id dependency is needed only if the user wants to access
"active" feature of the "id:" type links like following and exporting.
---
denote-link.el | 21 +++++++++++++++++++--
denote.el | 42 +++++++-----------------------------------
2 files changed, 26 insertions(+), 37 deletions(-)
diff --git a/denote-link.el b/denote-link.el
index 408a0c53da..0ff570bc20 100644
--- a/denote-link.el
+++ b/denote-link.el
@@ -190,6 +190,23 @@ and/or the documentation string of `display-buffer'."
alist)
:group 'denote-link)
+(defcustom denote-link-use-org-id nil
+ "When non-nil use the ID link type in Org files.
+
+Newly created links will use the standard `id:' hyperlink type
+instead of the custom `denote:' type.
+
+In practical terms, the ID ensures maximum compatibility with the
+Org ecosystem.
+
+When the value is nil, Denote links rely on the custom `denote:'
+type (which should behave the same as the standard `file:' type).
+
+Other files types beside Org always use the `denote:' links."
+ :type 'boolean
+ :group 'denote-link)
+;;;###autoload (put 'denote-link-use-org-id 'safe-local-variable 'booleanp)
+
;;;; Link to note
;; Arguments are: FILE-ID FILE-TITLE
@@ -197,7 +214,7 @@ and/or the documentation string of `display-buffer'."
"Format of Org link to note.")
(defconst denote-link--format-org-with-id "[[id:%s][%s]]"
- "Format of Org link to note for `denote-use-org-id'.")
+ "Format of Org link to note for `denote-link-use-org-id'.")
(defconst denote-link--format-markdown "[%2$s](denote:%1$s)"
"Format of Markdown link to note.")
@@ -216,7 +233,7 @@ and/or the documentation string of `display-buffer'."
(defun denote-link--file-type-format (file)
"Return link format based on FILE format."
- (let ((org-format (if denote-use-org-id
+ (let ((org-format (if denote-link-use-org-id
denote-link--format-org-with-id
denote-link--format-org)))
(pcase (file-name-extension file)
diff --git a/denote.el b/denote.el
index 3391796539..a1c720bb6e 100644
--- a/denote.el
+++ b/denote.el
@@ -211,25 +211,6 @@ is suspended: we use whatever the user wants."
(string :tag "Custom format for `format-time-string'"))
:group 'denote)
-(defcustom denote-use-org-id nil
- "When non-nil use the ID property and link type in Org files.
-To use the ID property, a PROPERTIES drawer is added to the top
-of newly created notes. Furthermore, newly created links will
-use the standard 'id:' hyperlink type instead of the custom
-'denote:' type.
-
-In practical terms, the ID ensures maximum compatibility with the
-Org ecosystem.
-
-When the value is nil, Denote uses a generic front matter for new
-notes and links rely on the custom 'denote:' type (which should
-behave the same as the standard 'file:' type).
-
-Other files types beside Org always use the 'denote:' links and
-keep their generic front matter."
- :type 'boolean
- :group 'denote)
-
;;;; Main variables
(defconst denote--id-format "%Y%m%dT%H%M%S"
@@ -274,7 +255,7 @@ We consider those characters illigal for our purposes.")
(path (if (or (eq val 'default-directory) (eq val 'local))
default-directory val)))
(unless (file-directory-p path)
(make-directory path t))
- (when (and denote-use-org-id (require 'org-id nil t))
+ (when (require 'org-id nil :noerror)
(setq org-id-extra-files (directory-files path nil "\.org$")))
(file-name-as-directory path)))
@@ -510,10 +491,12 @@ is specific to this variable: it expect a delimiter such
as
"Final delimiter for plain text front matter.")
(defvar denote-org-front-matter
- "#+title: %s
+ ":PROPERTIES:
+:ID: %4$s
+:END:
+#+title: %s
#+date: %s
#+filetags: %s
-#+identifier: %s
\n"
"Org front matter value for `format'.
The order of the arguments is TITLE, DATE, KEYWORDS, ID. If you
@@ -531,16 +514,6 @@ and do not use any empty line before it.
These help ensure consistency and might prove useful if we need
to operate on the front matter as a whole.")
-(defvar denote-org-with-id-front-matter
- ":PROPERTIES:
-:ID: %4$s
-:END:
-#+title: %1$s
-#+date: %2$s
-#+filetags: %3$s
-\n"
- "Like `denote-org-front-matter' but for `denote-use-org-id'.")
-
(defun denote--file-meta-header (title date keywords id &optional filetype)
"Front matter for new notes.
@@ -550,13 +523,12 @@ TITLE, DATE, KEYWORDS, FILENAME, ID are all strings which
are
Optional FILETYPE is one of the values of `denote-file-type',
else that variable is used."
(let ((kw-space (denote--file-meta-keywords keywords))
- (kw-toml (denote--file-meta-keywords keywords 'toml))
- (org-front (if denote-use-org-id denote-org-with-id-front-matter
denote-org-front-matter)))
+ (kw-toml (denote--file-meta-keywords keywords 'toml)))
(pcase (or filetype denote-file-type)
('markdown-toml (format denote-toml-front-matter title date kw-toml id))
('markdown-yaml (format denote-yaml-front-matter title date kw-space id))
('text (format denote-text-front-matter title date kw-space id
denote-text-front-matter-delimiter))
- (_ (format org-front title date kw-space id)))))
+ (_ (format denote-org-front-matter title date kw-space id)))))
(defun denote--path (title keywords &optional dir id)
"Return path to new file with TITLE and KEYWORDS.
- [elpa] externals/denote 966fedf1f6 299/355: Write reference card for all functions, variables, (continued)
- [elpa] externals/denote 966fedf1f6 299/355: Write reference card for all functions, variables, ELPA Syncer, 2022/06/27
- [elpa] externals/denote fbe743ad6f 300/355: Tweak sample config for denote-dired-mode, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 8d504a3264 255/355: Check to operate on dired-rename window, ELPA Syncer, 2022/06/27
- [elpa] externals/denote a2e4497486 319/355: Expand the "Extending Denote" section, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 18af2cbcec 321/355: Update Acknowledgements, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 92f9cb8cb9 318/355: Use xref instead of relying on find+grep, ELPA Syncer, 2022/06/27
- [elpa] externals/denote ee4aed6376 316/355: Refine check for denote dir in dired revert, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 02d6f42ab4 320/355: Merge branch 'xref-instead-of-find', ELPA Syncer, 2022/06/27
- [elpa] externals/denote 6b7aa9db48 313/355: Reword a statement in the manual, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 0fdbbae03e 305/355: Expand FAQ entry on file-naming origin, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 102d1d2d1e 334/355: refactor!: Default Org front-matter to use org-id style ID property,
ELPA Syncer <=
- [elpa] externals/denote 25cc5a79e6 332/355: Require built-in xref to parse cross-references, ELPA Syncer, 2022/06/27
- [elpa] externals/denote e4697c563f 342/355: Tweak denote.el Commentary section, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 62fc0308c0 345/355: Tweak sample configuration, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 8d8e96182b 351/355: Fix two typos, ELPA Syncer, 2022/06/27
- [elpa] externals/denote fcf4ea7f53 302/355: Tweak reference to listing files, ELPA Syncer, 2022/06/27
- [elpa] externals/denote ee22a7f380 038/355: Add helper function for line predicates, ELPA Syncer, 2022/06/27
- [elpa] externals/denote e21db9418e 066/355: Tweak file regexp to read files with no extension, ELPA Syncer, 2022/06/27