1793 |
(goto-char (point-min)) |
(goto-char (point-min)) |
1794 |
(let* ((fields-alist (bibtex-parse-entry)) |
(let* ((fields-alist (bibtex-parse-entry)) |
1795 |
(case-fold-search t) |
(case-fold-search t) |
1796 |
(field (bibtex-assoc-regexp "\\(OPT\\)?crossref\\>" |
(field (bibtex-assoc-regexp "\\`\\(OPT\\)?crossref\\'" |
1797 |
fields-alist))) |
fields-alist))) |
1798 |
(setq crossref-key (and field |
(setq crossref-key (and field |
1799 |
(not (string-match bibtex-empty-field-re |
(not (string-match bibtex-empty-field-re |
1807 |
(when (nth 3 rfield) ; we should have an alternative |
(when (nth 3 rfield) ; we should have an alternative |
1808 |
(setq alternatives-there t |
(setq alternatives-there t |
1809 |
field (bibtex-assoc-regexp |
field (bibtex-assoc-regexp |
1810 |
(concat "\\(ALT\\)?" (car rfield) "\\>") |
(concat "\\`\\(ALT\\)?" (car rfield) "\\'") |
1811 |
fields-alist)) |
fields-alist)) |
1812 |
(if (and field |
(if (and field |
1813 |
(not (string-match bibtex-empty-field-re |
(not (string-match bibtex-empty-field-re |
2317 |
;; user has aborted by typing a key --> return `aborted' |
;; user has aborted by typing a key --> return `aborted' |
2318 |
(throw 'userkey 'aborted)) |
(throw 'userkey 'aborted)) |
2319 |
(setq key (bibtex-reference-key-in-string bounds)) |
(setq key (bibtex-reference-key-in-string bounds)) |
2320 |
(if (not (assoc-string key strings t)) |
(if (not (assoc key strings)) |
2321 |
(push (cons key (bibtex-text-in-string bounds t)) |
(push (cons key (bibtex-text-in-string bounds t)) |
2322 |
strings)) |
strings)) |
2323 |
(goto-char (bibtex-end-of-text-in-string bounds))) |
(goto-char (bibtex-end-of-text-in-string bounds))) |
2722 |
(let* ((fields-alist (bibtex-parse-entry)) |
(let* ((fields-alist (bibtex-parse-entry)) |
2723 |
(field-list (bibtex-field-list |
(field-list (bibtex-field-list |
2724 |
(substring (cdr (assoc "=type=" fields-alist)) |
(substring (cdr (assoc "=type=" fields-alist)) |
2725 |
1)))) ; don't want @ |
1))) ; don't want @ |
2726 |
|
(case-fold-search t)) |
2727 |
(dolist (field (car field-list)) |
(dolist (field (car field-list)) |
2728 |
(unless (assoc-string (car field) fields-alist t) |
(unless (bibtex-assoc-regexp (concat "\\`\\(ALT\\)?" (car field) "\\'") |
2729 |
|
fields-alist) |
2730 |
(bibtex-make-field field))) |
(bibtex-make-field field))) |
2731 |
(dolist (field (cdr field-list)) |
(dolist (field (cdr field-list)) |
2732 |
(unless (assoc-string (car field) fields-alist t) |
(unless (bibtex-assoc-regexp (concat "\\`\\(OPT\\)?" (car field) "\\'") |
2733 |
|
fields-alist) |
2734 |
(bibtex-make-optional-field field)))))) |
(bibtex-make-optional-field field)))))) |
2735 |
|
|
2736 |
(defun bibtex-parse-entry () |
(defun bibtex-parse-entry () |
2737 |
"Parse entry at point, return an alist. |
"Parse entry at point, return an alist. |
2738 |
The alist elements have the form (FIELD . TEXT), where FIELD can also be |
The alist elements have the form (FIELD . TEXT), where FIELD can also be |
2739 |
the special strings \"=type=\" and \"=key=\". |
the special strings \"=type=\" and \"=key=\". For the FIELD \"=key=\" |
2740 |
Move point to the end of the last field." |
TEXT may be nil. Move point to the end of the last field." |
2741 |
(let (alist bounds) |
(let (alist bounds) |
2742 |
(when (looking-at bibtex-entry-head) |
(when (looking-at bibtex-entry-maybe-empty-head) |
2743 |
(push (cons "=type=" (match-string bibtex-type-in-head)) alist) |
(push (cons "=type=" (match-string bibtex-type-in-head)) alist) |
2744 |
(push (cons "=key=" (match-string bibtex-key-in-head)) alist) |
(push (cons "=key=" (match-string bibtex-key-in-head)) alist) |
2745 |
(goto-char (match-end bibtex-key-in-head)) |
(goto-char (match-end 0)) |
2746 |
(while (setq bounds (bibtex-parse-field bibtex-field-name)) |
(while (setq bounds (bibtex-parse-field bibtex-field-name)) |
2747 |
(push (cons (bibtex-name-in-field bounds) |
(push (cons (bibtex-name-in-field bounds) |
2748 |
(bibtex-text-in-field-bounds bounds)) |
(bibtex-text-in-field-bounds bounds)) |