diff options
author | Joost Kremers <joostkremers@fastmail.fm> | 2015-01-26 00:25:57 +0100 |
---|---|---|
committer | Joost Kremers <joostkremers@fastmail.fm> | 2015-01-26 00:25:57 +0100 |
commit | 05de5804825539385974f8f31181ca567eb1cc85 (patch) | |
tree | 74143ea7bc90217965dde4b767137b1197177b51 /ebib-keywords.el | |
parent | e164cb45bac5a173189d63df098862b2eff7f125 (diff) |
Trim keywords in ebib--keywords-to-list
Diffstat (limited to 'ebib-keywords.el')
-rw-r--r-- | ebib-keywords.el | 11 |
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. |