summaryrefslogtreecommitdiff
path: root/lisp/textmodes/bibtex.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/textmodes/bibtex.el')
-rw-r--r--lisp/textmodes/bibtex.el28
1 files changed, 20 insertions, 8 deletions
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index f4b557f443f..23909742889 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1822,8 +1822,9 @@ Initialized by `bibtex-set-dialect'.")
1 '(11))))
(defvar bibtex-font-lock-keywords
- ;; entry type and reference key
- `((,bibtex-any-entry-maybe-empty-head
+ `(("\\$[^$\n]+\\$" . font-lock-string-face) ; bug#50202
+ ;; entry type and reference key
+ (,bibtex-any-entry-maybe-empty-head
(,bibtex-type-in-head font-lock-function-name-face)
(,bibtex-key-in-head font-lock-constant-face nil t))
;; optional field names (treated as comments)
@@ -3631,8 +3632,11 @@ if that value is non-nil.
(setq-local fill-paragraph-function #'bibtex-fill-field)
(setq-local font-lock-defaults
'(bibtex-font-lock-keywords
- nil t ((?$ . "\"")
- ;; Mathematical expressions should be fontified as strings
+ nil t ((?$ . ".")
+ ;; Mathematical expressions should be fontified
+ ;; as strings. Yet `$' may also appear in certain
+ ;; fields like `URL' when it does not delimit
+ ;; a math expression (bug#50202).
(?\" . ".")
;; Quotes are field delimiters and quote-delimited
;; entries should be fontified in the same way as
@@ -4079,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 ()