unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15467: CSS-mode gives weird indentation when you put opening bracket on its own line
@ 2013-09-26 14:23 Paul Pogonyshev
  2013-10-04 21:46 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Pogonyshev @ 2013-09-26 14:23 UTC (permalink / raw)
  To: 15467

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 479 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#15467: CSS-mode gives weird indentation when you put opening bracket on its own line
  2013-09-26 14:23 bug#15467: CSS-mode gives weird indentation when you put opening bracket on its own line Paul Pogonyshev
@ 2013-10-04 21:46 ` Stefan Monnier
  2013-10-07  7:14   ` Paul Pogonyshev
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2013-10-04 21:46 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15467-done

> 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)))))
 






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#15467: CSS-mode gives weird indentation when you put opening bracket on its own line
  2013-10-04 21:46 ` Stefan Monnier
@ 2013-10-07  7:14   ` Paul Pogonyshev
  2013-10-07 15:41     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Pogonyshev @ 2013-10-07  7:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15467-done

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

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@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)))))
>
>
>

[-- Attachment #2: Type: text/html, Size: 1650 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#15467: CSS-mode gives weird indentation when you put opening bracket on its own line
  2013-10-07  7:14   ` Paul Pogonyshev
@ 2013-10-07 15:41     ` Stefan Monnier
  2013-10-08  7:04       ` Paul Pogonyshev
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2013-10-07 15:41 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 15467-done

> 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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#15467: CSS-mode gives weird indentation when you put opening bracket on its own line
  2013-10-07 15:41     ` Stefan Monnier
@ 2013-10-08  7:04       ` Paul Pogonyshev
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Pogonyshev @ 2013-10-08  7:04 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15467-done

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

Thank you, now everything works fine.

Paul


On 7 October 2013 17:41, Stefan Monnier <monnier@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
>

[-- Attachment #2: Type: text/html, Size: 1066 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-08  7:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-26 14:23 bug#15467: CSS-mode gives weird indentation when you put opening bracket on its own line Paul Pogonyshev
2013-10-04 21:46 ` Stefan Monnier
2013-10-07  7:14   ` Paul Pogonyshev
2013-10-07 15:41     ` Stefan Monnier
2013-10-08  7:04       ` Paul Pogonyshev

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).