summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoost Kremers <joostkremers@fastmail.fm>2017-03-11 01:11:52 +0100
committerJoost Kremers <joostkremers@fastmail.fm>2017-03-11 01:11:52 +0100
commit4f7825ba65ed3262660f4caba38ecb9d08cad5c4 (patch)
treeea5c47ce43363eeac5a7f6065c7623f98f203191
parentfef0748ee20e00f1ca4c6e5a219aa11dd385890b (diff)
Add expand-strings argument to parsebib-collect-strings.
-rw-r--r--parsebib.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/parsebib.el b/parsebib.el
index 36afb2a..a01ef2c 100644
--- a/parsebib.el
+++ b/parsebib.el
@@ -323,11 +323,13 @@ value."
(let ((field-contents (parsebib--parse-value limit strings)))
(cons field-type field-contents)))))))
-(defun parsebib-collect-strings (&optional hash)
+(defun parsebib-collect-strings (&optional hash expand-strings)
"Collect all @String definitions in the current buffer.
Return value is a hash with the abbreviations as keys and the
expansions as values. If HASH is a hash table with test function
-`equal', it is used to store the @String definitions."
+`equal', it is used to store the @String definitions. If
+EXPAND-STRINGS is non-nil, @String expansions are expanded
+themselves using the @String definitions already stored in HASH."
(save-excursion
(goto-char (point-min))
(let* ((res (if (and (hash-table-p hash)
@@ -338,7 +340,7 @@ expansions as values. If HASH is a hash table with test function
(cl-loop for item = (parsebib-find-next-item)
while item do
(when (cl-equalp item "string")
- (setq string (parsebib-read-string))
+ (setq string (parsebib-read-string nil (if expand-strings hash)))
(puthash (car string) (cdr string) res)))
hash)))