* bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers
@ 2024-07-05 10:00 Liu Hui
2024-07-06 22:38 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Liu Hui @ 2024-07-05 10:00 UTC (permalink / raw
To: 71946
[-- Attachment #1: Type: text/plain, Size: 357 bytes --]
Hi,
I find that bibtex-validate has a minor issue for non-file buffers
with syntax errors:
1. emacs -Q
2. create an empty buffer containing the following text:
@article{1,
title = {Title},
author = {authors},
year = {2019}
3. M-x bibtex-mode, then M-x bibtex-validate
=> Wrong type argument: stringp, nil
This patch fixes the problem. Thanks.
[-- Attachment #2: 0001-Fix-bibtex-validation-for-non-file-buffers.patch --]
[-- Type: text/x-patch, Size: 1593 bytes --]
From b90a6838fa75e9023bcb61b6f545a5a7916e3b3c Mon Sep 17 00:00:00 2001
From: Liu Hui <liuhui1610@gmail.com>
Date: Fri, 5 Jul 2024 17:50:08 +0800
Subject: [PATCH] Fix bibtex validation for non-file buffers
* lisp/textmodes/bibtex.el (bibtex-validate): Use buffer name when
errors are found in non-file buffers.
---
lisp/textmodes/bibtex.el | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index a6da34d6a41..1473fc2bd6b 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -4638,13 +4638,16 @@ bibtex-validate
(bibtex-progress-message 'done)))))
(if error-list
- (let ((file (file-name-nondirectory (buffer-file-name)))
- (dir default-directory)
- (err-buf "*BibTeX validation errors*"))
+ (let* ((file-p (buffer-file-name))
+ (file (if file-p (file-name-nondirectory file-p) (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))
(let ((inhibit-read-only t))
(delete-region (point-min) (point-max))
(insert (substitute-command-keys
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers
2024-07-05 10:00 bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers Liu Hui
@ 2024-07-06 22:38 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-13 10:26 ` Eli Zaretskii
2024-07-20 9:49 ` Eli Zaretskii
2 siblings, 0 replies; 4+ messages in thread
From: Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-06 22:38 UTC (permalink / raw
To: Liu Hui; +Cc: 71946
Liu Hui <liuhui1610@gmail.com> writes:
> Hi,
>
> I find that bibtex-validate has a minor issue for non-file buffers
> with syntax errors:
>
> 1. emacs -Q
> 2. create an empty buffer containing the following text:
>
> @article{1,
> title = {Title},
> author = {authors},
> year = {2019}
>
> 3. M-x bibtex-mode, then M-x bibtex-validate
> => Wrong type argument: stringp, nil
I have tested this recipe and reproduced this bug
>
> This patch fixes the problem. Thanks.
I have no comments on this patch yet.
>
> [2. text/x-patch; 0001-Fix-bibtex-validation-for-non-file-buffers.patch]...
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers
2024-07-05 10:00 bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers Liu Hui
2024-07-06 22:38 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-13 10:26 ` Eli Zaretskii
2024-07-20 9:49 ` Eli Zaretskii
2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-07-13 10:26 UTC (permalink / raw
To: Liu Hui, Roland Winkler; +Cc: 71946
> From: Liu Hui <liuhui1610@gmail.com>
> Date: Fri, 5 Jul 2024 18:00:00 +0800
>
> I find that bibtex-validate has a minor issue for non-file buffers
> with syntax errors:
>
> 1. emacs -Q
> 2. create an empty buffer containing the following text:
>
> @article{1,
> title = {Title},
> author = {authors},
> year = {2019}
>
> 3. M-x bibtex-mode, then M-x bibtex-validate
> => Wrong type argument: stringp, nil
>
> This patch fixes the problem. Thanks.
>
> From b90a6838fa75e9023bcb61b6f545a5a7916e3b3c Mon Sep 17 00:00:00 2001
> From: Liu Hui <liuhui1610@gmail.com>
> Date: Fri, 5 Jul 2024 17:50:08 +0800
> Subject: [PATCH] Fix bibtex validation for non-file buffers
>
> * lisp/textmodes/bibtex.el (bibtex-validate): Use buffer name when
> errors are found in non-file buffers.
> ---
> lisp/textmodes/bibtex.el | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
> index a6da34d6a41..1473fc2bd6b 100644
> --- a/lisp/textmodes/bibtex.el
> +++ b/lisp/textmodes/bibtex.el
> @@ -4638,13 +4638,16 @@ bibtex-validate
> (bibtex-progress-message 'done)))))
>
> (if error-list
> - (let ((file (file-name-nondirectory (buffer-file-name)))
> - (dir default-directory)
> - (err-buf "*BibTeX validation errors*"))
> + (let* ((file-p (buffer-file-name))
> + (file (if file-p (file-name-nondirectory file-p) (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))
> (let ((inhibit-read-only t))
> (delete-region (point-min) (point-max))
> (insert (substitute-command-keys
> --
> 2.25.1
Thanks.
Roland, is this patch okay with you, and if so, is it safe enough to
be installed on the emacs-30 release branch?
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers
2024-07-05 10:00 bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers Liu Hui
2024-07-06 22:38 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-13 10:26 ` Eli Zaretskii
@ 2024-07-20 9:49 ` Eli Zaretskii
2 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-07-20 9:49 UTC (permalink / raw
To: Liu Hui; +Cc: 71946-done
> From: Liu Hui <liuhui1610@gmail.com>
> Date: Fri, 5 Jul 2024 18:00:00 +0800
>
> I find that bibtex-validate has a minor issue for non-file buffers
> with syntax errors:
>
> 1. emacs -Q
> 2. create an empty buffer containing the following text:
>
> @article{1,
> title = {Title},
> author = {authors},
> year = {2019}
>
> 3. M-x bibtex-mode, then M-x bibtex-validate
> => Wrong type argument: stringp, nil
>
> This patch fixes the problem. Thanks.
Thanks, installed on the emacs-30 branch and closing the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-20 9:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-05 10:00 bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers Liu Hui
2024-07-06 22:38 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-13 10:26 ` Eli Zaretskii
2024-07-20 9:49 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.