GNU bug report logs - #60001
[PATCH] Improve completion of treesit-check-indent command

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Daniel Martín <mardani29@HIDDEN>; Keywords: patch; dated Mon, 12 Dec 2022 10:54:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 60001 <at> debbugs.gnu.org:


Received: (at 60001) by debbugs.gnu.org; 7 Jan 2023 23:14:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jan 07 18:14:04 2023
Received: from localhost ([127.0.0.1]:59227 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pEIO4-0007TO-7R
	for submit <at> debbugs.gnu.org; Sat, 07 Jan 2023 18:14:04 -0500
Received: from mail-pl1-f169.google.com ([209.85.214.169]:35571)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1pEIO1-0007Si-UY
 for 60001 <at> debbugs.gnu.org; Sat, 07 Jan 2023 18:14:02 -0500
Received: by mail-pl1-f169.google.com with SMTP id y1so5605410plb.2
 for <60001 <at> debbugs.gnu.org>; Sat, 07 Jan 2023 15:14:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:cc:date:message-id:subject:mime-version
 :content-transfer-encoding:from:from:to:cc:subject:date:message-id
 :reply-to; bh=ktMg1WO2MDSADcN75lyce4/o/kBB4K+Iq/cKJGbYP58=;
 b=kV2HcAYo4jmcUa1z9EFzPULi+m0PkKLKza+0GRv/PS4KzdnbDqDHIcftVr/DyQxfM6
 DcYi5nIxL9FdK0cbfomZlvnxOp/MiGvt1iItwYThoMmyT9BsaI0oBRg0sYwATVGIit0n
 zRzZK94pM7fuFT/7VL+o2KXfbaahodhkU5DIpJ/BXKdXjGhMSZ6fcqMqpYW74qBDFpNV
 3x1icq0F/SQxnKYU7VK1qTgXj7Fz6ZtsCjFD4yvN2MExxPDA8muKe8LIL5VLUnmxUy28
 dwA/B/Nmtu/JczEb+51YsBD1aq3gYwPiZRfj1svaTRISBd0yIzJFSle9QQYDlmeGkEU2
 lBLw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=to:cc:date:message-id:subject:mime-version
 :content-transfer-encoding:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=ktMg1WO2MDSADcN75lyce4/o/kBB4K+Iq/cKJGbYP58=;
 b=2i615adXk0wRjx2towP7Z8JB7QGmCvJCfUyYOcBa3m/yCKP2/WVLsw5FGFX3ZkHWTs
 GxD2D8YD6UZv3s89sJzWkbvkTxJ1er+dKErEPErUS/fuKAh3JlQtja2KCke7bbkg1Vom
 a/Z25kYBzB1Xzdh1T6wuEfVhk4H617YqZCGDgRzpDBYKOu9F9FCj4pVSfzm3r3Q7CUIL
 S0cc8oDk/a1g/ChCHY0mZcHH5ZcrVz/wbcC0IZmctD0QkjaiatcVCRCYSkkPRfcIHgSP
 nvjJ6tLo8poU/Pyxvv/d3xMRyaofpbbR6AnbhapaUccQgk1eJk2j1yA6rJ5fVlGzJQSV
 tn5g==
X-Gm-Message-State: AFqh2kokgPF97k2lHZNSP5YwcvxnokzxDc4CK4pHZLnpKGqlMZYHNmnS
 H5J94iEk/ZBjXqJ71816pJs=
X-Google-Smtp-Source: AMrXdXtkMcWK/8pfcuuMiEFADQNPk08H4yVRUJaAQP+0ZSBMuw0V6n4EOqcoRUvOvhH8WAecKttqyA==
X-Received: by 2002:a17:902:e152:b0:193:3de:b777 with SMTP id
 d18-20020a170902e15200b0019303deb777mr8849135pla.43.1673133236257; 
 Sat, 07 Jan 2023 15:13:56 -0800 (PST)
Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com.
 [172.117.161.177]) by smtp.gmail.com with ESMTPSA id
 n7-20020a170902e54700b00191292875desm3205374plf.279.2023.01.07.15.13.55
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Sat, 07 Jan 2023 15:13:55 -0800 (PST)
From: Yuan Fu <casouri@HIDDEN>
Content-Type: text/plain;
	charset=utf-8
Content-Transfer-Encoding: quoted-printable
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\))
Subject: Re: bug#60001: [PATCH] Improve completion of treesit-check-indent 
 command
Message-Id: <7FDC90A2-7616-434D-9737-4463F083C3F2@HIDDEN>
Date: Sat, 7 Jan 2023 15:13:54 -0800
To: Eli Zaretskii <eliz@HIDDEN>
X-Mailer: Apple Mail (2.3696.120.41.1.1)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 60001
Cc: 60001 <at> debbugs.gnu.org, =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Mon, 12 Dec 2022 11:53:00 +0100
>> From:  Daniel Mart=C3=ADn via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
>>=20
>> The treesit-check-indent command is not really related to Tree-sitter
>> and could be in a more general place than treesit.el.  WDYT?
>
> I agree, but then we'd need a definition for it that doesn't need
> tree-sitter support.  Is that easy to provide?
>
>> In any case, I have a patch to improve this command a bit by offering
>> more accurate completion for major modes, not Emacs commands.  I have
>> also tried to improve its documentation a bit.
>
> How about a read-major-mode function in subr.el?
>
> But I think all these generalizations and improvements should go to
> master.  On the release branch, I'd prefer to leave
> treesit-check-indent alone.

Has this patch been pushed to master? Should I close this report?

Yuan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60001; Package emacs. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 60001 <at> debbugs.gnu.org:


Received: (at 60001) by debbugs.gnu.org; 12 Dec 2022 14:00:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 12 09:00:33 2022
Received: from localhost ([127.0.0.1]:53123 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p4jM8-0007CQ-RY
	for submit <at> debbugs.gnu.org; Mon, 12 Dec 2022 09:00:33 -0500
Received: from eggs.gnu.org ([209.51.188.92]:43064)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1p4jM7-0007CI-6i
 for 60001 <at> debbugs.gnu.org; Mon, 12 Dec 2022 09:00:31 -0500
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 <eliz@HIDDEN>)
 id 1p4jM0-0000Im-TP; Mon, 12 Dec 2022 09:00:25 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=n0/vs1PY0xzjlwaFwoshadFXTJqCae69OquRCP6NNsI=; b=m7zsfOfEZ7dQDFHn+em8
 1ATKemPRG/Q/y/E6gHlpwdurdizKEoOIGUh/OJcDbtqnEShUngw8Dqtj/yxw4FiMuzwGUFjo8WOCY
 XAE5ahMpaB5bzrrIIel/R+2pZWnNbVCPaE+7BiwKSphhiJnzsa+wuh5ZFuz8FTj6e7OXMjyOUB6vP
 0w8G6O0NQ+Qbn4kN0I13F+AUdVZg7TXt0aYSkXjF03FLFtfKhohsaxnvHmI2ouz31j5GH6tRYJfyV
 brD4CoLeCD/mxdGnjlZm0lLGdX5AnXSFd3BooSFr/XvVPTOg2qNwAjrlmFS0HKzc3iXWfMymobNDG
 W9o+5pi8qQSXMw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1p4jLy-00082N-Rm; Mon, 12 Dec 2022 09:00:23 -0500
Date: Mon, 12 Dec 2022 16:00:24 +0200
Message-Id: <838rjcsow7.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Daniel =?iso-8859-1?Q?Mart=EDn?= <mardani29@HIDDEN>
In-Reply-To: <m1wn6wj3lf.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#60001: [PATCH] Improve completion of treesit-check-indent
 command
References: <m1wn6wj3lf.fsf.ref@HIDDEN> <m1wn6wj3lf.fsf@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 60001
Cc: 60001 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Mon, 12 Dec 2022 11:53:00 +0100
> From:  Daniel Martín via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> The treesit-check-indent command is not really related to Tree-sitter
> and could be in a more general place than treesit.el.  WDYT?

I agree, but then we'd need a definition for it that doesn't need
tree-sitter support.  Is that easy to provide?

> In any case, I have a patch to improve this command a bit by offering
> more accurate completion for major modes, not Emacs commands.  I have
> also tried to improve its documentation a bit.

How about a read-major-mode function in subr.el?

But I think all these generalizations and improvements should go to
master.  On the release branch, I'd prefer to leave
treesit-check-indent alone.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#60001; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Dec 2022 10:53:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 12 05:53:13 2022
Received: from localhost ([127.0.0.1]:52171 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1p4gQr-00007a-5i
	for submit <at> debbugs.gnu.org; Mon, 12 Dec 2022 05:53:13 -0500
Received: from lists.gnu.org ([209.51.188.17]:45274)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mardani29@HIDDEN>) id 1p4gQp-00007T-NM
 for submit <at> debbugs.gnu.org; Mon, 12 Dec 2022 05:53:12 -0500
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 <mardani29@HIDDEN>)
 id 1p4gQn-0002oa-Sg
 for bug-gnu-emacs@HIDDEN; Mon, 12 Dec 2022 05:53:11 -0500
Received: from sonic306-19.consmr.mail.ir2.yahoo.com ([77.238.176.205])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <mardani29@HIDDEN>)
 id 1p4gQl-0001W2-VD
 for bug-gnu-emacs@HIDDEN; Mon, 12 Dec 2022 05:53:09 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048;
 t=1670842385; bh=/E0fB+wCaVnqvwIC4V654F0LHFNrBKBz3fd0K+xBFXg=;
 h=From:To:Subject:Date:References:From:Subject:Reply-To;
 b=TB/xgjffDWRx7No8Y9gTIS118CxjNN2e4QgM+CvKmCKCOy4Rjh4ZvU3ziTMTEy6I2Pl5PPiUwSExchch4jh8teA6Bk1A01/pE3OVwA4oEvTDfzzUqF1JfE3Cl45Dg0n8JDofwuc+bw+MwUU4uxqW3HdyslkJNMKm+AMVKphAHzb3Xc0BAUoeGLOtWY1dr4Sv7Jv0hEkroYICBWBVASJI0gjdlhc2F+0vxlgmrpKRcSzmgsc9uIGlvgKv0Cb54MlVNdZzjYPh+21tW/kyclys/oMrjJIRXdL6H+uXXHcF281kQkzOs2wXp4J0WbZ6es0COZYOjeuG2EwV2MJRdiLwYQ==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1670842385; bh=gmDj+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1Rp2LRCab73YbH6VZhAUGAOs46J3LSRk50xrTxb_T2I.weCpoTKp
 2XPHpJgUGfHOHRWAxUI.Q7jloQiueZZti5UArWp9VozrI638vfdqDb4aZY.H5OGlLktaAylvFDRa
 V.Bbvd857mV__06RJiNXcJ.jdfieGIP9kmTHvqyqL_DZM24P1AREalFitEv44iv.gamlPHqjCDv9
 u3H_IKwiru3WZyqc7dL9ZAdD2MUWvqcPCs6CslkvcmtMzC0JWdU3sRynU9.QI9fEuURWZR1pu_k6
 V0TDD.o18F7TkIdN3jCe.6zXVptVlcLDpDINAReuycdNhTUZ2Jf9wEtRvzbi_FrsgZ35GcweOorg
 sZCIAvj2fy52wsLwi3ajl96YuZAjh5.SAgfKIrHUfeom0F3dXB7uhFK8TayMCBEuzijh44cUXVfo
 s6Yu4QxoyVDaDlGE9e9924ONBOGN_B5JH62zZBZ6kgUytjxO1vvda.jTR7tKWj.YrfpW2ULLqlMW
 hnxwCeoSB7PA2HFKzht.89rXt02ZbER9XPZILDtHK3e8LLsffBmLvfa.ZQSlMp9RfX_F5X12fcuI
 pF1PsnZ3F5_yJhp2kQKRgP25qp_Ao
X-Sonic-MF: <mardani29@HIDDEN>
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic306.consmr.mail.ir2.yahoo.com with HTTP; Mon, 12 Dec 2022 10:53:05 +0000
Received: by hermes--production-ir2-5795fc58c8-7hl5q (Yahoo Inc. Hermes SMTP
 Server) with ESMTPA ID bb74469f613b55ce5d2ae83368092076; 
 Mon, 12 Dec 2022 10:53:02 +0000 (UTC)
From: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Improve completion of treesit-check-indent command
Date: Mon, 12 Dec 2022 11:53:00 +0100
Message-ID: <m1wn6wj3lf.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
References: <m1wn6wj3lf.fsf.ref@HIDDEN>
X-Mailer: WebService/1.1.20926
 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo
Content-Length: 2597
Received-SPF: pass client-ip=77.238.176.205; envelope-from=mardani29@HIDDEN;
 helo=sonic306-19.consmr.mail.ir2.yahoo.com
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain

Tags: patch


The treesit-check-indent command is not really related to Tree-sitter
and could be in a more general place than treesit.el.  WDYT?

In any case, I have a patch to improve this command a bit by offering
more accurate completion for major modes, not Emacs commands.  I have
also tried to improve its documentation a bit.

Thanks.


--=-=-=
Content-Type: text/patch
Content-Disposition: attachment;
 filename=0001-Improve-completion-of-treesit-check-indent-command.patch

From e6699c1671f3f13fa7d98ef958c0159e80aa2645 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@HIDDEN>
Date: Mon, 12 Dec 2022 11:33:01 +0100
Subject: [PATCH] Improve completion of treesit-check-indent command

* lisp/treesit.el (treesit--read-major-mode): Helper function to
provide completion for most major modes.
(treesit-check-indent): Use the new interactive spec and improve the
docstring.
---
 lisp/treesit.el | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 85154d0d1c..de18796628 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1469,12 +1469,28 @@ treesit-simple-indent
                         (message "No matched rule"))
                       (cons nil nil))))))
 
-(defun treesit-check-indent (mode)
-  "Check current buffer's indentation against a major mode MODE.
+(defun treesit--read-major-mode ()
+  "Read a major mode using completion.
+Helper function to use in the `interactive' spec of `treesit-check-indent'."
+  (let* ((default (and (symbolp major-mode) (symbol-name major-mode)))
+	 (mode
+	  (completing-read
+	   (format-prompt "Target major mode" default)
+	   obarray
+	   (lambda (sym)
+	     (and (string-match-p "-mode\\'" (symbol-name sym))
+		  (not (or (memq sym minor-mode-list)
+                           (string-match-p "-minor-mode\\'"
+                                           (symbol-name sym))))))
+	   nil nil nil default nil)))
+    (cond
+     ((equal mode "nil") nil)
+     ((and (stringp mode) (fboundp (intern mode))) (intern mode))
+     (t mode))))
 
-Pop up a diff buffer showing the difference.  Correct
-indentation (target) is in green, current indentation is in red."
-  (interactive "CTarget major mode: ")
+(defun treesit-check-indent (mode)
+  "Compare the current buffer with how major mode MODE would indent it."
+  (interactive (list (treesit--read-major-mode)))
   (let ((source-buf (current-buffer)))
     (with-temp-buffer
       (insert-buffer-substring source-buf)
-- 
2.34.1


--=-=-=--




Acknowledgement sent to Daniel Martín <mardani29@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#60001; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 7 Jan 2023 23:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.