From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#21328: 25.0.50; css-mode: Indenting brackets in presence of pseudo-selectors Date: Tue, 25 Aug 2015 09:06:18 -0400 Message-ID: References: <1440327427.6295.0@smtp.gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1440508063 32028 80.91.229.3 (25 Aug 2015 13:07:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Aug 2015 13:07:43 +0000 (UTC) Cc: 21328@debbugs.gnu.org To: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 25 15:07:32 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZUDwj-000725-2v for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Aug 2015 15:07:25 +0200 Original-Received: from localhost ([::1]:59852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUDwa-0004T7-CI for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Aug 2015 09:07:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUDwR-0004Sr-5E for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 09:07:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUDwM-0001DN-Q6 for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 09:07:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45453) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUDwM-0001DC-ND for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 09:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZUDwM-0002N6-98 for bug-gnu-emacs@gnu.org; Tue, 25 Aug 2015 09:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Aug 2015 13:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21328 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 21328-submit@debbugs.gnu.org id=B21328.14405079919080 (code B ref 21328); Tue, 25 Aug 2015 13:07:02 +0000 Original-Received: (at 21328) by debbugs.gnu.org; 25 Aug 2015 13:06:31 +0000 Original-Received: from localhost ([127.0.0.1]:37663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUDvm-0002MI-2V for submit@debbugs.gnu.org; Tue, 25 Aug 2015 09:06:30 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:37680) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUDvf-0002M6-FX for 21328@debbugs.gnu.org; Tue, 25 Aug 2015 09:06:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BCFgA731xV/5P+d0tcgxCEAoVVwD6CTQQCAoE8PRABAQEBAQEBgQpBBYNdAQEDAVYjBQsLNBIUGA0kiDcIzyMBAQEBAQEEAQEBAR6LOoUFB4QtBbM/gUUjgWZVgVkigngBAQE X-IPAS-Result: A0BCFgA731xV/5P+d0tcgxCEAoVVwD6CTQQCAoE8PRABAQEBAQEBgQpBBYNdAQEDAVYjBQsLNBIUGA0kiDcIzyMBAQEBAQEEAQEBAR6LOoUFB4QtBbM/gUUjgWZVgVkigngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="161296022" Original-Received: from 75-119-254-147.dsl.teksavvy.com (HELO ceviche.home) ([75.119.254.147]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 25 Aug 2015 09:06:19 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 526A46610C; Tue, 25 Aug 2015 09:06:18 -0400 (EDT) In-Reply-To: <1440327427.6295.0@smtp.gmail.com> ("Simen =?UTF-8?Q?Heggest=C3=B8yl?="'s message of "Sun, 23 Aug 2015 12:57:07 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105798 Archived-At: > main:first > { > background: green; > } > } [...] > (`(:before . "{") > (when (smie-rule-hanging-p) > (smie-backward-sexp ";") > (smie-indent-virtual))) The (smie-rule-hanging-p) test checks if the "{" is at the end of the line (and with text before it on the same line). I guess you could use something like (when (or (smie-rule-hanging-p) (smie-rule-bolp)) tho for the bolp case, maybe some people like main:first { background: green; } since that's the "standard GNU style" in C/C++ (so for the bolp case, we might like to add the indentation step to the return value of smie-indent-virtual). The current behavior is "almost" like this standard, except that it indents relatively to the "first" instead of doing it relatively to the "main", because it misparses the above as main : (first {...}) i.s.o (main : first) {...} [ Where I added parentheses just to clarify the grouping. ] > However I haven't been able to fully understand how SMIE works yet, so > I'm not sure what that check was meant for in the first place, or > whether it breaks some other cases (though I haven't been able to find > such a case). You could also remove the (smie-rule-hanging-p) test altogether, indeed. This could lead to mis-indentations in some cases, tho I can't think of any right now that would show up in CSS. E.g. things where we'd want main:first {toto} (tutu) because the "(tutu)" is like a "second argument" to "main:first", and we'd instead get main:first {toto} (tutu) because the `(:before . "{") case also triggers here when we compute the (virtual) indentation of {toto}. Stefan