diff options
| author | Stefan Monnier | 2003-06-02 22:41:50 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2003-06-02 22:41:50 +0000 |
| commit | dd310c45a058a3d48ff2ecfe2b2baa89bbd929a0 (patch) | |
| tree | fefd0fce858460c677758da3b0b353ddaa74e010 | |
| parent | 7fbf4804e62c2c3337221ec1c254fc03259fb744 (diff) | |
| download | emacs-dd310c45a058a3d48ff2ecfe2b2baa89bbd929a0.tar.gz emacs-dd310c45a058a3d48ff2ecfe2b2baa89bbd929a0.zip | |
(bibtex-member-of-regexp, bibtex-assoc-of-regexp, bibtex-format-entry)
(bibtex-find-entry, bibtex-autokey-demangle-name, bibtex-string-files-init)
(bibtex-mode): Fix up regexp usage and use match-string.
| -rw-r--r-- | lisp/textmodes/bibtex.el | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 90d0636de09..e64f698d051 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el | |||
| @@ -988,7 +988,7 @@ was parsed for keys the last time.") | |||
| 988 | (defconst bibtex-entry-maybe-empty-head | 988 | (defconst bibtex-entry-maybe-empty-head |
| 989 | (concat bibtex-entry-head "?") | 989 | (concat bibtex-entry-head "?") |
| 990 | "Regexp matching the header line of a maybe empty BibTeX entry | 990 | "Regexp matching the header line of a maybe empty BibTeX entry |
| 991 | (possibly without reference key).") | 991 | \(possibly without reference key).") |
| 992 | 992 | ||
| 993 | (defconst bibtex-type-in-head 1 | 993 | (defconst bibtex-type-in-head 1 |
| 994 | "Regexp subexpression number of the type part in `bibtex-entry-head'.") | 994 | "Regexp subexpression number of the type part in `bibtex-entry-head'.") |
| @@ -1404,7 +1404,7 @@ delimiters if present." | |||
| 1404 | The value is actually the tail of LIST whose car matches STRING." | 1404 | The value is actually the tail of LIST whose car matches STRING." |
| 1405 | (let (case-fold-search) | 1405 | (let (case-fold-search) |
| 1406 | (while (and list | 1406 | (while (and list |
| 1407 | (not (string-match (concat "^" (car list) "$") string))) | 1407 | (not (string-match (concat "\\`\\(?:" (car list) "\\)\\'") string))) |
| 1408 | (setq list (cdr list))) | 1408 | (setq list (cdr list))) |
| 1409 | list)) | 1409 | list)) |
| 1410 | 1410 | ||
| @@ -1414,7 +1414,7 @@ element of ALIST (case ignored). The value is actually the element | |||
| 1414 | of LIST whose car matches STRING." | 1414 | of LIST whose car matches STRING." |
| 1415 | (let ((case-fold-search t)) | 1415 | (let ((case-fold-search t)) |
| 1416 | (while (and alist | 1416 | (while (and alist |
| 1417 | (not (string-match (concat "^" (caar alist) "$") string))) | 1417 | (not (string-match (concat "\\`\\(?:" (caar alist) "\\)\\'") string))) |
| 1418 | (setq alist (cdr alist))) | 1418 | (setq alist (cdr alist))) |
| 1419 | (car alist))) | 1419 | (car alist))) |
| 1420 | 1420 | ||
| @@ -1824,7 +1824,7 @@ Formats current entry according to variable `bibtex-entry-format'." | |||
| 1824 | 1824 | ||
| 1825 | ;; update page dashes | 1825 | ;; update page dashes |
| 1826 | (if (and (memq 'page-dashes format) | 1826 | (if (and (memq 'page-dashes format) |
| 1827 | (string-match "^\\(OPT\\)?pages\\'" field-name) | 1827 | (string-match "\\`\\(OPT\\)?pages\\'" field-name) |
| 1828 | (progn (goto-char beg-text) | 1828 | (progn (goto-char beg-text) |
| 1829 | (looking-at | 1829 | (looking-at |
| 1830 | "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) | 1830 | "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) |
| @@ -1965,21 +1965,21 @@ and return results as a list." | |||
| 1965 | ;; Name is of the form "von Last, First" or | 1965 | ;; Name is of the form "von Last, First" or |
| 1966 | ;; "von Last, Jr, First" | 1966 | ;; "von Last, Jr, First" |
| 1967 | ;; --> Take the first capital part before the comma | 1967 | ;; --> Take the first capital part before the comma |
| 1968 | (substring fullname (match-beginning 1) (match-end 1))) | 1968 | (match-string 1 fullname)) |
| 1969 | ((string-match "\\([^, ]*\\)," fullname) | 1969 | ((string-match "\\([^, ]*\\)," fullname) |
| 1970 | ;; Strange name: we have a comma, but nothing capital | 1970 | ;; Strange name: we have a comma, but nothing capital |
| 1971 | ;; So we accept even lowercase names | 1971 | ;; So we accept even lowercase names |
| 1972 | (substring fullname (match-beginning 1) (match-end 1))) | 1972 | (match-string 1 fullname)) |
| 1973 | ((string-match "\\(\\<[a-z][^ ]*[ ]+\\)+\\([A-Z][^ ]*\\)" | 1973 | ((string-match "\\(\\<[a-z][^ ]* +\\)+\\([A-Z][^ ]*\\)" |
| 1974 | fullname) | 1974 | fullname) |
| 1975 | ;; name is of the form "First von Last", "von Last", | 1975 | ;; name is of the form "First von Last", "von Last", |
| 1976 | ;; "First von von Last", or "d'Last" | 1976 | ;; "First von von Last", or "d'Last" |
| 1977 | ;; --> take the first capital part after the "von" parts | 1977 | ;; --> take the first capital part after the "von" parts |
| 1978 | (substring fullname (match-beginning 2) (match-end 2))) | 1978 | (match-string 2 fullname)) |
| 1979 | ((string-match "\\([^ ]+\\)[ ]*$" fullname) | 1979 | ((string-match "\\([^ ]+\\) *\\'" fullname) |
| 1980 | ;; name is of the form "First Middle Last" or "Last" | 1980 | ;; name is of the form "First Middle Last" or "Last" |
| 1981 | ;; --> take the last token | 1981 | ;; --> take the last token |
| 1982 | (substring fullname (match-beginning 1) (match-end 1))) | 1982 | (match-string 1 fullname)) |
| 1983 | (t (error "Name `%s' is incorrectly formed" fullname))))) | 1983 | (t (error "Name `%s' is incorrectly formed" fullname))))) |
| 1984 | (bibtex-autokey-abbrev | 1984 | (bibtex-autokey-abbrev |
| 1985 | (funcall bibtex-autokey-name-case-convert name) | 1985 | (funcall bibtex-autokey-name-case-convert name) |
| @@ -2233,7 +2233,7 @@ Use `bibtex-predefined-strings' and bib files `bibtex-string-files'." | |||
| 2233 | (case-fold-search) | 2233 | (case-fold-search) |
| 2234 | compl) | 2234 | compl) |
| 2235 | (dolist (filename bibtex-string-files) | 2235 | (dolist (filename bibtex-string-files) |
| 2236 | (unless (string-match "\.bib$" filename) | 2236 | (unless (string-match "\\.bib\\'" filename) |
| 2237 | (setq filename (concat filename ".bib"))) | 2237 | (setq filename (concat filename ".bib"))) |
| 2238 | ;; test filenames | 2238 | ;; test filenames |
| 2239 | (let (fullfilename bounds found) | 2239 | (let (fullfilename bounds found) |
| @@ -2523,7 +2523,7 @@ non-nil. | |||
| 2523 | (set (make-local-variable 'comment-start-skip) | 2523 | (set (make-local-variable 'comment-start-skip) |
| 2524 | (concat (regexp-quote bibtex-comment-start) "\\>[ \t]*")) | 2524 | (concat (regexp-quote bibtex-comment-start) "\\>[ \t]*")) |
| 2525 | (set (make-local-variable 'comment-column) 0) | 2525 | (set (make-local-variable 'comment-column) 0) |
| 2526 | (set (make-local-variable 'defun-prompt-regexp) "^[ \t]*@[a-zA-Z0-9]+") | 2526 | (set (make-local-variable 'defun-prompt-regexp) "^[ \t]*@[a-zA-Z0-9]+[ \t]*") |
| 2527 | (set (make-local-variable 'outline-regexp) "[ \t]*@") | 2527 | (set (make-local-variable 'outline-regexp) "[ \t]*@") |
| 2528 | (set (make-local-variable 'fill-prefix) (make-string (+ bibtex-entry-offset | 2528 | (set (make-local-variable 'fill-prefix) (make-string (+ bibtex-entry-offset |
| 2529 | bibtex-contline-indentation) | 2529 | bibtex-contline-indentation) |
| @@ -2902,7 +2902,7 @@ Return position of entry if KEY is found or nil if not found." | |||
| 2902 | (when (re-search-forward (concat "^[ \t]*\\(" | 2902 | (when (re-search-forward (concat "^[ \t]*\\(" |
| 2903 | bibtex-entry-type | 2903 | bibtex-entry-type |
| 2904 | "\\)[ \t]*[({][ \t\n]*\\(" | 2904 | "\\)[ \t]*[({][ \t\n]*\\(" |
| 2905 | key "\\)") | 2905 | (regexp-quote key) "\\)") |
| 2906 | nil t) | 2906 | nil t) |
| 2907 | (match-beginning 2))))) | 2907 | (match-beginning 2))))) |
| 2908 | (cond (pnt | 2908 | (cond (pnt |