From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers Date: Sat, 13 Jul 2024 13:26:28 +0300 Message-ID: <86r0bxk2p7.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12252"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71946@debbugs.gnu.org To: Liu Hui , Roland Winkler Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 13 12:27:21 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sSZyL-0002zT-5g for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 13 Jul 2024 12:27:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSZy3-0005Gb-7n; Sat, 13 Jul 2024 06:27:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSZy2-0005GS-32 for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2024 06:27:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSZy1-0001l2-Qh for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2024 06:27:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sSZy2-0001jz-Hl for bug-gnu-emacs@gnu.org; Sat, 13 Jul 2024 06:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Jul 2024 10:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71946 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 71946-submit@debbugs.gnu.org id=B71946.17208664026664 (code B ref 71946); Sat, 13 Jul 2024 10:27:02 +0000 Original-Received: (at 71946) by debbugs.gnu.org; 13 Jul 2024 10:26:42 +0000 Original-Received: from localhost ([127.0.0.1]:55169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sSZxi-0001jQ-5v for submit@debbugs.gnu.org; Sat, 13 Jul 2024 06:26:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sSZxc-0001j7-Hn for 71946@debbugs.gnu.org; Sat, 13 Jul 2024 06:26:41 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sSZxW-0001gc-Fp; Sat, 13 Jul 2024 06:26:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=fX3kvQ7Hso1RFyFq3w3fXIHZNpgVTRqbYF5Ze8YspUQ=; b=OOfSAKxtRoon ixYzGsuVSgL+PzQUKU1MQa9FEC75eeKm8d6QLg6rXQaqtFTRKyIegapjmA1/i9EMhHSJfx06UtEkp lIfdUm56wsqBOJT8cMGeoL9r3HRnDEdP/Yd/6afS1rAznvtAQtDRRdtUavMJ6KGVn2rMbz19zQfmX PmoU1OsITXJmyCJOXZwPHi7HsuCT4bpyCxMVV0RGyAaXX3rTaD7iWZuIP5/XDVg3GiqF9ns3nBy47 +4/xy/3HTGx9ev6dcb7qhdYPC2VD6dgDVlMQ0wMuVHWSWQ67oxPfTF8ZA91q0j47VOSTFeclKT2Vy QxEwPNhLLkib9aEOGriSWg==; In-Reply-To: (message from Liu Hui on Fri, 5 Jul 2024 18:00:00 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288803 Archived-At: > From: Liu Hui > 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 > 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?