[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote e24c9ddc12 2/2: Merge pull request #36 from jean
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote e24c9ddc12 2/2: Merge pull request #36 from jeanphilippegg/allow-no-keywords |
Date: |
Tue, 5 Jul 2022 23:57:31 -0400 (EDT) |
branch: externals/denote
commit e24c9ddc123be77a635d3420797536b2e5aa4e41
Merge: f10fe51fcd f9668dc362
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: GitHub <noreply@github.com>
Merge pull request #36 from jeanphilippegg/allow-no-keywords
Clean keywords usage in order to support no keywords
---
denote.el | 53 +++++++++++++----------------------------------------
1 file changed, 13 insertions(+), 40 deletions(-)
diff --git a/denote.el b/denote.el
index 94b235efca..e0018c0dc1 100644
--- a/denote.el
+++ b/denote.el
@@ -316,15 +316,9 @@ trailing hyphen."
(defun denote--sluggify-keywords (keywords)
"Sluggify KEYWORDS."
- (cond
- ((listp keywords)
- (if denote-allow-multi-word-keywords
- (mapcar #'denote--sluggify keywords)
- (mapcar #'denote--sluggify-and-join keywords)))
- (t
- (if denote-allow-multi-word-keywords
- (denote--sluggify keywords)
- (denote--sluggify-and-join keywords)))))
+ (if denote-allow-multi-word-keywords
+ (mapcar #'denote--sluggify keywords)
+ (mapcar #'denote--sluggify-and-join keywords)))
(defun denote--file-empty-p (file)
"Return non-nil if FILE is empty."
@@ -445,34 +439,19 @@ In the case of multiple entries, those are separated by
the
output is sorted with `string-lessp'."
(let ((choice (denote--keywords-crm (denote-keywords))))
(setq denote-last-keywords
- (cond
- ((null choice)
- "")
- ((= (length choice) 1)
- (car choice))
- ((if denote-sort-keywords
- (sort choice #'string-lessp)
- choice))))))
+ (if denote-sort-keywords
+ (sort choice #'string-lessp)
+ choice))))
(defun denote--keywords-combine (keywords)
"Format KEYWORDS output of `denote--keywords-prompt'."
- (if (and (> (length keywords) 1)
- (not (stringp keywords)))
- (mapconcat #'downcase keywords "_")
- keywords))
+ (mapconcat #'downcase keywords "_"))
(defun denote--keywords-add-to-history (keywords)
"Append KEYWORDS to `denote--keyword-history'."
- (if-let ((listed (listp keywords))
- (length (length keywords)))
- (cond
- ((and listed (= length 1))
- (car keywords))
- ((and listed (> length 1))
- (mapc (lambda (kw)
- (add-to-history 'denote--keyword-history kw))
- (delete-dups keywords))))
- (add-to-history 'denote--keyword-history keywords)))
+ (mapc (lambda (kw)
+ (add-to-history 'denote--keyword-history kw))
+ (delete-dups keywords)))
;;;; New note
@@ -513,15 +492,9 @@ With optional TYPE, format the keywords accordingly (this
might
be `toml' or, in the future, some other spec that needss special
treatment)."
(let ((kw (denote--sluggify-keywords keywords)))
- (cond
- ((and (> (length kw) 1) (not (stringp kw)))
- (pcase type
- ('toml (format "[%s]" (denote--map-quote-downcase kw)))
- (_ (mapconcat #'downcase kw " "))))
- (t
- (pcase type
- ('toml (format "[%S]" (downcase kw)))
- (_ (downcase kw)))))))
+ (pcase type
+ ('toml (format "[%s]" (denote--map-quote-downcase kw)))
+ (_ (mapconcat #'downcase kw " ")))))
(defvar denote-toml-front-matter
"+++
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/denote e24c9ddc12 2/2: Merge pull request #36 from jeanphilippegg/allow-no-keywords,
ELPA Syncer <=