summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoost Kremers <joostkremers@fastmail.fm>2017-03-11 21:40:14 +0100
committerJoost Kremers <joostkremers@fastmail.fm>2017-03-11 21:40:14 +0100
commitfd30a8e7cbb76e5ec0ee2bc7af7ffc654eca897f (patch)
tree6f2920343b9ed71ca0031ca1138b1ab6faf18203
parente9a5dcd7627bde789366bc97e9e25edf226d49fa (diff)
Improve `parsebib--expand-strings'.
- replace sequences of white space (incl. newlines and tabs) with a single space. - return the abbrev itself if no expansion is found.
-rw-r--r--parsebib.el12
1 files changed, 7 insertions, 5 deletions
diff --git a/parsebib.el b/parsebib.el
index 552c4d1..f1d6526 100644
--- a/parsebib.el
+++ b/parsebib.el
@@ -168,11 +168,13 @@ if non-nil."
"Replace STRINGS with expansions in ABBREVS."
(mapcar (lambda (str)
(or (gethash str abbrevs)
- (cond
- ((string-match "\\`[\"{]\\(.*?\\)[\"}]\\'" str)
- (match-string 1 str))
- ((string-match "[0-9]+" str)
- str))))
+ (progn (setq str (replace-regexp-in-string "[ \t\n\f]+" " " str))
+ (cond
+ ((string-match "\\`[\"{]\\(.*?\\)[\"}]\\'" str)
+ (match-string 1 str))
+ ((string-match "[0-9]+" str)
+ str)
+ (t str)))))
strings))
;;;;;;;;;;;;;;;;;;;