GNU bug report logs -
#76498
(ert-deftest) has indentation of 13 by default
Previous Next
To reply to this bug, email your comments to 76498 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76498
; Package
emacs
.
(Sun, 23 Feb 2025 10:04:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 23 Feb 2025 10:04:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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?
Severity set to 'minor' from 'normal'
Request was from
Stefan Kangas <stefankangas <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 24 Feb 2025 21:51:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76498
; Package
emacs
.
(Sun, 02 Mar 2025 12:46:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 76498 <at> debbugs.gnu.org (full text, mbox):
Konstantin Kharlamov <Hi-Angel <at> yandex.ru> 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?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76498
; Package
emacs
.
(Sun, 02 Mar 2025 13:44:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 76498 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Sun, 2 Mar 2025 04:45:32 -0800
> Cc: 76498 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
> Stefan Monnier <monnier <at> iro.umontreal.ca>
>
> Konstantin Kharlamov <Hi-Angel <at> yandex.ru> 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 <at> gnu.org
:
bug#76498
; Package
emacs
.
(Sun, 02 Mar 2025 13:50:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 76498 <at> debbugs.gnu.org (full text, mbox):
On Sun, 2025-03-02 at 15:43 +0200, Eli Zaretskii wrote:
> > From: Stefan Kangas <stefankangas <at> gmail.com>
> > Date: Sun, 2 Mar 2025 04:45:32 -0800
> > Cc: 76498 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
> > Stefan Monnier <monnier <at> iro.umontreal.ca>
> >
> > Konstantin Kharlamov <Hi-Angel <at> yandex.ru> 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.
Yes. You see, Emacs already knows about them even without loading
`ert`, because it highlights them. So we're in a situation where it
half-works half-doesn't. It probably either shouldn't work completely
or work fully. And since we're dealing with Emacs built-in library and
not some 3rd-party code, I see no reason, why couldn't indentation work
OOTB.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#76498
; Package
emacs
.
(Sun, 02 Mar 2025 14:27:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 76498 <at> debbugs.gnu.org (full text, mbox):
> 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 guess the indentation could `autoload-do-load` before checking the
symbol's `lisp-indent-function`.
Stefan
This bug report was last modified 104 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.