From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Roland Winkler Newsgroups: gmane.emacs.bugs Subject: bug#71946: 30.0.50; [PATCH] Fix bibtex validation for non-file buffers Date: Sun, 22 Sep 2024 14:57:05 -0500 Message-ID: <87msjzjwby.fsf@gnu.org> References: <86r0bxk2p7.fsf@gnu.org> <87a5fzlcl9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6244"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 71946@debbugs.gnu.org, Liu Hui To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 22 21:58:04 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 1ssSia-0001Tu-3Q for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Sep 2024 21:58:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ssSiD-0007WA-D7; Sun, 22 Sep 2024 15:57:41 -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 1ssSiC-0007Vu-2D for bug-gnu-emacs@gnu.org; Sun, 22 Sep 2024 15:57:40 -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 1ssSiB-0002wt-Pc for bug-gnu-emacs@gnu.org; Sun, 22 Sep 2024 15:57:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=kN9bI7diqCT1+NYtA44E/66QpNNX2wmEPUEaIhd2Ugc=; b=MMP4jSHg+KdKAelSO56fLRlyfCFkxiJq3dAGOGepS9rIBxYCGEC0yLzBUi9TOYvT7FwwIbqz9N4eoUDmgQXQyugimqxnQ6osRClHfe1CFG4+neT0rX09lATmzSUSfwKMcPwnFdr50U2LSaJUxbWD50/8/kwS9dTeul34KzYKby13W8ZDU6j1ss5eafBUlI9hykPh+Fkon8gV9ZsdQM94SuuCQ7gvZaTTYgC9BLDBa9/QW0z6O/794ZVSCuzgCfxO1szEs/Dy9q31ww0/81nIU8dmIzAhJ/bl0cuXmaT8jvstkRA9zjVRWnpXLqQV3ytl+3pD2uDJvTTd1q6sPhFwBw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ssSiX-0007Ad-Nc for bug-gnu-emacs@gnu.org; Sun, 22 Sep 2024 15:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Roland Winkler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 22 Sep 2024 19:58:01 +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.172703505827519 (code B ref 71946); Sun, 22 Sep 2024 19:58:01 +0000 Original-Received: (at 71946) by debbugs.gnu.org; 22 Sep 2024 19:57:38 +0000 Original-Received: from localhost ([127.0.0.1]:42805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssSiA-00079n-05 for submit@debbugs.gnu.org; Sun, 22 Sep 2024 15:57:38 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssSi8-00079Y-Jd for 71946@debbugs.gnu.org; Sun, 22 Sep 2024 15:57:37 -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 1ssShh-0002vb-Ah; Sun, 22 Sep 2024 15:57:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=kN9bI7diqCT1+NYtA44E/66QpNNX2wmEPUEaIhd2Ugc=; b=C340dB6oYIUM3XarI0j7 c01NDEOlSTaUUD+ofIyHn5fbB8rkH0Tf+6JC/sX33hpaNpu/LHIikLzmdDX/c/VcQ8iObVpwPhSk4 rG6isSJmI5yf021NcQqCLinR8mKWCp999qfqDmK4heJfH8+K9sMuhIJ10IFpq3ZHB3bb4czQ6+J6g 1PUJIJtTIi5GOiHwT9jRH1C5MCP7WoK+AwciyD67iCxtOPBx4nY/3CacaLx9xg2ArUauLcAT5DPtg wsTSn77BFAZZ+BKFEXjn8LxGxtLDtoX8WlWuU2BzxrZZHcJN4RtnCpZOGqaBdKG3N03UCJy5lHJzO GDhyxiz2MtA9tQ==; In-Reply-To: <87a5fzlcl9.fsf@gnu.org> (Roland Winkler's message of "Sun, 22 Sep 2024 14:20:34 -0500") 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:292254 Archived-At: --=-=-= Content-Type: text/plain On Sat, Jul 13 2024, Eli Zaretskii wrote: > Roland, is this patch okay with you, and if so, is it safe enough to > be installed on the emacs-30 release branch? (For the records: resending this message with bug#71946 unarchived so that this message goes into the bug tracker.) I am sorry, due to a silly mistake on my side, I saw your email only now. I saw that you already installed the patch in the emacs-30 relase branch. I tested the patch, it works for me, and I believe the already installed patch should be safe in 99.9% of all scenarios I can think of. However I'd suggest two minor modifications, see the patch attached below: - rename FILE-P to IS-FILE to be consistent with the emacs lisp coding conventions. - Set compilation-parse-errors-filename-function only if we do not want its default value. Shall I install this patch in the emacs-30 release branch or in master? Roland --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=bibtex.patch --- bibtex.el~ 2024-09-22 13:41:29.890443820 -0500 +++ bibtex.el 2024-09-22 14:23:17.726487214 -0500 @@ -4638,16 +4638,17 @@ (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 --=-=-=--