From unknown Sun Jun 22 17:12:32 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#20282 <20282@debbugs.gnu.org> To: bug#20282 <20282@debbugs.gnu.org> Subject: Status: css-mode: multiple selectors *sometimes* breaks indentation Reply-To: bug#20282 <20282@debbugs.gnu.org> Date: Mon, 23 Jun 2025 00:12:32 +0000 retitle 20282 css-mode: multiple selectors *sometimes* breaks indentation reassign 20282 emacs submitter 20282 dse@webonastick.com severity 20282 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 09 02:27:50 2015 Received: (at submit) by debbugs.gnu.org; 9 Apr 2015 06:27:50 +0000 Received: from localhost ([127.0.0.1]:49903 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yg5wK-0004eo-Bm for submit@debbugs.gnu.org; Thu, 09 Apr 2015 02:27:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52296) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Yfyvj-0007Ke-E5 for submit@debbugs.gnu.org; Wed, 08 Apr 2015 18:58:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfyvd-0001Zz-5P for submit@debbugs.gnu.org; Wed, 08 Apr 2015 18:58:37 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:45144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfyvd-0001Zv-2L for submit@debbugs.gnu.org; Wed, 08 Apr 2015 18:58:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfyvc-0005Re-8d for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 18:58:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yfyvb-0001Zg-Al for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 18:58:36 -0400 Received: from mail-vn0-x22f.google.com ([2607:f8b0:400c:c0f::22f]:40832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yfyvb-0001ZZ-6e for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2015 18:58:35 -0400 Received: by vnbg62 with SMTP id g62so17912555vnb.7 for ; Wed, 08 Apr 2015 15:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:date:message-id:subject:from:to :content-type; bh=0qKZmwgE3ytZHAHnemyXzeyIG7a3cJrzljEMQaC7ezc=; b=Z8Wp2tP4/2DiBXeiDxX1Ks5RuoeJHdK9YtT00q+a4ktqQ1HtQHSkqPaEHxRgpz+xAs qLwMVK8qSwbRdBOdhFqHk1elFMJMI9zI1FPNrGxdSKy3s9BbWKwKYJbQDOQCKw8OVA2B 3KSRAgQdWMLPT5NnXRa6GAGu1wZhFAmkwMB6gvd/ZHSEouXq6vh8qDK1UkaQrxJ5YSKS pM7iGxdzbwymBTLWNmn1XGt1R7qiMKAhEaZ53kBvVTjz9aQXChecML4//vDR5qYfeMWC IZWeba2tbo0aZook+1WLkvOgHfWPwcdyBhqK0fCFVFjSFzOl66EPZMbjh//csB0ScQi2 xb3A== MIME-Version: 1.0 X-Received: by 10.52.61.137 with SMTP id p9mr20962847vdr.68.1428533914216; Wed, 08 Apr 2015 15:58:34 -0700 (PDT) Received: by 10.52.94.171 with HTTP; Wed, 8 Apr 2015 15:58:34 -0700 (PDT) Date: Wed, 8 Apr 2015 18:58:34 -0400 X-Google-Sender-Auth: HyoQ4L6ElgkL0mTWBo9fFpw8Zeg Message-ID: Subject: css-mode: multiple selectors *sometimes* breaks indentation From: Darren Embry To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=001a1136b57481ad9f05133e784a X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 09 Apr 2015 02:27:45 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: dse@webonastick.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --001a1136b57481ad9f05133e784a Content-Type: text/plain; charset=UTF-8 The following rather simple example of a chunk of CSS: a, b:hover { color: black; } gets indented incorrectly. The second line gets indented seven spaces instead of four; the last gets three spaces instead of zero. In this more complex example, the closing bracket lines up with the 'j': a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { background-color: white; } This example, however, is indented just fine: a, b:hover, c { color: black; } I've tried this in emacs-24.4 and emacs-24.5-rc3 on Linux, as well as 24.4 on the Windows platform. Regards, Darren --001a1136b57481ad9f05133e784a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
The following rather simple example of a chunk of CSS:
=C2=A0 =C2=A0 a, b= :hover {
=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0color: black;
=C2=A0 =C2=A0 =C2=A0 =C2=A0}
gets indented incorrectly.=C2=A0 The second line gets indented = seven spaces instead of four; the last gets three spaces instead of zero.

In this more complex example, the closing bracket l= ines up with the 'j':

=C2=A0 =C2=A0 a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,= .s[t]:u,.v[w]:x {
=C2=A0 backgrou= nd-color: white;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0}

This example,= however, is indented just fine:

=C2=A0 =C2=A0 a, b:hover, c {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 color: black;=
=C2=A0 =C2=A0 }

I've tried this in emacs-24.4 and emacs-24.5-rc3 on Linux, as we= ll as 24.4 on the Windows platform.

Regards,
Darren

=
--001a1136b57481ad9f05133e784a-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 09 10:52:31 2015 Received: (at 20282) by debbugs.gnu.org; 9 Apr 2015 14:52:31 +0000 Received: from localhost ([127.0.0.1]:51265 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgDol-0003xg-DK for submit@debbugs.gnu.org; Thu, 09 Apr 2015 10:52:31 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:38759) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgDoi-0003xY-Us for 20282@debbugs.gnu.org; Thu, 09 Apr 2015 10:52:29 -0400 Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t39EqPWX015364; Thu, 9 Apr 2015 10:52:26 -0400 Received: by pastel.home (Postfix, from userid 20848) id 94E112D4A; Thu, 9 Apr 2015 10:52:25 -0400 (EDT) From: Stefan Monnier To: Darren Embry Subject: Re: bug#20282: css-mode: multiple selectors *sometimes* breaks indentation Message-ID: References: Date: Thu, 09 Apr 2015 10:52:25 -0400 In-Reply-To: (Darren Embry's message of "Wed, 8 Apr 2015 18:58:34 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5271=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5271> : inlines <2670> : streams <1419628> : uri <1902562> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: 20282 Cc: 20282@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) > The following rather simple example of a chunk of CSS: > a, b:hover { > color: black; > } > gets indented incorrectly. Indeed, thanks. I installed the patch below which seems to fix this problem. Stefan diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 7280080..851618c 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -327,6 +327,10 @@ (`(:elem . basic) css-indent-offset) (`(:elem . arg) 0) (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467). + (`(:before . "{") + (when (smie-rule-hanging-p) + (smie-backward-sexp ";") + (smie-indent-virtual))) (`(:before . ,(or "{" "(")) (if (smie-rule-hanging-p) (smie-rule-parent 0))))) From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 09 10:53:56 2015 Received: (at control) by debbugs.gnu.org; 9 Apr 2015 14:53:56 +0000 Received: from localhost ([127.0.0.1]:51269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgDq7-00040E-Su for submit@debbugs.gnu.org; Thu, 09 Apr 2015 10:53:56 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:45103) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YgDq6-000404-6F for control@debbugs.gnu.org; Thu, 09 Apr 2015 10:53:54 -0400 Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t39ErqKT008678 for ; Thu, 9 Apr 2015 10:53:52 -0400 Received: by pastel.home (Postfix, from userid 20848) id 779332D4A; Thu, 9 Apr 2015 10:53:52 -0400 (EDT) From: Stefan Monnier To: control@debbugs.gnu.org Subject: Re: bug#20282: css-mode: multiple selectors *sometimes* breaks indentation Message-ID: References: Date: Thu, 09 Apr 2015 10:53:52 -0400 In-Reply-To: (Darren Embry's message of "Wed, 8 Apr 2015 18:58:34 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV5271=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5271> : inlines <2670> : streams <1419628> : uri <1902563> X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) close 20282 thanks From unknown Sun Jun 22 17:12:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 08 May 2015 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator