[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote 7b719e6274 152/355: Add user option to disable m
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote 7b719e6274 152/355: Add user option to disable multi-word keywords |
Date: |
Sun, 26 Jun 2022 23:58:16 -0400 (EDT) |
branch: externals/denote
commit 7b719e6274d0371173a70182ec74661d45bc6fd4
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Add user option to disable multi-word keywords
---
README.org | 9 +++++++--
denote.el | 21 ++++++++++++++++++++-
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/README.org b/README.org
index c68e16ec17..b86e939d92 100644
--- a/README.org
+++ b/README.org
@@ -136,15 +136,20 @@ automatically gets downcased and hyphenated. An entry
about "Economics
in the Euro Area" produces an =economics-in-the-euro-area= string for
the =TITLE= of the file name.
+#+vindex: denote-allow-multi-word-keywords
The =KEYWORDS= field consists of one or more entries demarcated by an
underscore (the separator is inserted automatically). Each keyword is a
string provided by the user at the relevant prompt which broadly
describes the contents of the entry. Keywords that need to be more than
one-word-long must be written with hyphens: any other character, such as
-spaces or the plus sign is converted into a hyphen. So when
-=emacs_library= appears in a file name, it is interpreted as two
+spaces or the plus sign is automatically converted into a hyphen. So
+when =emacs_library= appears in a file name, it is interpreted as two
distinct keywords, whereas =emacs-library= is one keyword. This is
reflected in how the keywords are recorded in the note
([[#h:13218826-56a5-482a-9b91-5b6de4f14261][Front matter]]).
+While Denote supports multi-word keywords by default, the user option
+~denote-allow-multi-word-keywords~ can be set to nil to forcibly join
+all words into one, meaning that an input of =word1 word2= will be
+written as =word1word2=.
#+vindex: denote-file-type
The =EXTENSION= is the file type. By default, it is =.org= (~org-mode~)
diff --git a/denote.el b/denote.el
index f1bb86434f..cd96e27952 100644
--- a/denote.el
+++ b/denote.el
@@ -112,6 +112,20 @@ If nil, show the keywords in their given order."
:group 'denote
:type 'boolean)
+(defcustom denote-allow-multi-word-keywords t
+ "If non-nil keywords can consist of multiple words.
+Words are automatically separated by a hyphen when using the
+`denote' command or related. The hyphen is the only legal
+character---no spaces, no other characters. If, for example, the
+user types <word1+word2> or <word1 word2>, it is converted to
+<word1-word2>.
+
+When nil, do not allow keywords to consist of multiple words.
+Reduce them to a single word, such as by turning <word1+word2> or
+<word1 word2> into <word1word2>."
+ :group 'denote
+ :type 'boolean)
+
(defcustom denote-file-type nil
"The file type extension for new notes.
@@ -218,7 +232,12 @@ trailing hyphen."
(defun denote--sluggify (str)
"Make STR an appropriate slug for file names and related."
- (downcase (denote--slug-hyphenate (denote--slug-no-punct str))))
+ (downcase
+ (if denote-allow-multi-word-keywords
+ (denote--slug-hyphenate (denote--slug-no-punct str))
+ (replace-regexp-in-string
+ "-" ""
+ (denote--slug-hyphenate (denote--slug-no-punct str))))))
(defun denote--sluggify-keywords (keywords)
"Sluggify KEYWORDS."
- [elpa] externals/denote a107fbf5d7 120/355: Make minor tweaks in the manual, (continued)
- [elpa] externals/denote a107fbf5d7 120/355: Make minor tweaks in the manual, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 254a6cd0f3 112/355: Update date function; enforce RFC3339 when needed, ELPA Syncer, 2022/06/27
- [elpa] externals/denote f1f9f757ef 109/355: Include markdown-toml sample in the manual, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 24371b4c86 129/355: fix: Update the identifier regexp to recognize TOML identifier too, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 0cb5c9f06e 122/355: Simplify attribution comment to ox-hugo, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 79fbe2493b 135/355: Merge pull request #11 from kaushalmodi/update-identifier-regexp, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 808a2c29f9 140/355: Acknowledge Peter Povinec for file-naming refinements, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 083b3bfc89 144/355: Use better example for file renaming, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 561553db8e 132/355: fix: Use the correct match subgroup in `denote-link--find-value`, ELPA Syncer, 2022/06/27
- [elpa] externals/denote e1c18f5f57 136/355: Remove potentially bad advice from the manual, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 7b719e6274 152/355: Add user option to disable multi-word keywords,
ELPA Syncer <=
- [elpa] externals/denote 25fa79e8d9 146/355: Refine denote-retrieve internals, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 0165b00ddb 145/355: Use only denote-retrieve functions in denote-link, ELPA Syncer, 2022/06/27
- [elpa] externals/denote f57e9c5c9f 165/355: Change internal variable symbols for consistency, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 8565d36e7d 161/355: Add note in the manual about journal/diary, ELPA Syncer, 2022/06/27
- [elpa] externals/denote be58aec5db 163/355: Include journal sample that prompts for TITLE, ELPA Syncer, 2022/06/27
- [elpa] externals/denote d66312e517 172/355: Fix regression in file extension caused by f57e9c5, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 553c10a9cc 178/355: Tweak doc string, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 8e6e2736dc 174/355: Add generic denote-link-find-file, ELPA Syncer, 2022/06/27
- [elpa] externals/denote b54dd3404d 186/355: Tweak doc string, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 5195f13f55 197/355: Add optional absolute for denote--directory-files, ELPA Syncer, 2022/06/27