[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote a553003322 5/5: Make link format variables publi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote a553003322 5/5: Make link format variables public |
Date: |
Sun, 30 Oct 2022 00:57:36 -0400 (EDT) |
branch: externals/denote
commit a553003322e4096d2575e6cba06ce09f2da130fc
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Make link format variables public
---
README.org | 16 ++++++++++++++++
denote.el | 42 ++++++++++++++++++++++++++++++------------
2 files changed, 46 insertions(+), 12 deletions(-)
diff --git a/README.org b/README.org
index 6b8f0457c6..ad60df9e3d 100644
--- a/README.org
+++ b/README.org
@@ -2700,6 +2700,22 @@ might change them without further notice.
front matter. It is passed to ~format~ with arguments =TITLE=,
=DATE=, =KEYWORDS=, =ID= ([[#h:7f918854-5ed4-4139-821f-8ee9ba06ad15][Change
the front matter format]])
+#+vindex: denote-org-link-format
++ Variable ~denote-org-link-format~ :: Format of Org link to note.
+ The value is passed to ~format~ with =IDENTIFIER= and =TITLE=
+ arguments, in this order. [This variable is part of
{{{development-version}}}.]
+
+#+vindex: denote-md-link-format
++ Variable ~denote-md-link-format~ :: Format of Markdown link to note.
+ The =%N$s= notation used in the default value is for ~format~ as the
+ supplied arguments are =IDENTIFIER= and =TITLE=, in this order.
+ [This variable is part of {{{development-version}}}.]
+
+#+vindex: denote-id-only-link-format
++ Variable ~denote-id-only-link-format~ :: Format of identifier-only
+ link to note. The value is passed to ~format~ with =IDENTIFIER= as
+ its sole argument. [This variable is part of {{{development-version}}}.]
+
#+findex: denote-surround-with-quotes
+ Function ~denote-surround-with-quotes~ :: Surround string =S= with
quotes. This can be used in ~denote-file-types~ to format front
diff --git a/denote.el b/denote.el
index 7c9010a2ca..90cfe378ba 100644
--- a/denote.el
+++ b/denote.el
@@ -2380,17 +2380,35 @@ and/or the documentation string of `display-buffer'."
;;;;; Link to note
-;; Arguments are: FILE-ID FILE-TITLE
-(defconst denote-link--format-org "[[denote:%s][%s]]"
- "Format of Org link to note.")
+(define-obsolete-variable-alias
+ 'denote-link--format-org
+ 'denote-org-link-format
+ "1.2.0")
+
+(defvar denote-org-link-format "[[denote:%s][%s]]"
+ "Format of Org link to note.
+The value is passed to `format' with IDENTIFIER and TITLE
+arguments, in this order.")
-(defconst denote-link--format-markdown "[%2$s](denote:%1$s)"
+(define-obsolete-variable-alias
+ 'denote-link--format-markdown
+ 'denote-md-link-format
+ "1.2.0")
+
+(defvar denote-md-link-format "[%2$s](denote:%1$s)"
"Format of Markdown link to note.
-The %N$s notation is for `format' as the supplied arguments are
-IDENTIFIER and TITLE, in this order.")
+The %N$s notation used in the default value is for `format' as
+the supplied arguments are IDENTIFIER and TITLE, in this order.")
+
+(define-obsolete-variable-alias
+ 'denote-link--format-id-only
+ 'denote-id-only-link-format
+ "1.2.0")
-(defconst denote-link--format-id-only "[[denote:%s]]"
- "Format of identifier-only link to note.")
+(defvar denote-id-only-link-format "[[denote:%s]]"
+ "Format of identifier-only link to note.
+The value is passed to `format' with IDENTIFIER as its sole
+argument.")
(defconst denote-link--regexp-org
(concat "\\[\\[" "denote:" "\\(?1:" denote-id-regexp "\\)" "]" "\\[.*?]]"))
@@ -2408,11 +2426,11 @@ title."
;; Includes backup files. Maybe we can remove them?
(let ((current-file-ext (file-name-extension current-file)))
(cond
- (id-only denote-link--format-id-only)
+ (id-only denote-id-only-link-format)
((string= current-file-ext "md")
- denote-link--format-markdown)
+ denote-md-link-format)
;; Plain text also uses [[denote:ID][TITLE]]
- (t denote-link--format-org))))
+ (t denote-org-link-format))))
(defun denote-link--file-type-regexp (file)
"Return link regexp based on FILE format."
@@ -2426,7 +2444,7 @@ If DESCRIPTION is non-nil, use it as link description
instead of
FILE's title."
(let* ((file-id (denote-retrieve-filename-identifier file))
(file-type (denote-filetype-heuristics file))
- (file-title (unless (string= pattern denote-link--format-id-only)
+ (file-title (unless (string= pattern denote-id-only-link-format)
(or description (denote--retrieve-title-or-filename
file file-type)))))
(format pattern file-id file-title)))