1502 |
(save-excursion |
(save-excursion |
1503 |
(if (or (and (not bibtex-sort-ignore-string-entries) |
(if (or (and (not bibtex-sort-ignore-string-entries) |
1504 |
(string-equal "string" (downcase entry-type))) |
(string-equal "string" (downcase entry-type))) |
1505 |
(assoc-ignore-case entry-type bibtex-entry-field-alist)) |
(assoc-string entry-type bibtex-entry-field-alist t)) |
1506 |
(funcall fun key beg end))) |
(funcall fun key beg end))) |
1507 |
(goto-char end))))) |
(goto-char end))))) |
1508 |
|
|
1771 |
(re-search-forward bibtex-entry-type) |
(re-search-forward bibtex-entry-type) |
1772 |
(let ((beg-type (1+ (match-beginning 0))) |
(let ((beg-type (1+ (match-beginning 0))) |
1773 |
(end-type (match-end 0))) |
(end-type (match-end 0))) |
1774 |
(setq entry-list (assoc-ignore-case (buffer-substring-no-properties |
(setq entry-list (assoc-string (buffer-substring-no-properties |
1775 |
beg-type end-type) |
beg-type end-type) |
1776 |
bibtex-entry-field-alist)) |
bibtex-entry-field-alist |
1777 |
|
t)) |
1778 |
|
|
1779 |
;; unify case of entry name |
;; unify case of entry name |
1780 |
(when (memq 'unify-case format) |
(when (memq 'unify-case format) |
1847 |
(if (memq 'opts-or-alts format) |
(if (memq 'opts-or-alts format) |
1848 |
(cond ((and empty-field |
(cond ((and empty-field |
1849 |
(or opt-alt |
(or opt-alt |
1850 |
(let ((field (assoc-ignore-case |
(let ((field (assoc-string |
1851 |
field-name req-field-list))) |
field-name req-field-list t))) |
1852 |
(or (not field) ; OPT field |
(or (not field) ; OPT field |
1853 |
(nth 3 field))))) ; ALT field |
(nth 3 field))))) ; ALT field |
1854 |
;; Either it is an empty ALT field. Then we have checked |
;; Either it is an empty ALT field. Then we have checked |
1919 |
;; if empty field, complain |
;; if empty field, complain |
1920 |
(if (and empty-field |
(if (and empty-field |
1921 |
(memq 'required-fields format) |
(memq 'required-fields format) |
1922 |
(assoc-ignore-case field-name req-field-list)) |
(assoc-string field-name req-field-list t)) |
1923 |
(error "Mandatory field `%s' is empty" field-name)) |
(error "Mandatory field `%s' is empty" field-name)) |
1924 |
|
|
1925 |
;; unify case of field name |
;; unify case of field name |
1926 |
(if (memq 'unify-case format) |
(if (memq 'unify-case format) |
1927 |
(let ((fname (car (assoc-ignore-case |
(let ((fname (car (assoc-string |
1928 |
field-name (append (nth 0 (nth 1 entry-list)) |
field-name |
1929 |
(nth 1 (nth 1 entry-list)) |
(append (nth 0 (nth 1 entry-list)) |
1930 |
bibtex-user-optional-fields))))) |
(nth 1 (nth 1 entry-list)) |
1931 |
|
bibtex-user-optional-fields) |
1932 |
|
t)))) |
1933 |
(if fname |
(if fname |
1934 |
(progn |
(progn |
1935 |
(delete-region beg-name end-name) |
(delete-region beg-name end-name) |
2261 |
;; This is a crossref. |
;; This is a crossref. |
2262 |
(buffer-substring-no-properties |
(buffer-substring-no-properties |
2263 |
(1+ (match-beginning 3)) (1- (match-end 3)))) |
(1+ (match-beginning 3)) (1- (match-end 3)))) |
2264 |
((assoc-ignore-case (bibtex-type-in-head) |
((assoc-string (bibtex-type-in-head) |
2265 |
bibtex-entry-field-alist) |
bibtex-entry-field-alist t) |
2266 |
;; This is an entry. |
;; This is an entry. |
2267 |
(match-string-no-properties bibtex-key-in-head))))) |
(match-string-no-properties bibtex-key-in-head))))) |
2268 |
(if (and (stringp key) |
(if (and (stringp key) |
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-ignore-case key strings)) |
(if (not (assoc-string key strings t)) |
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))) |
2657 |
More specifically, the return value is a cons pair (REQUIRED . OPTIONAL), |
More specifically, the return value is a cons pair (REQUIRED . OPTIONAL), |
2658 |
where REQUIRED and OPTIONAL are lists of the required and optional field |
where REQUIRED and OPTIONAL are lists of the required and optional field |
2659 |
names for ENTRY-TYPE according to `bibtex-entry-field-alist'." |
names for ENTRY-TYPE according to `bibtex-entry-field-alist'." |
2660 |
(let ((e (assoc-ignore-case entry-type bibtex-entry-field-alist)) |
(let ((e (assoc-string entry-type bibtex-entry-field-alist t)) |
2661 |
required optional) |
required optional) |
2662 |
(unless e |
(unless e |
2663 |
(error "Bibtex entry type %s not defined" entry-type)) |
(error "Bibtex entry type %s not defined" entry-type)) |
2724 |
(substring (cdr (assoc "=type=" fields-alist)) |
(substring (cdr (assoc "=type=" fields-alist)) |
2725 |
1)))) ; don't want @ |
1)))) ; don't want @ |
2726 |
(dolist (field (car field-list)) |
(dolist (field (car field-list)) |
2727 |
(unless (assoc-ignore-case (car field) fields-alist) |
(unless (assoc-string (car field) fields-alist t) |
2728 |
(bibtex-make-field field))) |
(bibtex-make-field field))) |
2729 |
(dolist (field (cdr field-list)) |
(dolist (field (cdr field-list)) |
2730 |
(unless (assoc-ignore-case (car field) fields-alist) |
(unless (assoc-string (car field) fields-alist t) |
2731 |
(bibtex-make-optional-field field)))))) |
(bibtex-make-optional-field field)))))) |
2732 |
|
|
2733 |
(defun bibtex-parse-entry () |
(defun bibtex-parse-entry () |
2795 |
(let* ((name (buffer-substring |
(let* ((name (buffer-substring |
2796 |
(if (looking-at "ALT\\|OPT") (match-end 0) (point)) |
(if (looking-at "ALT\\|OPT") (match-end 0) (point)) |
2797 |
(bibtex-end-of-name-in-field bounds))) |
(bibtex-end-of-name-in-field bounds))) |
2798 |
(text (assoc-ignore-case name other))) |
(text (assoc-string name other t))) |
2799 |
(goto-char (bibtex-start-of-text-in-field bounds)) |
(goto-char (bibtex-start-of-text-in-field bounds)) |
2800 |
(if (not (and (looking-at bibtex-empty-field-re) text)) |
(if (not (and (looking-at bibtex-empty-field-re) text)) |
2801 |
(goto-char (bibtex-end-of-field bounds)) |
(goto-char (bibtex-end-of-field bounds)) |
2828 |
(field-list (bibtex-field-list (progn (re-search-backward |
(field-list (bibtex-field-list (progn (re-search-backward |
2829 |
bibtex-entry-maybe-empty-head nil t) |
bibtex-entry-maybe-empty-head nil t) |
2830 |
(bibtex-type-in-head)))) |
(bibtex-type-in-head)))) |
2831 |
(comment (assoc-ignore-case field-name |
(comment (assoc-string field-name |
2832 |
(append (car field-list) |
(append (car field-list) |
2833 |
(cdr field-list))))) |
(cdr field-list)) |
2834 |
|
t))) |
2835 |
(if comment |
(if comment |
2836 |
(message (nth 1 comment)) |
(message (nth 1 comment)) |
2837 |
(message "No comment available"))))) |
(message "No comment available"))))) |
3239 |
(let* ((entry-list (progn |
(let* ((entry-list (progn |
3240 |
(goto-char beg) |
(goto-char beg) |
3241 |
(bibtex-search-entry nil end) |
(bibtex-search-entry nil end) |
3242 |
(assoc-ignore-case (bibtex-type-in-head) |
(assoc-string (bibtex-type-in-head) |
3243 |
bibtex-entry-field-alist))) |
bibtex-entry-field-alist t))) |
3244 |
(req (copy-sequence (elt (elt entry-list 1) 0))) |
(req (copy-sequence (elt (elt entry-list 1) 0))) |
3245 |
(creq (copy-sequence (elt (elt entry-list 2) 0))) |
(creq (copy-sequence (elt (elt entry-list 2) 0))) |
3246 |
crossref-there bounds) |
crossref-there bounds) |
3256 |
(push (list (bibtex-current-line) |
(push (list (bibtex-current-line) |
3257 |
"Questionable month field") |
"Questionable month field") |
3258 |
error-list)) |
error-list)) |
3259 |
(setq req (delete (assoc-ignore-case field-name req) req) |
(setq req (delete (assoc-string field-name req t) req) |
3260 |
creq (delete (assoc-ignore-case field-name creq) creq)) |
creq (delete (assoc-string field-name creq t) creq)) |
3261 |
(if (equal field-name "crossref") |
(if (equal field-name "crossref") |
3262 |
(setq crossref-there t)))) |
(setq crossref-there t)))) |
3263 |
(if crossref-there |
(if crossref-there |