GNU bug report logs - #76498
(ert-deftest) has indentation of 13 by default

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: minor; Reported by: Konstantin Kharlamov <Hi-Angel@HIDDEN>; dated Sun, 23 Feb 2025 10:04:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 76498) by debbugs.gnu.org; 2 Mar 2025 13:43:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 02 08:43:53 2025
Received: from localhost ([127.0.0.1]:56067 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tojbk-0002zv-Uv
	for submit <at> debbugs.gnu.org; Sun, 02 Mar 2025 08:43:53 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:57192)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1tojbi-0002zR-59
 for 76498 <at> debbugs.gnu.org; Sun, 02 Mar 2025 08:43:51 -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 1tojbc-0006bk-CR; Sun, 02 Mar 2025 08:43:44 -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=LDQvG8Twj9hrqjGftJY38rxZCwvZcxs/XOWt/LUmLhc=; b=sgsA1vxEdVC8/BLvl5oB
 CkSuTs1wE+poxdmnUNPe+H/fZTi2NHoepLrQBy6emqKI8asG2iQkpmhIgv7nxKaVRP+xzwdmtZFZ3
 KserVFdJYAl1XFOLSc7T/5FfcHZmYEFwPnoqDHdvh995Epv2K3f27JrtE7i11I21gTCKLJ7N7oler
 RzfJ7et7A73ryD2dQRm2CdIlSUN2gNY4TqzeXTdhK/eqJEdEaVzn9zLB5HCUURWjDk2fmT0ty+h/w
 jpHBVZFGj7fJ/8F312NKFQVEaPhWVcX4AODxjF+Uav5Mmx3yFAx6Yl0sCv1ET2olG+94eaIHSO/ja
 WpQGkchnoMNcww==;
Date: Sun, 02 Mar 2025 15:43:42 +0200
Message-Id: <864j0bo8dt.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkmm_edvNs8_VWN_RaY=DEnCLDpOxfu26PUoWL7BabvG-jQ@HIDDEN>
 (message from Stefan Kangas on Sun, 2 Mar 2025 04:45:32 -0800)
Subject: Re: bug#76498: (ert-deftest) has indentation of 13 by default
References: <e0f99635b3e744c156e9fb67eeb02abb941e5994.camel@HIDDEN>
 <CADwFkmm_edvNs8_VWN_RaY=DEnCLDpOxfu26PUoWL7BabvG-jQ@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76498
Cc: 76498 <at> debbugs.gnu.org, monnier@HIDDEN, Hi-Angel@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: -3.3 (---)

> From: Stefan Kangas <stefankangas@HIDDEN>
> Date: Sun, 2 Mar 2025 04:45:32 -0800
> Cc: 76498 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>, 
> 	Stefan Monnier <monnier@HIDDEN>
> 
> Konstantin Kharlamov <Hi-Angel@HIDDEN> writes:
> 
> > I'm writing tests for purescript-mode package, and I stumbled upon odd
> > behavior: `ert-deftest` is spuriously indented to either 2 (expected)
> > or 13 (unexpected).
> >
> > After digging into it, I found that if you `emacs -Q some-file-with-
> > tests.el` and try to indent the second line after `ert-deftest`, you'll
> > get size of 13. But if you `(require 'ert)` and try again you'll get 2.
> >
> > This is because, even though `ert-deftest` keyword is declared inside
> > `lisp-mode.el`, but *indentation size* for it resides instead in
> > `ert.el`, as part of "declare" statement of `ert-deftest` macro.
> >
> > This is definitely not expected. First of all, there's no reason for
> > user to evaluate `(require 'ert)` while working with tests — you
> > wouldn't want to experiment with tests in your working Emacs anyway.
> > Which means you get incorrect indentation and left wondering what's
> > happening. Second of all, `ert-deftest` as a keyword resides inside
> > `lisp-mode.el` anyway, so what's the point of having the indentation
> > set in a different place.
> >
> > Could we move the indentation size to `lisp-mode.el`, please?
> 
> I think this is a more general problem that applies to basically any
> macro.  Instead of fixing this locally just for that one macro, maybe we
> should make autoload pick up on that automatically (for autoloaded
> macros)?
> 
> Eli, Stefan, WDYT?

I have no opinion on this (and don't understand the OP's use case in
the first place: does he want Emacs to know about ERT-sepcific macros
without loading ert??), sorry.




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

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


Received: (at 76498) by debbugs.gnu.org; 2 Mar 2025 12:45:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 02 07:45:44 2025
Received: from localhost ([127.0.0.1]:55407 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1toihU-0005z0-GJ
	for submit <at> debbugs.gnu.org; Sun, 02 Mar 2025 07:45:44 -0500
Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:50287)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>)
 id 1toihP-0005yP-Dk
 for 76498 <at> debbugs.gnu.org; Sun, 02 Mar 2025 07:45:41 -0500
Received: by mail-ed1-x533.google.com with SMTP id
 4fb4d7f45d1cf-5e04064af07so6437489a12.0
 for <76498 <at> debbugs.gnu.org>; Sun, 02 Mar 2025 04:45:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1740919533; x=1741524333; darn=debbugs.gnu.org;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=OTb6KA+u73LCbzhBdYBLs8OBhP5hDHyZxCIXxoPtWYQ=;
 b=JwPnwtqFHnifVAc/GpHi4PK8MWY4hi03IkEHl/qci+sfGUxkphwd8da87/uYg89p8G
 sHn1p6icuIaKBdSgVvIbfqfhEJAQ2QpvR0Lu/CklL6ci6fsRAgcpwO72ESFFC6Rhycg9
 iH5oyktxQczlVUwDYvJR2xtZXOHoIiwfaNLhm9tDZxP6YMC9ofpS7jnLo26dpXercn2c
 VXCHtio37b1LIqIEbrW8Qj+XyRjxrDcL25UeWjv5uPQV3ezQYBmw7YJAyE1KIcV6yxdi
 0PmWkehWeoF+Q3TTGFZkNL5F/dMJ3uNz0uaE76X1uZLM9jCM6E2IsymXeEVP0DeROAJM
 4g/Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1740919533; x=1741524333;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=OTb6KA+u73LCbzhBdYBLs8OBhP5hDHyZxCIXxoPtWYQ=;
 b=bKWXwAcWQ384jqq73RrO+HzM27EkFilptzzp6hSKo21j5Nd4FmxoE3jZVytY79J20r
 1qm5Er0W54FRsqaasb5xFbVbx8CyfkXOKxNnS0m4Bo9YJazu/L0WZdbOiAalNax39Hdm
 nha8VHsbpMebWmhd+6WEVkkWZ2vaRe+Q9bxMd7wQ793TuhrClzLGQWnIPWmc6ZSxkafh
 AUaiQ5Nx89oPMK6nnzd+aBuN8gIqPAQyrrZ1jzCfRccqiDHJCUCHr/asdo7/EK/kdAjk
 llOivKvfrb6Sccoty1IYeKar1vn5KN48jBEsNT7UM+CiuadHM3OcgFrRUKSGvyNkehGQ
 ukCA==
X-Gm-Message-State: AOJu0Yw3/4dbP3UmyiyW7T8lCbJBjvnbLVkSegNxFGiQoUnVVnSF1a5b
 kVyO7nk4zxmMDdr6MWjKZ7yuVysYw7g+5fDH03WyIWUqz1G9vGzK+pLh/aOG3LgNMGLz0Xv3QUx
 61s1qfVsZQ8wzJGcrlCYR7LNI2vc=
X-Gm-Gg: ASbGncuv0Y6snzzTavdPyawj+2ohiJI9JIBmhYab9nT36ERyqZXDW9tA40udbMaeZ9v
 CP/76S4KbSE/nq73GQYDtQSkPqh6BfGCAZlgY8HJW5TMuenIxprk+ZA3tEBoagptHZQekPKUVzX
 4todKZbF1OCl3F0tZjiU53u6Qwff8=
X-Google-Smtp-Source: AGHT+IHghRtDk1v8s56xhgdiTL/+1CEc8if5do4BWLFtPSji0CDmAteLX8eNoq3HG8nz61sUtjvJTvByq2GrDdtagLE=
X-Received: by 2002:a05:6402:524a:b0:5e5:35e6:72de with SMTP id
 4fb4d7f45d1cf-5e535e6745amr4596259a12.28.1740919533255; Sun, 02 Mar 2025
 04:45:33 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 2 Mar 2025 04:45:32 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <e0f99635b3e744c156e9fb67eeb02abb941e5994.camel@HIDDEN>
References: <e0f99635b3e744c156e9fb67eeb02abb941e5994.camel@HIDDEN>
MIME-Version: 1.0
Date: Sun, 2 Mar 2025 04:45:32 -0800
X-Gm-Features: AQ5f1JoBm8Y4yT7e6EG5RjWZGfDYy7C0yuX7zNJv1g0sLXCrlrcoW8dEIwxTyDc
Message-ID: <CADwFkmm_edvNs8_VWN_RaY=DEnCLDpOxfu26PUoWL7BabvG-jQ@HIDDEN>
Subject: Re: bug#76498: (ert-deftest) has indentation of 13 by default
To: Konstantin Kharlamov <Hi-Angel@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76498
Cc: Eli Zaretskii <eliz@HIDDEN>, 76498 <at> debbugs.gnu.org,
 Stefan Monnier <monnier@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 (-)

Konstantin Kharlamov <Hi-Angel@HIDDEN> writes:

> I'm writing tests for purescript-mode package, and I stumbled upon odd
> behavior: `ert-deftest` is spuriously indented to either 2 (expected)
> or 13 (unexpected).
>
> After digging into it, I found that if you `emacs -Q some-file-with-
> tests.el` and try to indent the second line after `ert-deftest`, you'll
> get size of 13. But if you `(require 'ert)` and try again you'll get 2.
>
> This is because, even though `ert-deftest` keyword is declared inside
> `lisp-mode.el`, but *indentation size* for it resides instead in
> `ert.el`, as part of "declare" statement of `ert-deftest` macro.
>
> This is definitely not expected. First of all, there's no reason for
> user to evaluate `(require 'ert)` while working with tests =E2=80=94 you
> wouldn't want to experiment with tests in your working Emacs anyway.
> Which means you get incorrect indentation and left wondering what's
> happening. Second of all, `ert-deftest` as a keyword resides inside
> `lisp-mode.el` anyway, so what's the point of having the indentation
> set in a different place.
>
> Could we move the indentation size to `lisp-mode.el`, please?

I think this is a more general problem that applies to basically any
macro.  Instead of fixing this locally just for that one macro, maybe we
should make autoload pick up on that automatically (for autoloaded
macros)?

Eli, Stefan, WDYT?




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

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


Received: (at submit) by debbugs.gnu.org; 23 Feb 2025 10:03:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 23 05:03:47 2025
Received: from localhost ([127.0.0.1]:59409 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tm8pv-0001k8-04
	for submit <at> debbugs.gnu.org; Sun, 23 Feb 2025 05:03:47 -0500
Received: from lists.gnu.org ([2001:470:142::17]:34542)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <Hi-Angel@HIDDEN>)
 id 1tm8pj-0001ja-Lw
 for submit <at> debbugs.gnu.org; Sun, 23 Feb 2025 05:03:36 -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 <Hi-Angel@HIDDEN>)
 id 1tm8pR-0005r0-5i
 for bug-gnu-emacs@HIDDEN; Sun, 23 Feb 2025 05:03:22 -0500
Received: from forward100b.mail.yandex.net ([2a02:6b8:c02:900:1:45:d181:d100])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Hi-Angel@HIDDEN>)
 id 1tm8pI-00038C-Kq
 for bug-gnu-emacs@HIDDEN; Sun, 23 Feb 2025 05:03:13 -0500
Received: from mail-nwsmtp-smtp-production-main-57.sas.yp-c.yandex.net
 (mail-nwsmtp-smtp-production-main-57.sas.yp-c.yandex.net
 [IPv6:2a02:6b8:c1c:2eaa:0:640:ad48:0])
 by forward100b.mail.yandex.net (Yandex) with ESMTPS id 218E360ADD
 for <bug-gnu-emacs@HIDDEN>; Sun, 23 Feb 2025 13:03:00 +0300 (MSK)
Received: by mail-nwsmtp-smtp-production-main-57.sas.yp-c.yandex.net
 (smtp/Yandex) with ESMTPSA id x2XwKEDLZ0U0-c9vnk6Jm; 
 Sun, 23 Feb 2025 13:02:59 +0300
X-Yandex-Fwd: 1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail;
 t=1740304979; bh=qcxRhXut6fvV8i8idENgA0W9nJLMqudYVpHDLjHGviM=;
 h=Date:To:From:Subject:Message-ID;
 b=fJkjB3Phpl6DDigj9PeP+YEziEVqb+TCbv0PM0vdg8fat9aemAms5hck80y4ZzFEP
 R5kYX3TSOa0R/kkZtaya7f+eODP5R/SOR2SccHiNsNvZSrrARj+JLQhYlf3LGumf4N
 UIeyoBrlPWDKlMZJ0tRGPEaRPOttJoAv//6V6eV8=
Authentication-Results: mail-nwsmtp-smtp-production-main-57.sas.yp-c.yandex.net;
 dkim=pass header.i=@yandex.ru
Message-ID: <e0f99635b3e744c156e9fb67eeb02abb941e5994.camel@HIDDEN>
Subject: (ert-deftest) has indentation of 13 by default
From: Konstantin Kharlamov <Hi-Angel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Date: Sun, 23 Feb 2025 13:02:59 +0300
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
User-Agent: Evolution 3.54.3 
MIME-Version: 1.0
Received-SPF: pass client-ip=2a02:6b8:c02:900:1:45:d181:d100;
 envelope-from=Hi-Angel@HIDDEN; helo=forward100b.mail.yandex.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.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_FROM=0.001,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
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: -0.0 (/)

I'm writing tests for purescript-mode package, and I stumbled upon odd
behavior: `ert-deftest` is spuriously indented to either 2 (expected)
or 13 (unexpected).

After digging into it, I found that if you `emacs -Q some-file-with-
tests.el` and try to indent the second line after `ert-deftest`, you'll
get size of 13. But if you `(require 'ert)` and try again you'll get 2.

This is because, even though `ert-deftest` keyword is declared inside
`lisp-mode.el`, but *indentation size* for it resides instead in
`ert.el`, as part of "declare" statement of `ert-deftest` macro.

This is definitely not expected. First of all, there's no reason for
user to evaluate `(require 'ert)` while working with tests =E2=80=94 you
wouldn't want to experiment with tests in your working Emacs anyway.
Which means you get incorrect indentation and left wondering what's
happening. Second of all, `ert-deftest` as a keyword resides inside
`lisp-mode.el` anyway, so what's the point of having the indentation
set in a different place.

Could we move the indentation size to `lisp-mode.el`, please?




Acknowledgement sent to Konstantin Kharlamov <Hi-Angel@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#76498; 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: Sun, 2 Mar 2025 13:45:02 UTC

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