[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote a090eb007c 04/11: Add optional parameter no-erro
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote a090eb007c 04/11: Add optional parameter no-error to denote-retrieve-filename-identifier |
Date: |
Sun, 8 Oct 2023 03:57:49 -0400 (EDT) |
branch: externals/denote
commit a090eb007c772adf32975ad791c1c17baa12b44f
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Add optional parameter no-error to denote-retrieve-filename-identifier
---
denote.el | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/denote.el b/denote.el
index 3f7fbab817..b29190702a 100644
--- a/denote.el
+++ b/denote.el
@@ -1334,15 +1334,18 @@ contain the newline."
;;;; Front matter or content retrieval functions
-(defun denote-retrieve-filename-identifier (file)
+(defun denote-retrieve-filename-identifier (file &optional no-error)
"Extract identifier from FILE name.
-To return an existing identifier or create a new one, refer to
-the function `denote-retrieve-or-create-file-identifier'."
- (if (denote-file-has-identifier-p file)
- (progn
- (string-match denote-id-regexp file)
- (match-string 0 file))
- (error "Cannot find `%s' as a file with a Denote identifier" file)))
+If NO-ERROR is nil and an identifier is not found, return an
+error, else return nil.
+
+To create a new one, refer to the function
+`denote-create-unique-file-identifier'."
+ (let ((file-name (file-name-nondirectory file)))
+ (if (string-match (concat "\\`" denote-id-regexp) file-name)
+ (match-string-no-properties 0 file-name)
+ (when (not no-error)
+ (error "Cannot find `%s' as a file with a Denote identifier" file)))))
(define-obsolete-function-alias
'denote--retrieve-filename-identifier
- [elpa] externals/denote updated (b060dc3548 -> 05a18e36fc), ELPA Syncer, 2023/10/08
- [elpa] externals/denote 8c140344e0 03/11: Remove 'denote-barf-duplicate-id' and make 'denote' avoid duplicate ids, ELPA Syncer, 2023/10/08
- [elpa] externals/denote c12d4fdb21 02/11: Add 'denote--get-all-used-ids' and 'denote--find-first-unused-id', ELPA Syncer, 2023/10/08
- [elpa] externals/denote 89237ceafd 01/11: Remove files parameter, ELPA Syncer, 2023/10/08
- [elpa] externals/denote a090eb007c 04/11: Add optional parameter no-error to denote-retrieve-filename-identifier,
ELPA Syncer <=
- [elpa] externals/denote 03b510f640 05/11: Remove function denote-retrieve-or-create-filename-identifier, ELPA Syncer, 2023/10/08
- [elpa] externals/denote 05a18e36fc 11/11: Fix typo in denote-link-return-backlinks, ELPA Syncer, 2023/10/08
- [elpa] externals/denote c9d024ec30 07/11: Update README.org with new functions, ELPA Syncer, 2023/10/08
- [elpa] externals/denote c5e73c2c99 08/11: Use non obsolete variables, ELPA Syncer, 2023/10/08
- [elpa] externals/denote 1d0eebf7d3 10/11: Merge pull request #159 from jeanphilippegg/duplicate-ids, ELPA Syncer, 2023/10/08
- [elpa] externals/denote fe0659b2f0 09/11: Mention 'denote-link-with-signature' in 'denote-prompts' documentation, ELPA Syncer, 2023/10/08
- [elpa] externals/denote fd880f15a5 06/11: Remove denote--increment-identifier and denote--return-new-identifier-if-duplicate, ELPA Syncer, 2023/10/08