[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 6438bc7965 3/7: Check buffer file names in denot
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 6438bc7965 3/7: Check buffer file names in denote--id-exists-p |
Date: |
Mon, 18 Jul 2022 01:57:39 -0400 (EDT) |
branch: externals/denote
commit 6438bc79650ae7831895cb765ecb12addebb8609
Author: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Commit: Jean-Philippe Gagné Guay <jeanphilippe150@gmail.com>
Check buffer file names in denote--id-exists-p
Add function denote--buffer-file-names
---
denote.el | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/denote.el b/denote.el
index 8eb5e2ebb5..c87f5aa141 100644
--- a/denote.el
+++ b/denote.el
@@ -825,6 +825,19 @@ is set to \\'(file-type title keywords)."
"Return DATE if parsed by `date-to-time', else signal error."
(date-to-time date))
+(defun denote--buffer-file-names ()
+ "Return file names of active buffers."
+ (mapcar
+ (lambda (name)
+ (file-name-nondirectory name))
+ (delq nil
+ (mapcar
+ (lambda (buf)
+ (buffer-file-name buf))
+ (buffer-list)))))
+
+(declare-function cl-some "cl-extra" (cl-pred cl-seq &rest cl-rest))
+
;; This should only be relevant for `denote-date', otherwise the
;; identifier is always unique (we trust that no-one writes multiple
;; notes within fractions of a second).
@@ -832,7 +845,11 @@ is set to \\'(file-type title keywords)."
"Return non-nil if IDENTIFIER already exists.
NO-CHECK-CURRENT passes the appropriate flag to
`denote--directory-files-matching-regexp'."
- (denote--directory-files-matching-regexp identifier no-check-current))
+ (or (cl-some (lambda (file)
+ (string-match-p (concat "\\`" identifier) file))
+ (denote--buffer-file-names))
+ (denote--directory-files-matching-regexp
+ (concat "\\`" identifier) no-check-current)))
(defun denote--barf-duplicate-id (identifier)
"Throw a user-error if IDENTIFIER already exists else return t."
- [elpa] externals/denote updated (c9a01a3718 -> 680dbdf6b2), ELPA Syncer, 2022/07/18
- [elpa] externals/denote 0cddca8735 4/7: Remove no-check-current parameter from denote--directory-files-matching-regexp, ELPA Syncer, 2022/07/18
- [elpa] externals/denote 6438bc7965 3/7: Check buffer file names in denote--id-exists-p,
ELPA Syncer <=
- [elpa] externals/denote 1d89fa0d33 2/7: Use string-prefix-p in denote--dir-in-denote-directory-p, ELPA Syncer, 2022/07/18
- [elpa] externals/denote c5bba5fef1 5/7: Fix denote with subdirectories, ELPA Syncer, 2022/07/18
- [elpa] externals/denote a80ffc1425 1/7: Rework denote--prepare-note, ELPA Syncer, 2022/07/18
- [elpa] externals/denote 680dbdf6b2 7/7: Merge pull request #55 from jeanphilippegg/denote--prepare-notes, ELPA Syncer, 2022/07/18
- [elpa] externals/denote f4fae528c3 6/7: Return only Denote files in denote--buffer-file-names, ELPA Syncer, 2022/07/18