Skip to content

Commit 816c53c

Browse files
ilupinEli-Zaretskii
authored andcommitted
Fix bibtex validation for non-file buffers
* lisp/textmodes/bibtex.el (bibtex-validate): Use buffer name to show errors in non-file buffers. (Bug#71946)
1 parent ab7c40e commit 816c53c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lisp/textmodes/bibtex.el

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4638,13 +4638,16 @@ Return t if test was successful, nil otherwise."
46384638
(bibtex-progress-message 'done)))))
46394639

46404640
(if error-list
4641-
(let ((file (file-name-nondirectory (buffer-file-name)))
4642-
(dir default-directory)
4643-
(err-buf "*BibTeX validation errors*"))
4641+
(let* ((file-p (buffer-file-name))
4642+
(file (if file-p (file-name-nondirectory file-p) (buffer-name)))
4643+
(dir default-directory)
4644+
(err-buf "*BibTeX validation errors*"))
46444645
(setq error-list (sort error-list #'car-less-than-car))
46454646
(with-current-buffer (get-buffer-create err-buf)
46464647
(setq default-directory dir)
46474648
(unless (eq major-mode 'compilation-mode) (compilation-mode))
4649+
(setq-local compilation-parse-errors-filename-function
4650+
(if file-p #'identity #'get-buffer))
46484651
(let ((inhibit-read-only t))
46494652
(delete-region (point-min) (point-max))
46504653
(insert (substitute-command-keys

0 commit comments

Comments
 (0)