summaryrefslogtreecommitdiff
path: root/ebib-keywords.el
diff options
context:
space:
mode:
authorJoost Kremers <joostkremers@fastmail.fm>2015-01-26 00:25:57 +0100
committerJoost Kremers <joostkremers@fastmail.fm>2015-01-26 00:25:57 +0100
commit05de5804825539385974f8f31181ca567eb1cc85 (patch)
tree74143ea7bc90217965dde4b767137b1197177b51 /ebib-keywords.el
parente164cb45bac5a173189d63df098862b2eff7f125 (diff)
Trim keywords in ebib--keywords-to-list
Diffstat (limited to 'ebib-keywords.el')
-rw-r--r--ebib-keywords.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/ebib-keywords.el b/ebib-keywords.el
index e1a59c6..539e2d8 100644
--- a/ebib-keywords.el
+++ b/ebib-keywords.el
@@ -135,11 +135,12 @@ Also automatically remove duplicates."
"Convert STR to a list of keywords.
STR should be a string containing keywords separated by
`ebib-keywords-separator'."
- ;; TODO The strings should really be trimmed. In Emacs 24.4,
- ;; `split-string' has an additional argument that does this, but that's
- ;; not available in 24.3. An alternative would be `s-trim' from the `s'
- ;; library.
- (split-string str (regexp-quote ebib-keywords-separator) t))
+ ;; TODO I use `replace-regexp-in-string' to trim the individual strings.
+ ;; In Emacs 24.4, `split-string' has an additional argument that does
+ ;; this, but that's not available in 24.3. An alternative would be
+ ;; `s-trim' from the `s' library.
+ (--map (replace-regexp-in-string "\\`[[:space:]]*\\(.*?\\)[[:space:]]*\\'" "\\1" it t)
+ (split-string str (regexp-quote ebib-keywords-separator) t)))
(defun ebib--keywords-sort (keywords)
"Sort the KEYWORDS string, remove duplicates, and return it as a string.