branch: externals/denote
commit 2d6131085cf249fea3075fab8e69d93cb615aad2
Author: Jean-Philippe Gagné Guay <[email protected]>
Commit: Jean-Philippe Gagné Guay <[email protected]>
Simplify denote-filetype-heuristics
---
denote.el | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/denote.el b/denote.el
index 58905db16b..a18cde144f 100644
--- a/denote.el
+++ b/denote.el
@@ -2141,22 +2141,18 @@ If no file types in `denote-file-types' has the file
extension,
the file type is assumed to be the first of `denote-file-types'."
(if (denote--file-type-org-capture-p)
'org
- (let* ((file-type)
- (extension (denote-get-file-extension-sans-encryption file))
+ (let* ((extension (denote-get-file-extension-sans-encryption file))
(types (denote--file-types-with-extension extension)))
(cond ((not types)
- (setq file-type (caar denote-file-types)))
+ (caar denote-file-types))
((= (length types) 1)
- (setq file-type (caar types)))
+ (caar types))
(t
- (if-let ((found-type
- (seq-find
- (lambda (type)
- (denote--regexp-in-file-p (plist-get (cdr type)
:title-key-regexp) file))
- types)))
- (setq file-type (car found-type))
- (setq file-type (caar types)))))
- file-type)))
+ (or (car (seq-find
+ (lambda (type)
+ (denote--regexp-in-file-p (plist-get (cdr type)
:title-key-regexp) file))
+ types))
+ (caar types)))))))
(defun denote--file-attributes-time (file)
"Return `file-attribute-modification-time' of FILE as identifier."