From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.bugs Subject: bug#13425: close this bug? Date: Mon, 30 Jan 2017 15:17:48 -0700 Message-ID: <877f5cchv7.fsf@tromey.com> References: <87efzqhh93.fsf@tromey.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1485823637 14626 195.159.176.226 (31 Jan 2017 00:47:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 31 Jan 2017 00:47:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.90 (gnu/linux) Cc: 13425@debbugs.gnu.org, Tom Tromey To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 31 01:47:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYMbF-0003SN-3S for geb-bug-gnu-emacs@m.gmane.org; Tue, 31 Jan 2017 01:47:09 +0100 Original-Received: from localhost ([::1]:35637 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYMbI-0002zP-Nt for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Jan 2017 19:47:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYMbC-0002z8-Sg for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 19:47:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYMb8-0006Nv-Rl for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 19:47:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53298) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYMb8-0006Nr-M9 for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 19:47:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cYMb8-0005de-Ag for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 19:47:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tom Tromey Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Jan 2017 00:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13425 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13425-submit@debbugs.gnu.org id=B13425.148582359421569 (code B ref 13425); Tue, 31 Jan 2017 00:47:02 +0000 Original-Received: (at 13425) by debbugs.gnu.org; 31 Jan 2017 00:46:34 +0000 Original-Received: from localhost ([127.0.0.1]:51497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYMag-0005bo-0j for submit@debbugs.gnu.org; Mon, 30 Jan 2017 19:46:34 -0500 Original-Received: from gproxy7-pub.mail.unifiedlayer.com ([70.40.196.235]:58660) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1cYMad-0005bF-Em for 13425@debbugs.gnu.org; Mon, 30 Jan 2017 19:46:32 -0500 Original-Received: (qmail 5033 invoked by uid 0); 31 Jan 2017 00:44:35 -0000 Original-Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy7.mail.unifiedlayer.com with SMTP; 31 Jan 2017 00:44:35 -0000 Original-Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id eokS1u00W2f2jeq01okVNf; Mon, 30 Jan 2017 17:44:30 -0700 X-Authority-Analysis: v=2.1 cv=NJxGpSKg c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IgFoBzBjUZAA:10 a=zVy3hRbMEjeyw4H8_9IA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=JMGSfxrkHqrEcGOmvofDesLMSGtTkEUwZHmknsUKLtI=; b=LIaja8M04EIwhUJ3VMbKDgJz1n NzNYMTa6J/J7sUzLn6MZ6/Hvk2/FAAvc7T3PKaypuUrLENpynDH5r5nIJsSFvceC/j7fIdmlweenO nwPMlqtbl8i7b2l5yNqM99AWO; Original-Received: from 174-16-146-181.hlrn.qwest.net ([174.16.146.181]:48662 helo=bapiya) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1cYKGl-0001fV-3U; Mon, 30 Jan 2017 15:17:51 -0700 X-Attribution: Tom In-Reply-To: (Stefan Monnier's message of "Sun, 29 Jan 2017 12:16:20 -0500") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.146.181 X-Exim-ID: 1cYKGl-0001fV-3U X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-146-181.hlrn.qwest.net (bapiya) [174.16.146.181]:48662 X-Source-Auth: tom+tromey.com X-Email-Count: 0 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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" Xref: news.gmane.org gmane.emacs.bugs:128811 Archived-At: Stefan> What have you tried? I don't know the CSS grammar well enough to know Stefan> what we should do. I've appended my first try, which also includes a test case. (Though the last stanza of the test case is actually not indented properly as-is, oops.) Like yours mine failed on ":"s in selectors. I had a second try but it worked even less well I think. Stefan> So the question is mostly: whether it's easier to distinguish Stefan> the two different kinds of commas, or whether it's easier to Stefan> distinguish the two different kinds of colons. In my view the simplest is treating ":" different inside and outside of braces. Outside of braces it acts as a separator in a selector, with the suffix being a pseudo-class or pseudo-element: p::after { blah } Inside braces it separates a property name from the value: p { property-name: value; } Tom diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 4d02b75..5cb9027 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1140,7 +1140,7 @@ smie-rules-function - :before, in which case ARG is a token and the function should return the OFFSET to use to indent ARG itself. - :elem, in which case the function should return either: - - the offset to use to indent function arguments (ARG = `arg') + - the offset to use to indent function arguments (ARG = `args') - the basic indentation step (ARG = `basic'). - the token to use (when ARG = `empty-line-token') when we don't know how to indent an empty line. diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index c81c3f6..7f1b5ca 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -734,7 +734,7 @@ css-indent-offset (defconst css-smie-grammar (smie-prec2->grammar - (smie-precs->prec2 '((assoc ";") (assoc ",") (left ":"))))) + (smie-precs->prec2 '((assoc ";") (left ":"))))) (defun css-smie--forward-token () (cond @@ -764,6 +764,7 @@ css-smie--backward-token (defun css-smie-rules (kind token) (pcase (cons kind token) + (`(:list-intro . ":") t) (`(:elem . basic) css-indent-offset) (`(:elem . arg) 0) (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467). diff --git a/test/manual/indent/css-mode.css b/test/manual/indent/css-mode.css index 3a00739..a7ee536 100644 --- a/test/manual/indent/css-mode.css +++ b/test/manual/indent/css-mode.css @@ -43,3 +43,44 @@ article:hover { color: black; } + +/* Example from bug#13425, with some changes. */ +body { + color: #333; + font: 15px "Helvetica Neue", + Helvetica, + Arial, + "Nimbus Sans L", + sans-serif; + font-x-commas: 15px "Helvetica Neue" + Helvetica + Arial + "Nimbus Sans L" + sans-serif; + font-weight: 300; + line-height: 1.625; + a { /* It also handles SCSS */ + font: 15px "Helvetica Neue", + Helvetica, + Arial, + "Nimbus Sans L", + sans-serif; + /* Some comment */ + font-x-commas: 15px "Helvetica Neue" + Helvetica + Arial + "Nimbus Sans L" + sans-serif; + } + /* Some comment at the end of a block */ +} + +/* Ensure bug#13425 doesn't regress this. */ +#navtable .current:link, +#navtable .current:visited, +#navtable .current:hover, +#navtable .current:active { + background-color: grey; + color: white; + border: thin solid black; +}