GNU bug report logs - #15467
CSS-mode gives weird indentation when you put opening bracket on its own line

Previous Next

Package: emacs;

Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>

Date: Thu, 26 Sep 2013 14:24:01 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

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 15467 in the body.
You can then email your comments to 15467 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#15467; Package emacs. (Thu, 26 Sep 2013 14:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Pogonyshev <pogonyshev <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 26 Sep 2013 14:24:02 GMT) Full text and rfc822 format available.

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

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: CSS-mode gives weird indentation when you put opening bracket on its
 own line
Date: Thu, 26 Sep 2013 16:23:42 +0200
[Message part 1 (text/plain, inline)]
For example, if you create a CSS buffer and put

.xxx
{
}

into it, indentation adds one space before '{'. Confusingly, if you add one
or more empty line at the start (i.e. before this only rule), indentation
is back to normal, with '{' in the column 0. However, this seems to apply
only to the very first rule, all others are always broken.

Paul
[Message part 2 (text/html, inline)]

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Fri, 04 Oct 2013 21:47:01 GMT) Full text and rfc822 format available.

Notification sent to Paul Pogonyshev <pogonyshev <at> gmail.com>:
bug acknowledged by developer. (Fri, 04 Oct 2013 21:47:02 GMT) Full text and rfc822 format available.

Message #10 received at 15467-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Cc: 15467-done <at> debbugs.gnu.org
Subject: Re: bug#15467: CSS-mode gives weird indentation when you put opening
 bracket on its own line
Date: Fri, 04 Oct 2013 17:46:15 -0400
> For example, if you create a CSS buffer and put
> .xxx
> {
> }
> into it, indentation adds one space before '{'. Confusingly, if you add one

Indeed, thanks.  Should be fixed now in the trunk thanks to the
patch below.


        Stefan


--- lisp/textmodes/css-mode.el	2013-08-29 21:00:18 +0000
+++ lisp/textmodes/css-mode.el	2013-10-04 21:40:55 +0000
@@ -302,6 +302,7 @@
   (pcase (cons kind token)
     (`(:elem . basic) css-indent-offset)
     (`(:elem . arg) 0)
+    (`(:list-intro . "") t)             ;"" stands for BOB (bug#15467).
     (`(:before . "{") (if (smie-rule-hanging-p)
                          (smie-rule-parent 0)))))
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15467; Package emacs. (Mon, 07 Oct 2013 07:15:02 GMT) Full text and rfc822 format available.

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

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15467-done <at> debbugs.gnu.org
Subject: Re: bug#15467: CSS-mode gives weird indentation when you put opening
 bracket on its own line
Date: Mon, 7 Oct 2013 09:14:05 +0200
[Message part 1 (text/plain, inline)]
This fixes the problem I originally reported, but there seem to be more:

.x1
{
}

.x2
 {
 }

div.x3
   {
   }

As you see only the first rule is indented properly.

As a feature request, it would be nice if '}' triggered auto-indent on
insertion, as in e.g. various programming modes.

Paul


On 4 October 2013 23:46, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> > For example, if you create a CSS buffer and put
> > .xxx
> > {
> > }
> > into it, indentation adds one space before '{'. Confusingly, if you add
> one
>
> Indeed, thanks.  Should be fixed now in the trunk thanks to the
> patch below.
>
>
>         Stefan
>
>
> --- lisp/textmodes/css-mode.el  2013-08-29 21:00:18 +0000
> +++ lisp/textmodes/css-mode.el  2013-10-04 21:40:55 +0000
> @@ -302,6 +302,7 @@
>    (pcase (cons kind token)
>      (`(:elem . basic) css-indent-offset)
>      (`(:elem . arg) 0)
> +    (`(:list-intro . "") t)             ;"" stands for BOB (bug#15467).
>      (`(:before . "{") (if (smie-rule-hanging-p)
>                           (smie-rule-parent 0)))))
>
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15467; Package emacs. (Mon, 07 Oct 2013 15:42:01 GMT) Full text and rfc822 format available.

Message #16 received at 15467-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Paul Pogonyshev <pogonyshev <at> gmail.com>
Cc: 15467-done <at> debbugs.gnu.org
Subject: Re: bug#15467: CSS-mode gives weird indentation when you put opening
 bracket on its own line
Date: Mon, 07 Oct 2013 11:41:29 -0400
> This fixes the problem I originally reported, but there seem to be more:
> .x1
> {
> }

> .x2
>  {
>  }

> div.x3
>    {
>    }

Thanks.  Should be fixed now.

> As a feature request, it would be nice if '}' triggered auto-indent on
> insertion, as in e.g. various programming modes.

Now electric-indent-mode obeys css-electric-keys.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15467; Package emacs. (Tue, 08 Oct 2013 07:05:02 GMT) Full text and rfc822 format available.

Message #19 received at 15467-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Pogonyshev <pogonyshev <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15467-done <at> debbugs.gnu.org
Subject: Re: bug#15467: CSS-mode gives weird indentation when you put opening
 bracket on its own line
Date: Tue, 8 Oct 2013 09:04:12 +0200
[Message part 1 (text/plain, inline)]
Thank you, now everything works fine.

Paul


On 7 October 2013 17:41, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> > This fixes the problem I originally reported, but there seem to be more:
> > .x1
> > {
> > }
>
> > .x2
> >  {
> >  }
>
> > div.x3
> >    {
> >    }
>
> Thanks.  Should be fixed now.
>
> > As a feature request, it would be nice if '}' triggered auto-indent on
> > insertion, as in e.g. various programming modes.
>
> Now electric-indent-mode obeys css-electric-keys.
>
>
>         Stefan
>
[Message part 2 (text/html, inline)]

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

This bug report was last modified 11 years and 223 days ago.

Previous Next


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