emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/bibtex.el


From: Roland Winkler
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/bibtex.el
Date: Sun, 09 Apr 2006 18:25:53 +0000

Index: emacs/lisp/textmodes/bibtex.el
diff -u emacs/lisp/textmodes/bibtex.el:1.111 
emacs/lisp/textmodes/bibtex.el:1.112
--- emacs/lisp/textmodes/bibtex.el:1.111        Sun Mar 19 21:53:49 2006
+++ emacs/lisp/textmodes/bibtex.el      Sun Apr  9 18:25:53 2006
@@ -3613,17 +3613,20 @@
 
 (defun bibtex-find-text-internal (&optional noerror subfield comma)
   "Find text part of current BibTeX field or entry head.
-Return list (NAME START-TEXT END-TEXT END) with field or entry name,
-start and end of text and end of field or entry head, or nil if not found.
-If optional arg NOERROR is non-nil, an error message is suppressed if text
-is not found.  If optional arg SUBFIELD is non-nil START-TEXT and END-TEXT
-correspond to the current subfield delimited by #.
+Return list (NAME START-TEXT END-TEXT END STRING-CONST) with field
+or entry name, start and end of text, and end of field or entry head.
+STRING-CONST is a flag which is non-nil if current subfield delimited by #
+is a BibTeX string constant.  Return value is nil if field or entry head
+are not found.
+If optional arg NOERROR is non-nil, an error message is suppressed
+if text is not found.  If optional arg SUBFIELD is non-nil START-TEXT
+and END-TEXT correspond to the current subfield delimited by #.
 Optional arg COMMA is as in `bibtex-enclosing-field'."
   (save-excursion
     (let ((pnt (point))
           (bounds (bibtex-enclosing-field comma t))
           (case-fold-search t)
-          name start-text end-text end failure done no-sub)
+          name start-text end-text end failure done no-sub string-const)
       (bibtex-beginning-of-entry)
       (cond (bounds
              (setq name (bibtex-name-in-field bounds t)
@@ -3667,9 +3670,11 @@
           (goto-char start-text)
           (while (not done)
             (if (or (prog1 (looking-at bibtex-field-const)
-                      (setq end-text (match-end 0)))
+                      (setq end-text (match-end 0)
+                            string-const t))
                     (prog1 (setq bounds (bibtex-parse-field-string))
-                      (setq end-text (cdr bounds))))
+                      (setq end-text (cdr bounds)
+                            string-const nil)))
                 (progn
                   (if (and (<= start-text pnt) (<= pnt end-text))
                       (setq done t)
@@ -3678,7 +3683,7 @@
                       (setq start-text (goto-char (match-end 0)))))
               (setq done t failure t)))))
       (cond ((not failure)
-             (list name start-text end-text end))
+             (list name start-text end-text end string-const))
             ((and no-sub (not noerror))
              (error "Not on text part of BibTeX field"))
             ((not noerror) (error "Not on BibTeX field"))))))
@@ -3712,13 +3717,10 @@
 Optional arg COMMA is as in `bibtex-enclosing-field'.  It is t for
 interactive calls."
   (interactive (list t))
-  (let* ((bounds (bibtex-find-text-internal nil t comma))
-         (start (nth 1 bounds))
-         (end (nth 2 bounds)))
-    (if (memq (char-before end) '(?\} ?\"))
-        (delete-region (1- end) end))
-    (if (memq (char-after start) '(?\{ ?\"))
-        (delete-region start (1+ start)))))
+  (let ((bounds (bibtex-find-text-internal nil t comma)))
+    (unless (nth 4 bounds)
+      (delete-region (1- (nth 2 bounds)) (nth 2 bounds))
+      (delete-region (nth 1 bounds) (1+ (nth 1 bounds))))))
 
 (defun bibtex-kill-field (&optional copy-only comma)
   "Kill the entire enclosing BibTeX field.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]