aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-04-11 19:47:26 +0000
committerRichard M. Stallman1995-04-11 19:47:26 +0000
commita9cb9b801056e4bcefa95724b07c3fb34d24a6f6 (patch)
tree04c8644b49f5460144eba7daa6e029926ed6e9cc
parentda627a7158412938f36b1531ba87f3dad7478585 (diff)
downloademacs-a9cb9b801056e4bcefa95724b07c3fb34d24a6f6.tar.gz
emacs-a9cb9b801056e4bcefa95724b07c3fb34d24a6f6.zip
(bibtex-find-text, bibtex-remove-double-quotes-or-braces):
Support both kind of delimiters (braces or quotes) regardless of the value of bibtex-field-left-delimiter and bibtex-field-right-delimiter. (bibtex-field-left-delimiter, bibtex-field-right-delimiter): Made buffer-local. (bibtex-beginning-of-entry): At the beginning of an entry, leave point at the beginning of that entry instead of moving to the beginning of the previous one. (bibtex-end-of-entry): Outside an entry, now move to the end of the *previous* entry (i.e. bibtex-beginning-of-entry and bibtex-end-of-entry are now idempotent). (bibtex-sort-entries, bibtex-clean-entry): Removed now obsolete calls of bibtex-beginning-of-entry just before calls to bibtex-end-of-entry. (bibtex-clean-entry): Minor change to adapt to new behavior of bibtex-beginning-of-entry.
-rw-r--r--lisp/textmodes/bibtex.el37
1 files changed, 18 insertions, 19 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index cb0f6533a66..531180eb47a 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1,6 +1,6 @@
1;;; bibtex.el --- BibTeX mode for GNU Emacs 1;;; bibtex.el --- BibTeX mode for GNU Emacs
2 2
3;; Copyright (C) 1992, 1994 Free Software Foundation, Inc. 3;; Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Schoef <schoef@informatik.uni-oldenburg.de> 5;; Author: Stefan Schoef <schoef@informatik.uni-oldenburg.de>
6;; Bengt Martensson <ubrinf!mond!bengt> 6;; Bengt Martensson <ubrinf!mond!bengt>
@@ -54,10 +54,14 @@
54;;; USER OPTIONS: 54;;; USER OPTIONS:
55 55
56(defvar bibtex-field-left-delimiter "{" 56(defvar bibtex-field-left-delimiter "{"
57 "*Set this to { or \" according to your personal preferences.") 57 "*Set this to { or \" according to your personal preferences.
58This variable is buffer local.")
59(make-variable-buffer-local 'bibtex-field-left-delimiter)
58 60
59(defvar bibtex-field-right-delimiter "}" 61(defvar bibtex-field-right-delimiter "}"
60 "*Set this to } or \" according to your personal preferences.") 62 "*Set this to } or \" according to your personal preferences.
63This variable is buffer local.")
64(make-variable-buffer-local 'bibtex-field-right-delimiter)
61 65
62(defvar bibtex-include-OPTcrossref '("InProceedings" "InCollection") 66(defvar bibtex-include-OPTcrossref '("InProceedings" "InCollection")
63 "*All entries listed here will have an OPTcrossref field.") 67 "*All entries listed here will have an OPTcrossref field.")
@@ -1390,22 +1394,18 @@ non-nil."
1390If inside an entry, move to the beginning of it, otherwise move to the 1394If inside an entry, move to the beginning of it, otherwise move to the
1391beginning of the previous entry." 1395beginning of the previous entry."
1392 (interactive) 1396 (interactive)
1397 (if (looking-at "^@")
1398 (forward-char))
1393 (re-search-backward "^@" nil 'move)) 1399 (re-search-backward "^@" nil 'move))
1394 1400
1395(defun bibtex-end-of-entry () 1401(defun bibtex-end-of-entry ()
1396 "Move to end of BibTeX entry. 1402 "Move to end of BibTeX entry.
1397If inside an entry, move to the end of it, otherwise move to the end 1403If inside an entry, move to the end of it, otherwise move to the end
1398of the next entry." 1404of the previous entry."
1399 (interactive) 1405 (interactive)
1400 ;; if point was previously at the end of an entry, this puts us
1401 ;; inside the next entry, otherwise we remain in the current one.
1402 (progn
1403 (skip-whitespace-and-comments)
1404 (end-of-line))
1405 (bibtex-beginning-of-entry) 1406 (bibtex-beginning-of-entry)
1406 (let ((parse-sexp-ignore-comments t)) 1407 (let ((parse-sexp-ignore-comments t))
1407 (forward-sexp) ; skip entry type 1408 (forward-sexp 2) ;; skip entry type and body
1408 (forward-sexp) ; skip entry body
1409 )) 1409 ))
1410 1410
1411(defun bibtex-ispell-entry () 1411(defun bibtex-ispell-entry ()
@@ -1469,7 +1469,6 @@ Bugs:
1469 (point) 1469 (point)
1470 (save-excursion 1470 (save-excursion
1471 (goto-char (point-max)) 1471 (goto-char (point-max))
1472 (bibtex-beginning-of-entry)
1473 (bibtex-end-of-entry) 1472 (bibtex-end-of-entry)
1474 (point))) 1473 (point)))
1475 (sort-subr 1474 (sort-subr
@@ -1608,10 +1607,12 @@ you can put comments here)."
1608 (if arg 1607 (if arg
1609 (progn 1608 (progn
1610 (goto-char (match-beginning bibtex-text-in-field)) 1609 (goto-char (match-beginning bibtex-text-in-field))
1611 (if (looking-at bibtex-field-left-delimiter) 1610 (if (looking-at "[{\"]")
1612 (forward-char 1))) 1611 (forward-char 1)))
1613 (goto-char (match-end bibtex-text-in-field)) 1612 (goto-char (match-end bibtex-text-in-field))
1614 (if (= (preceding-char) (aref bibtex-field-right-delimiter 0)) 1613 (if (or
1614 (= (preceding-char) ?})
1615 (= (preceding-char) ?\"))
1615 (forward-char -1))) 1616 (forward-char -1)))
1616 (if bibtex-help-message 1617 (if bibtex-help-message
1617 (bibtex-print-help-message))) 1618 (bibtex-print-help-message)))
@@ -1642,10 +1643,10 @@ you can put comments here)."
1642 (stop (match-end bibtex-text-in-field))) 1643 (stop (match-end bibtex-text-in-field)))
1643 (goto-char stop) 1644 (goto-char stop)
1644 (forward-char -1) 1645 (forward-char -1)
1645 (if (looking-at bibtex-field-right-delimiter) 1646 (if (looking-at "[}\"]")
1646 (delete-char 1)) 1647 (delete-char 1))
1647 (goto-char start) 1648 (goto-char start)
1648 (if (looking-at bibtex-field-left-delimiter) 1649 (if (looking-at "[{\"]")
1649 (delete-char 1))))) 1650 (delete-char 1)))))
1650 1651
1651(defun bibtex-kill-optional-field () 1652(defun bibtex-kill-optional-field ()
@@ -1950,10 +1951,8 @@ given, calculate a new entry label."
1950 (forward-line -1) 1951 (forward-line -1)
1951 (end-of-line) 1952 (end-of-line)
1952 (if (eq (preceding-char) ?,) 1953 (if (eq (preceding-char) ?,)
1953 (backward-delete-char 1))) 1954 (backward-delete-char 1))))
1954 (skip-whitespace-and-comments))
1955 (let* ((eob (progn 1955 (let* ((eob (progn
1956 (bibtex-beginning-of-entry)
1957 (bibtex-end-of-entry) 1956 (bibtex-end-of-entry)
1958 (point))) 1957 (point)))
1959 (key (progn 1958 (key (progn