all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Liu Hui <liuhui1610@gmail.com>, Roland Winkler <winkler@gnu.org>
Cc: 71946@debbugs.gnu.org
Subject: bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers
Date: Sat, 13 Jul 2024 13:26:28 +0300	[thread overview]
Message-ID: <86r0bxk2p7.fsf@gnu.org> (raw)
In-Reply-To: <CAOQTW-MHvt0jDbsPaFkOoBkgnFGzusXBcnYvu--ViToAgYLGiQ@mail.gmail.com> (message from Liu Hui on Fri, 5 Jul 2024 18:00:00 +0800)

> 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?





  parent reply	other threads:[~2024-07-13 10:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-07-20  9:49 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86r0bxk2p7.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=71946@debbugs.gnu.org \
    --cc=liuhui1610@gmail.com \
    --cc=winkler@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.