unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Roland Winkler <roland.winkler@physik.uni-erlangen.de>
Subject: bibtex.el
Date: Tue, 1 Jun 2004 15:06:39 +0200	[thread overview]
Message-ID: <16572.32607.197281.692563@tfkp07.physik.uni-erlangen.de> (raw)

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 399 bytes --]


Could someone please install this patch in the emacs cvs tree?

Thank you!

Roland



2004-06-01  Roland Winkler  <Roland.Winkler@physik.uni-erlangen.de>

	* textmodes/bibtex.el (bibtex-format-entry): Fix regexps.
	(bibtex-parse-strings): Bugfix, use assoc instead of assoc-string.
	(bibtex-entry-update): Handle alternatives and optional fields.
	(bibtex-parse-entry): Bugfix, handle empty key.



[-- Attachment #2: dif5 --]
[-- Type: application/octet-stream, Size: 3209 bytes --]

--- bibtex.el	2004/05/28 16:04:23	1.31
+++ bibtex.el	2004/06/01 14:51:13
@@ -1793,7 +1793,7 @@
         (goto-char (point-min))
         (let* ((fields-alist (bibtex-parse-entry))
                (case-fold-search t)
-               (field (bibtex-assoc-regexp "\\(OPT\\)?crossref\\>"
+               (field (bibtex-assoc-regexp "\\`\\(OPT\\)?crossref\\'"
                                            fields-alist)))
           (setq crossref-key (and field
                                   (not (string-match bibtex-empty-field-re
@@ -1807,7 +1807,7 @@
             (when (nth 3 rfield) ; we should have an alternative
               (setq alternatives-there t
                     field (bibtex-assoc-regexp
-                           (concat "\\(ALT\\)?" (car rfield) "\\>")
+                           (concat "\\`\\(ALT\\)?" (car rfield) "\\'")
                            fields-alist))
               (if (and field
                        (not (string-match bibtex-empty-field-re
@@ -2317,7 +2317,7 @@
                 ;; user has aborted by typing a key --> return `aborted'
                 (throw 'userkey 'aborted))
             (setq key (bibtex-reference-key-in-string bounds))
-            (if (not (assoc-string key strings t))
+            (if (not (assoc key strings))
                 (push (cons key (bibtex-text-in-string bounds t))
                       strings))
             (goto-char (bibtex-end-of-text-in-string bounds)))
@@ -2722,24 +2722,27 @@
     (let* ((fields-alist (bibtex-parse-entry))
            (field-list (bibtex-field-list
                         (substring (cdr (assoc "=type=" fields-alist))
-                                   1)))) ; don't want @
+                                   1))) ; don't want @
+           (case-fold-search t))
       (dolist (field (car field-list))
-        (unless (assoc-string (car field) fields-alist t)
+        (unless (bibtex-assoc-regexp (concat "\\`\\(ALT\\)?" (car field) "\\'")
+                                     fields-alist)
           (bibtex-make-field field)))
       (dolist (field (cdr field-list))
-        (unless (assoc-string (car field) fields-alist t)
+        (unless (bibtex-assoc-regexp (concat "\\`\\(OPT\\)?" (car field) "\\'")
+                                     fields-alist)
           (bibtex-make-optional-field field))))))
 
 (defun bibtex-parse-entry ()
   "Parse entry at point, return an alist.
 The alist elements have the form (FIELD . TEXT), where FIELD can also be
-the special strings \"=type=\" and \"=key=\".
-Move point to the end of the last field."
+the special strings \"=type=\" and \"=key=\". For the FIELD \"=key=\"
+TEXT may be nil. Move point to the end of the last field."
   (let (alist bounds)
-    (when (looking-at bibtex-entry-head)
+    (when (looking-at bibtex-entry-maybe-empty-head)
       (push (cons "=type=" (match-string bibtex-type-in-head)) alist)
       (push (cons "=key=" (match-string bibtex-key-in-head)) alist)
-      (goto-char (match-end bibtex-key-in-head))
+      (goto-char (match-end 0))
       (while (setq bounds (bibtex-parse-field bibtex-field-name))
 	(push (cons (bibtex-name-in-field bounds)
 		    (bibtex-text-in-field-bounds bounds))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

             reply	other threads:[~2004-06-01 13:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-01 13:06 Roland Winkler [this message]
2004-06-01 23:30 ` bibtex.el Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2003-06-30 17:49 bibtex.el Roland Winkler
2003-07-05 12:42 ` bibtex.el Kai Großjohann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16572.32607.197281.692563@tfkp07.physik.uni-erlangen.de \
    --to=roland.winkler@physik.uni-erlangen.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).