summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorRoland Winkler <winkler@gnu.org>2022-12-29 23:31:08 -0600
committerRoland Winkler <winkler@gnu.org>2022-12-29 23:31:08 -0600
commit644c71d6788d268cb065bd9317efb8a16a8236e6 (patch)
treef49ad637430a6db035ebd572df3eb98786cfe738 /lisp/textmodes
parentab38abfdf75e091b9970dd3ba977aaa1b6067cc3 (diff)
downloademacs-644c71d6788d268cb065bd9317efb8a16a8236e6.tar.gz
emacs-644c71d6788d268cb065bd9317efb8a16a8236e6.tar.bz2
emacs-644c71d6788d268cb065bd9317efb8a16a8236e6.zip
lisp/textmodes/bibtex.el: fix bibtex-beginning-of-entry (bug#56636)
lisp/textmodes/bibtex.el (bibtex-beginning-of-entry): use bibtex-any-entry-maybe-empty-head (bug#56636)
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/bibtex.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index a1a3cbd8f14..23909742889 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -4083,11 +4083,19 @@ INIT is surrounded by field delimiters, unless NODELIM is non-nil."
If inside an entry, move to the beginning of it, otherwise move to the
beginning of the previous entry. If point is ahead of all BibTeX entries
move point to the beginning of buffer. Return the new location of point."
+ ;; This command is similar to `beginning-of-defun', but with historical
+ ;; differences.
+ ;; - It does not move point to the previous entry if point is already
+ ;; at the beginning of an entry
+ ;; - It does not take an optional ARG that moves backward to the beginning
+ ;; of a defun ARG times.
+ ;; - It returns point and the code relies on this.
(interactive)
- (skip-chars-forward " \t")
- (if (looking-at "@")
- (forward-char))
- (re-search-backward "^[ \t]*@" nil 'move)
+ (beginning-of-line)
+ ;; `bibtex-any-valid-entry-type' would fail if users "disable"
+ ;; an entry by chosing an invalid entry type.
+ (or (looking-at bibtex-any-entry-maybe-empty-head)
+ (re-search-backward bibtex-any-entry-maybe-empty-head nil 'move))
(point))
(defun bibtex-end-of-entry ()