GNU bug report logs - #27646
Bug: Emacs Lisp Indentation

Previous Next

Package: emacs;

Reported by: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>

Date: Mon, 10 Jul 2017 20:07:01 UTC

Severity: minor

Merged with 21922

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27646 in the body.
You can then email your comments to 27646 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#27646; Package emacs. (Mon, 10 Jul 2017 20:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alexander Shukaev <emacs <at> Alexander.Shukaev.name>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 10 Jul 2017 20:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
To: bug-gnu-emacs <at> gnu.org
Cc: npostavs <at> users.sourceforge.net
Subject: Bug: Emacs Lisp Indentation
Date: Mon, 10 Jul 2017 22:05:43 +0200
Hi,

With latest Emacs, I see the following indentation quirk with the Emacs 
Lisp list:

(defconst init-font-lock-keywords
  `(,@(let ((constant-pattern "\\(?:\\sw\\|\\s_\\)+")
            (keywords         nil))
        (dolist (symbol '(init-a
                           init-b
                           init-c
                           init-d
                           init-e
                           init-f))
          (push `(,(format "(%s\\_>" symbol)
                  (,constant-pattern
                   (save-excursion
                     (search-forward-regexp ,constant-pattern))
                   nil
                   (0 font-lock-constant-face nil t)))
                keywords))
        keywords)))

instead of the expected:

(defconst init-font-lock-keywords
  `(,@(let ((constant-pattern "\\(?:\\sw\\|\\s_\\)+")
            (keywords         nil))
        (dolist (symbol '(init-a
                          init-b
                          init-c
                          init-d
                          init-e
                          init-f))
          (push `(,(format "(%s\\_>" symbol)
                  (,constant-pattern
                   (save-excursion
                     (search-forward-regexp ,constant-pattern))
                   nil
                   (0 font-lock-constant-face nil t)))
                keywords))
        keywords)))

Please, have a look as time permits.  Thank you in advance!

Kind regards,
Alexander




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27646; Package emacs. (Tue, 11 Jul 2017 01:05:01 GMT) Full text and rfc822 format available.

Message #8 received at 27646 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
Cc: 27646 <at> debbugs.gnu.org
Subject: Re: bug#27646: Bug: Emacs Lisp Indentation
Date: Mon, 10 Jul 2017 21:05:56 -0400
tags 27646 + unreproducible
quit

Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:

> Hi,
>
> With latest Emacs, I see the following indentation quirk with the
> Emacs Lisp list:
>
> (defconst init-font-lock-keywords
>   `(,@(let ((constant-pattern "\\(?:\\sw\\|\\s_\\)+")
>             (keywords         nil))
>         (dolist (symbol '(init-a
>                            init-b

That would certainly be a bug, but I can't reproduce this, when I run
indent-region or indent-sexp on that code I get the correct indentation:

(defconst init-font-lock-keywords
  `(,@(let ((constant-pattern "\\(?:\\sw\\|\\s_\\)+")
            (keywords         nil))
        (dolist (symbol '(init-a
                          init-b

In GNU Emacs 26.0.50 (build 60, x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
 of 2017-07-10 built on zony
Repository revision: 689c5c20d1174e95be50e674d05632545eb4b9c5
Windowing system distributor 'The X.Org Foundation', version 11.0.11901000
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
You can run the command ‘emacs-lisp-mode’ with M-x e-li-mo RET
Mark set
Indenting region...done
Mark activated

Configured using:
 'configure --cache-file=../debug-config.cache 'CFLAGS=-O0 -g3
 -march=native' --enable-checking=yes,glyphs
 --enable-check-lisp-object-type MAKEINFO=makeinfo-4.13a
 --with-x-toolkit=lucid --with-toolkit-scroll-bars --with-gif=no
 --with-jpeg=no 'CFLAGS=-O2 -g3 -march=native'
 --cache-file=../opt-config.cache'

Configured features:
XPM TIFF PNG RSVG SOUND GPM DBUS GSETTINGS NOTIFY ACL GNUTLS LIBXML2
FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 LIBSYSTEMD






Added tag(s) unreproducible. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Tue, 11 Jul 2017 01:05:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27646; Package emacs. (Wed, 29 Nov 2017 02:27:01 GMT) Full text and rfc822 format available.

Message #13 received at 27646 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
Cc: 27646 <at> debbugs.gnu.org
Subject: Re: bug#27646: Bug: Emacs Lisp Indentation
Date: Tue, 28 Nov 2017 21:26:14 -0500
close 27646
quit

npostavs <at> users.sourceforge.net writes:

> That would certainly be a bug, but I can't reproduce this, when I run
> indent-region or indent-sexp on that code I get the correct indentation:
>
> (defconst init-font-lock-keywords
>   `(,@(let ((constant-pattern "\\(?:\\sw\\|\\s_\\)+")
>             (keywords         nil))
>         (dolist (symbol '(init-a
>                           init-b

Closing, since there's been no followup.




bug closed, send any further explanations to 27646 <at> debbugs.gnu.org and Alexander Shukaev <emacs <at> Alexander.Shukaev.name> Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 29 Nov 2017 02:27:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Dec 2017 12:24:05 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Alexander Shukaev <emacs <at> Alexander.Shukaev.name> to control <at> debbugs.gnu.org. (Thu, 19 Dec 2019 01:18:01 GMT) Full text and rfc822 format available.

Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 19 Dec 2019 01:20:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27646; Package emacs. (Thu, 19 Dec 2019 01:28:02 GMT) Full text and rfc822 format available.

Message #24 received at 27646 <at> debbugs.gnu.org (full text, mbox):

From: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 27646 <at> debbugs.gnu.org
Subject: Re: bug#27646: Bug: Emacs Lisp Indentation
Date: Thu, 19 Dec 2019 02:27:29 +0100
On 11/29/17 3:26 AM, Noam Postavsky wrote:
> close 27646
> quit
> 
> npostavs <at> users.sourceforge.net writes:
> 
>> That would certainly be a bug, but I can't reproduce this, when I run
>> indent-region or indent-sexp on that code I get the correct indentation:
>>
>> (defconst init-font-lock-keywords
>>    `(,@(let ((constant-pattern "\\(?:\\sw\\|\\s_\\)+")
>>              (keywords         nil))
>>          (dolist (symbol '(init-a
>>                            init-b
> 
> Closing, since there's been no followup.
> 

This time I realized what's happening.  Put

(dolist (symbol '(ignore-errors
                  xxx
                  yyy)))

to the "*scratch*" buffer and indent to observe the following result

(dolist (symbol '(ignore-errors
                   xxx
                   yyy)))

The reason why this happens is because `ignore-errors' is a macro that has

(declare (indent defun))

Any other macro with the same declaration whose innocent symbol is used 
as the first element in a list would reproduce the above indentation 
bug.  Backquote is also affected.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27646; Package emacs. (Fri, 17 Jan 2020 17:59:02 GMT) Full text and rfc822 format available.

Message #27 received at 27646 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
Cc: 27646 <at> debbugs.gnu.org
Subject: Re: bug#27646: Bug: Emacs Lisp Indentation
Date: Fri, 17 Jan 2020 12:58:44 -0500
tags 27646 - moreinfo unreproducible
forcemerge 21922 27646
quit

Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:

> to the "*scratch*" buffer and indent to observe the following result
>
> (dolist (symbol '(ignore-errors
>                    xxx
>                    yyy)))
>
> The reason why this happens is because `ignore-errors' is a macro that has
>
> (declare (indent defun))
>
> Any other macro with the same declaration whose innocent symbol is
> used as the first element in a list would reproduce the above
> indentation bug.  Backquote is also affected.

That's Bug#21922, although the backquoted case is intentional (e.g., for
writing code in macros).





Removed tag(s) unreproducible and moreinfo. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 17 Jan 2020 17:59:02 GMT) Full text and rfc822 format available.

Forcibly Merged 21922 27646. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 17 Jan 2020 17:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27646; Package emacs. (Fri, 17 Jan 2020 20:28:01 GMT) Full text and rfc822 format available.

Message #34 received at 27646 <at> debbugs.gnu.org (full text, mbox):

From: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 27646 <at> debbugs.gnu.org, 21922 <at> debbugs.gnu.org
Subject: Re: bug#27646: Bug: Emacs Lisp Indentation
Date: Fri, 17 Jan 2020 21:26:49 +0100
On 17/01/2020 18:58, Noam Postavsky wrote:
> tags 27646 - moreinfo unreproducible
> forcemerge 21922 27646
> quit
> 
> Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:
> 
>> to the "*scratch*" buffer and indent to observe the following result
>>
>> (dolist (symbol '(ignore-errors
>>                     xxx
>>                     yyy)))
>>
>> The reason why this happens is because `ignore-errors' is a macro that has
>>
>> (declare (indent defun))
>>
>> Any other macro with the same declaration whose innocent symbol is
>> used as the first element in a list would reproduce the above
>> indentation bug.  Backquote is also affected.
> 
> That's Bug#21922, although the backquoted case is intentional (e.g., for
> writing code in macros).
> 

I use the following trick right now:

(dolist (symbol '(;
                  ignore-errors
                  xxx
                  yyy)))

Since it's impossible to resolve that issue reliably and for all cases 
including backquote, I propose to introduce some special comment (aka 
;###list) format to indicate that this is a list rather than code to be 
evaluated.  In different contexts the same code could be desired to be 
treated differently namely either as data or as to be evaluated.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#27646; Package emacs. (Sun, 30 Jan 2022 22:47:02 GMT) Full text and rfc822 format available.

Message #37 received at 27646 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Alexander Shukaev <emacs <at> Alexander.Shukaev.name>
Cc: 27646 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>,
 21922 <at> debbugs.gnu.org
Subject: Re: bug#27646: Bug: Emacs Lisp Indentation
Date: Sun, 30 Jan 2022 23:46:45 +0100
Alexander Shukaev <emacs <at> Alexander.Shukaev.name> writes:

> I use the following trick right now:
>
> (dolist (symbol '(;
>                   ignore-errors
>                   xxx
>                   yyy)))
>
> Since it's impossible to resolve that issue reliably and for all cases
> including backquote, I propose to introduce some special comment (aka
> ;###list) format to indicate that this is a list rather than code to
> be evaluated.  In different contexts the same code could be desired to
> be treated differently namely either as data or as to be evaluated.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This is bee fixed in recent Emacs version by introducing the following
convention:

(dolist (symbol '( ignore-errors
                   xxx
                   yyy)))

That is, a space after the opening parenthesis to signal that it's a
list and not code.

I'm therefore closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 27646 <at> debbugs.gnu.org and Alexander Shukaev <emacs <at> Alexander.Shukaev.name> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 30 Jan 2022 22:48:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 28 Feb 2022 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 124 days ago.

Previous Next


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