summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-04-11 19:47:26 +0000
committerRichard M. Stallman <rms@gnu.org>1995-04-11 19:47:26 +0000
commita9cb9b801056e4bcefa95724b07c3fb34d24a6f6 (patch)
tree04c8644b49f5460144eba7daa6e029926ed6e9cc
parentda627a7158412938f36b1531ba87f3dad7478585 (diff)
downloademacs-a9cb9b801056e4bcefa95724b07c3fb34d24a6f6.tar.gz
(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 @@
;;; bibtex.el --- BibTeX mode for GNU Emacs
-;; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
;; Author: Stefan Schoef <schoef@informatik.uni-oldenburg.de>
;; Bengt Martensson <ubrinf!mond!bengt>
@@ -54,10 +54,14 @@
;;; USER OPTIONS:
(defvar bibtex-field-left-delimiter "{"
- "*Set this to { or \" according to your personal preferences.")
+ "*Set this to { or \" according to your personal preferences.
+This variable is buffer local.")
+(make-variable-buffer-local 'bibtex-field-left-delimiter)
(defvar bibtex-field-right-delimiter "}"
- "*Set this to } or \" according to your personal preferences.")
+ "*Set this to } or \" according to your personal preferences.
+This variable is buffer local.")
+(make-variable-buffer-local 'bibtex-field-right-delimiter)
(defvar bibtex-include-OPTcrossref '("InProceedings" "InCollection")
"*All entries listed here will have an OPTcrossref field.")
@@ -1390,22 +1394,18 @@ non-nil."
If inside an entry, move to the beginning of it, otherwise move to the
beginning of the previous entry."
(interactive)
+ (if (looking-at "^@")
+ (forward-char))
(re-search-backward "^@" nil 'move))
(defun bibtex-end-of-entry ()
"Move to end of BibTeX entry.
If inside an entry, move to the end of it, otherwise move to the end
-of the next entry."
+of the previous entry."
(interactive)
- ;; if point was previously at the end of an entry, this puts us
- ;; inside the next entry, otherwise we remain in the current one.
- (progn
- (skip-whitespace-and-comments)
- (end-of-line))
(bibtex-beginning-of-entry)
(let ((parse-sexp-ignore-comments t))
- (forward-sexp) ; skip entry type
- (forward-sexp) ; skip entry body
+ (forward-sexp 2) ;; skip entry type and body
))
(defun bibtex-ispell-entry ()
@@ -1469,7 +1469,6 @@ Bugs:
(point)
(save-excursion
(goto-char (point-max))
- (bibtex-beginning-of-entry)
(bibtex-end-of-entry)
(point)))
(sort-subr
@@ -1608,10 +1607,12 @@ you can put comments here)."
(if arg
(progn
(goto-char (match-beginning bibtex-text-in-field))
- (if (looking-at bibtex-field-left-delimiter)
+ (if (looking-at "[{\"]")
(forward-char 1)))
(goto-char (match-end bibtex-text-in-field))
- (if (= (preceding-char) (aref bibtex-field-right-delimiter 0))
+ (if (or
+ (= (preceding-char) ?})
+ (= (preceding-char) ?\"))
(forward-char -1)))
(if bibtex-help-message
(bibtex-print-help-message)))
@@ -1642,10 +1643,10 @@ you can put comments here)."
(stop (match-end bibtex-text-in-field)))
(goto-char stop)
(forward-char -1)
- (if (looking-at bibtex-field-right-delimiter)
+ (if (looking-at "[}\"]")
(delete-char 1))
(goto-char start)
- (if (looking-at bibtex-field-left-delimiter)
+ (if (looking-at "[{\"]")
(delete-char 1)))))
(defun bibtex-kill-optional-field ()
@@ -1950,10 +1951,8 @@ given, calculate a new entry label."
(forward-line -1)
(end-of-line)
(if (eq (preceding-char) ?,)
- (backward-delete-char 1)))
- (skip-whitespace-and-comments))
+ (backward-delete-char 1))))
(let* ((eob (progn
- (bibtex-beginning-of-entry)
(bibtex-end-of-entry)
(point)))
(key (progn