]> git.eshelyaron.com Git - emacs.git/commitdiff
bibtex-mode: fix patch bibtex validation for non-file buffers
authorRoland Winkler <winkler@gnu.org>
Wed, 25 Sep 2024 04:14:27 +0000 (23:14 -0500)
committerEshel Yaron <me@eshelyaron.com>
Mon, 30 Sep 2024 19:38:56 +0000 (21:38 +0200)
(cherry picked from commit bd25a98b4e70dbdcb6db92b0b39122a6c7386044)

lisp/textmodes/bibtex.el

index 1473fc2bd6bd48d8f15c771118f6b9fcd934d8f1..cbcea8af012b27c68bcf30ed242865b25f7688cb 100644 (file)
@@ -4638,16 +4638,17 @@ Return t if test was successful, nil otherwise."
             (bibtex-progress-message 'done)))))
 
     (if error-list
-        (let* ((file-p (buffer-file-name))
-               (file (if file-p (file-name-nondirectory file-p) (buffer-name)))
+        (let* ((is-file (buffer-file-name))
+               (file (if is-file (file-name-nondirectory is-file) (buffer-name)))
                (dir default-directory)
                (err-buf "*BibTeX validation errors*"))
           (setq error-list (sort error-list #'car-less-than-car))
           (with-current-buffer (get-buffer-create err-buf)
             (setq default-directory dir)
             (unless (eq major-mode 'compilation-mode) (compilation-mode))
-            (setq-local compilation-parse-errors-filename-function
-                        (if file-p #'identity #'get-buffer))
+            (unless is-file
+              (setq-local compilation-parse-errors-filename-function
+                          #'get-buffer))
             (let ((inhibit-read-only t))
               (delete-region (point-min) (point-max))
               (insert (substitute-command-keys