[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 19164364a8 06/17: Obsolete denote-create-unique-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 19164364a8 06/17: Obsolete denote-create-unique-file-identifier |
Date: |
Sun, 10 Nov 2024 00:57:51 -0500 (EST) |
branch: externals/denote
commit 19164364a88f4a19df86f8ca9c0de38c10cb6d04
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Obsolete denote-create-unique-file-identifier
---
README.org | 22 ++--------------------
denote.el | 54 +++++++++++++++++++-----------------------------------
2 files changed, 21 insertions(+), 55 deletions(-)
diff --git a/README.org b/README.org
index 419c450880..34ddc9d132 100644
--- a/README.org
+++ b/README.org
@@ -5751,8 +5751,8 @@ might change them without further notice.
#+findex: denote-retrieve-filename-identifier
+ Function ~denote-retrieve-filename-identifier~ :: Extract identifier
- from =FILE= name, if present, else return nil. To create a new one, refer
to the
- ~denote-create-unique-file-identifier~ function.
+ from =FILE= name, if present, else return nil. To create a new one
+ from a date, refer to the ~denote-get-identifier~ function.
#+findex: denote-retrieve-filename-title
+ Function ~denote-retrieve-filename-title~ :: Extract Denote title
@@ -5778,24 +5778,6 @@ might change them without further notice.
identifier using ~denote-id-format~. If =DATE= is nil, return an empty
string as the identifier.
-#+findex: denote-create-unique-file-identifier
-+ Function ~denote-create-unique-file-identifier~ :: Create a new unique
- =FILE= identifier. Test that the identifier is unique among
- =USED-IDS=. The conditions are as follows:
-
- - If =DATE= is non-nil, invoke ~denote-prompt-for-date-return-id~.
-
- - If =DATE= is nil, use the file attributes to determine the last
- modified date and format it as an identifier.
-
- - As a fallback, derive an identifier from the current time.
-
- With optional =USED-IDS= as nil, test that the identifier is unique
- among all files and buffers in variable ~denote-directory~.
-
- To only return an existing identifier, refer to the function
- ~denote-retrieve-filename-identifier~.
-
#+findex: denote-retrieve-front-matter-title-value
+ Function ~denote-retrieve-front-matter-title-value~ :: Return title value
from
=FILE= front matter per =FILE-TYPE=.
diff --git a/denote.el b/denote.el
index 92e705ae02..519e94aaa7 100644
--- a/denote.el
+++ b/denote.el
@@ -1852,8 +1852,8 @@ is a list of strings. FILETYPE is one of the values of
variable
(defun denote-retrieve-filename-identifier (file)
"Extract identifier from FILE name, if present, else return nil.
-To create a new one, refer to the function
-`denote-create-unique-file-identifier'."
+To create a new one from a date, refer to the function
+`denote-get-identifier'."
(let ((filename (file-name-nondirectory file)))
(cond ((string-match (concat "\\`" denote-id-regexp) filename)
(match-string-no-properties 0 filename))
@@ -1879,27 +1879,10 @@ If DATE is nil, return an empty string as the
identifier."
This variable should be set only for the duration of a command.
It should stay nil otherwise.")
-(defun denote-create-unique-file-identifier (file &optional date)
- "Generate a unique identifier for FILE.
-
-The conditions are as follows:
-
-- If optional DATE is non-nil pass it to `denote-get-identifier'.
- DATE will have to conform with `denote-valid-date-p'. If it
- does not, return an error.
-
-- If optional DATE is nil, use the file attributes to determine
- the last modified date and format it as an identifier.
-
-- As a fallback, derive an identifier from the current time.
-
-To only return an existing identifier, refer to the function
-`denote-retrieve-filename-identifier'."
- (let ((id (cond
- (date (denote-get-identifier date))
- ((denote--file-attributes-time file))
- (t (denote-get-identifier (current-time))))))
- (denote--find-first-unused-id id)))
+(define-obsolete-function-alias
+ 'denote-create-unique-file-identifier
+ 'denote-get-identifier
+ "3.2.0")
(defun denote-retrieve-filename-keywords (file)
"Extract keywords from FILE name, if present, else return nil.
@@ -2923,12 +2906,6 @@ Org. Otherwise, use the function `denote-file-type' to
return the type."
'org
(denote-file-type file)))
-(defun denote--file-attributes-time (file)
- "Return `file-attribute-modification-time' of FILE as identifier."
- (when-let* ((file-modification-time
- (file-attribute-modification-time (file-attributes file))))
- (denote-get-identifier file-modification-time)))
-
(defun denote--revert-dired (buf)
"Revert BUF if appropriate.
Do it if BUF is in Dired mode and is either part of the variable
@@ -3126,10 +3103,11 @@ Respect `denote-rename-confirmations',
`denote-save-buffers' and
(keywords (denote-keywords-sort keywords))
(directory (file-name-directory file))
(extension (file-name-extension file :include-period))
- ;; TODO: For now, we cannot change the identifier. We retrieve
- ;; the current one or generate a new one with DATE, if non-nil.
- (id (or (denote-retrieve-filename-identifier file)
- (denote-create-unique-file-identifier file date)))
+ (old-id (or (denote-retrieve-filename-identifier file) ""))
+ (id (denote-get-identifier date))
+ (id (if (or (string-empty-p id) (string= old-id id))
+ id
+ (denote--find-first-unused-id id)))
(new-name (denote-format-file-name directory id keywords title
extension signature))
(max-mini-window-height denote-rename-max-mini-window-height))
(when (file-regular-p new-name)
@@ -3159,7 +3137,7 @@ It is meant to be combined with `denote--rename-file' to
create
renaming commands."
(let* ((file-in-prompt (propertize (file-relative-name file) 'face
'denote-faces-prompt-current-name))
(file-type (denote-filetype-heuristics file))
- (date (denote-retrieve-filename-identifier file))
+ (date (denote-valid-date-p (denote-retrieve-filename-identifier
file)))
(title (or (denote-retrieve-title-or-filename file file-type) ""))
(keywords (denote-extract-keywords-from-path file))
(signature (or (denote-retrieve-filename-signature file) "")))
@@ -3184,7 +3162,13 @@ renaming commands."
;; `denote-prompts`, like other components (ie remove this
;; condition).
(unless (denote-file-has-identifier-p file)
- (setq date (denote-date-prompt))))))
+ (setq date (denote-valid-date-p (denote-date-prompt)))))))
+ ;; TODO: If the date is still nil, use the modification time of the file
or the current time.
+ ;; This is done because the absence of an identifier is not supported yet.
+ ;; Once we do, this should be removed or made optional with a user option.
+ (setq date (or date
+ (file-attribute-modification-time (file-attributes file))
+ (current-time)))
(list title keywords signature date)))
;;;###autoload
- [elpa] externals/denote updated (b788f7c3d7 -> 344e1a65bb), ELPA Syncer, 2024/11/10
- [elpa] externals/denote a5ecae13cf 04/17: Obsolete denote-parse-date, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 75d4ba1f7e 16/17: Do not add an empty identifier in denote--used-ids, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 9d13ef9082 09/17: Allow identifiers with other formats in denote-format-file-name, ELPA Syncer, 2024/11/10
- [elpa] externals/denote b2ddfc0d3a 02/17: Rename denote--date to denote--format-front-matter-date, ELPA Syncer, 2024/11/10
- [elpa] externals/denote cf4ce27580 01/17: Do not check identifier format in retrieval functions of file name components, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 7cd1461e4b 03/17: Add comment in denote-valid-date-p, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 19164364a8 06/17: Obsolete denote-create-unique-file-identifier,
ELPA Syncer <=
- [elpa] externals/denote a204554b8d 05/17: denote-get-identifier returns an empty string when date is nil, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 89b0525475 07/17: Do not check nil identifier in denote-format-file-name, ELPA Syncer, 2024/11/10
- [elpa] externals/denote b0b19b9ad1 08/17: Allow empty identifier in denote-format-file-name, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 4a2caa43ef 13/17: Handle id in denote--creation-prepare-note-data, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 8f8026bf56 11/17: Change denote and denote-org-capture to make them ready to handle empty identifiers, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 5e21143e22 10/17: Update docstring of denote-format-file-name, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 344e1a65bb 17/17: Merge pull request #476 from jeanphilippegg/date-functions, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 722c1f3934 14/17: Add variable denote-generate-identifier-automatically, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 8b005edd2d 12/17: Make some front matter functions ready to handle nil dates and empty identifiers, ELPA Syncer, 2024/11/10
- [elpa] externals/denote 427ebfed8e 15/17: Add date parameter to denote--add-front-matter, ELPA Syncer, 2024/11/10