# HG changeset patch # User Richard M. Stallman # Date 797629646 0 # Node ID 8381a25d021e6b60f6740fd53e25e4a068763c46 # Parent 874b91f4adc4cc24770b5d08d62cfca62cc335c9 (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. diff -r 874b91f4adc4 -r 8381a25d021e lisp/textmodes/bibtex.el --- a/lisp/textmodes/bibtex.el Tue Apr 11 15:56:53 1995 +0000 +++ b/lisp/textmodes/bibtex.el Tue Apr 11 19:47:26 1995 +0000 @@ -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 ;; Bengt Martensson @@ -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 @@ 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 @@ (point) (save-excursion (goto-char (point-max)) - (bibtex-beginning-of-entry) (bibtex-end-of-entry) (point))) (sort-subr @@ -1608,10 +1607,12 @@ (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 @@ (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 @@ (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