From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Newsgroups: gmane.emacs.bugs Subject: bug#19815: 25.0.50; [PATCH] css-mode: function call indentation Date: Sun, 08 Feb 2015 13:19:44 +0100 Message-ID: <1423397984.7427.0@smtp.gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=-vapKFm8WH3QM2+yHAcyg" X-Trace: ger.gmane.org 1423398073 9238 80.91.229.3 (8 Feb 2015 12:21:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Feb 2015 12:21:13 +0000 (UTC) To: 19815@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 08 13:21:13 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 1YKQrQ-0002s8-D5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Feb 2015 13:21:12 +0100 Original-Received: from localhost ([::1]:56296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKQrP-0005ls-Im for geb-bug-gnu-emacs@m.gmane.org; Sun, 08 Feb 2015 07:21:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKQrK-0005kv-Ev for bug-gnu-emacs@gnu.org; Sun, 08 Feb 2015 07:21:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKQrH-0007u3-6Y for bug-gnu-emacs@gnu.org; Sun, 08 Feb 2015 07:21:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:45938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKQrH-0007tw-32 for bug-gnu-emacs@gnu.org; Sun, 08 Feb 2015 07:21:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YKQrG-0003EE-JK for bug-gnu-emacs@gnu.org; Sun, 08 Feb 2015 07:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Simen =?UTF-8?Q?Heggest=C3=B8yl?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Feb 2015 12:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19815 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.142339800512324 (code B ref -1); Sun, 08 Feb 2015 12:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Feb 2015 12:20:05 +0000 Original-Received: from localhost ([127.0.0.1]:37178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YKQqJ-0003Cd-Ba for submit@debbugs.gnu.org; Sun, 08 Feb 2015 07:20:04 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35993) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YKQqF-0003C5-SO for submit@debbugs.gnu.org; Sun, 08 Feb 2015 07:20:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKQq9-0007Ol-4j for submit@debbugs.gnu.org; Sun, 08 Feb 2015 07:19:54 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:54906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKQq9-0007Og-0O for submit@debbugs.gnu.org; Sun, 08 Feb 2015 07:19:53 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKQq7-0005Nl-Bf for bug-gnu-emacs@gnu.org; Sun, 08 Feb 2015 07:19:52 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKQq4-0007KU-4c for bug-gnu-emacs@gnu.org; Sun, 08 Feb 2015 07:19:51 -0500 Original-Received: from mail-lb0-x234.google.com ([2a00:1450:4010:c04::234]:36184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKQq3-0007KJ-PP for bug-gnu-emacs@gnu.org; Sun, 08 Feb 2015 07:19:48 -0500 Original-Received: by mail-lb0-f180.google.com with SMTP id z12so4126345lbi.11 for ; Sun, 08 Feb 2015 04:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:message-id:mime-version:content-type; bh=1Y4sk1X5xOC7FLI7n+Li4Y3xAZC5VoIikZWAyO+7P68=; b=PnbVnw2n0LKGEnAcjMcIkVo8bMps1KOLY6ySjbwUBz/hK8TL9quJTH+yt5sf0djsj3 0jpxPRcc25FsTCQudYqqY5hCE5xzml5MjQKvS6fstL6P/hQm2T9BXz5ayr2IJzMFb1A9 w7T4PW6R/vuU1MNRMfPrlV86KTQ+9p/aftNu7Xh9Vyy6EnnyDInb0iyZ91PFLB4d0RMD +toeHSdrKxpTOCycx0mz4nWMhezJTpUOMPNI7O/zhewLQkJNpiGqd/Hos+3hjyGfkqxS D6PJzYjCYhlZXtOql2TDaODPXzRbhNbHoBIrx6FKpGxODvV6l4GmTZwtayJ3Lyggw3ye 4iIg== X-Received: by 10.112.44.171 with SMTP id f11mr11608877lbm.65.1423397986763; Sun, 08 Feb 2015 04:19:46 -0800 (PST) Original-Received: from [192.168.1.114] (cm-84.215.48.98.getinternet.no. [84.215.48.98]) by mx.google.com with ESMTPSA id rm3sm1445115lbb.47.2015.02.08.04.19.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Feb 2015 04:19:46 -0800 (PST) X-Mailer: geary/0.8.2 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-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: 140.186.70.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:99163 Archived-At: --=-vapKFm8WH3QM2+yHAcyg Content-Type: text/plain; charset=utf-8; format=flowed Sometimes it is convenient to break CSS function calls up in multiple lines. The current CSS indentation engine does not handle this well when the parameters don't begin at the same line as the opening paren. For instance: div { background: linear-gradient( to right, red, orange, yellow, green, blue, indigo, violet ); } div { background: linear-gradient( 135deg, red, blue ); } I would instead expect the following indentation: div { background: linear-gradient( to right, red, orange, yellow, green, blue, indigo, violet ); } div { background: linear-gradient( 135deg, red, blue ); } The following patch accomplishes this: diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index f6a3ca6..ab911ce 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -331,8 +331,9 @@ (`(:elem . basic) css-indent-offset) (`(:elem . arg) 0) (`(:list-intro . ,(or `";" `"")) t) ;"" stands for BOB (bug#15467). - (`(:before . "{") (if (smie-rule-hanging-p) - (smie-rule-parent 0))))) + (`(:before . ,(or "{" "(")) + (if (smie-rule-hanging-p) + (smie-rule-parent 0))))) ;;;###autoload (define-derived-mode css-mode fundamental-mode "CSS" In GNU Emacs 25.0.50.11 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5) of 2015-02-08 on x240 Repository revision: dcec731abfc110f719f0890fd0769e099393af7d Windowing system distributor `The X.Org Foundation', version 11.0.11602901 System Description: Debian GNU/Linux 8.0 (jessie) Configured using: `configure --without-makeinfo' Configured features: XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY LIBXML2 FREETYPE XFT ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message dired format-spec rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils time-date tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 74953 5948) (symbols 48 17996 0) (miscs 40 43 124) (strings 32 10952 5168) (string-bytes 1 296625) (vectors 16 9370) (vector-slots 8 386714 15587) (floats 8 70 63) (intervals 56 175 9) (buffers 976 11) (heap 1024 23572 1045)) --=-vapKFm8WH3QM2+yHAcyg Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Sometimes it is convenient to break CSS function calls up in multiple<= /div>
lines. The current CSS indentation engine does not handle this we= ll
when the parameters don't begin at the same line as the openin= g
paren. For instance:

div {
&= nbsp;   background: linear-gradient(
      &n= bsp;                 to right, red,= orange, yellow,
             =           green, blue, indigo, violet
&= nbsp;                   );
}

div {
    background:= linear-gradient(
             = ;           135deg,
     =                   red,
<= div>                    &= nbsp;   blue
             = ;       );
}

I would inst= ead expect the following indentation:

div {
<= div>    background: linear-gradient(
    &nbs= p;   to right, red, orange, yellow,
      &nb= sp; green, blue, indigo, violet
    );
}

div {
    background: linear-gradi= ent(
        135deg,
    =     red,
        blue
&nb= sp;   );
}

The following patch acco= mplishes this:

diff --git a/lisp/textmodes/css-mod= e.el b/lisp/textmodes/css-mode.el
index f6a3ca6..ab911ce 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/cs= s-mode.el
@@ -331,8 +331,9 @@
     (`(:e= lem . basic) css-indent-offset)
     (`(:elem . ar= g) 0)
     (`(:list-intro . ,(or `";" `"")) t) ;""= stands for BOB (bug#15467).
-    (`(:before . "{") (if= (smie-rule-hanging-p)
-            = ;             (smie-rule-parent 0)))))
<= div>+    (`(:before . ,(or "{" "("))
+     (i= f (smie-rule-hanging-p)
+         (smie-rule-= parent 0)))))
 
 ;;;###autoload
&nb= sp;(define-derived-mode css-mode fundamental-mode "CSS"


In GNU Emacs 25.0.50.11 (x86_64-unknown-linux-gnu, GTK= + Version 3.14.5)
 of 2015-02-08 on x240
Repositor= y revision: dcec731abfc110f719f0890fd0769e099393af7d
Windowing sy= stem distributor `The X.Org Foundation', version 11.0.11602901
Sy= stem Description: = Debian GNU/Linux 8.0 (jessie)

Configured us= ing:
 `configure --without-makeinfo'

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS= NOTIFY LIBXML2 FREETYPE XFT
ZLIB

Import= ant settings:
  value of $LANG: en_US.UTF-8
 = locale-coding-system: utf-8-unix

Major mode: Lisp= Interaction

Minor modes in effect:
&nbs= p; tooltip-mode: t
  global-eldoc-mode: t
  e= lectric-indent-mode: t
  mouse-wheel-mode: t
 = ; tool-bar-mode: t
  menu-bar-mode: t
  file-= name-shadow-mode: t
  global-font-lock-mode: t
&nb= sp; font-lock-mode: t
  blink-cursor-mode: t
 = ; auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent messages:
For information about GNU = Emacs and the GNU system, type C-h C-a.

Load-path = shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message dired format-spec
<= div>rfc822 mml easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util help-fns mail-prsvr mail-utils time-date tooltip=
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwhe= el x-win
x-dnd tool-bar dnd fontset image regexp-opt fringe tabul= ated-list
newcomment elisp-mode lisp-mode prog-mode register page= menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font= -lock syntax
facemenu font-core frame cham georgian utf-8-lang mi= sc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebr= ew greek romanian slovak
czech european ethiopic indian cyrillic = chinese case-table epa-hook
jka-cmpr-hook help simple abbrev mini= buffer cl-preloaded nadvice
loaddefs button faces cus-face macroe= xp files text-properties overlay
sha1 md5 base64 format env code-= pages mule custom widget
hashtable-print-readable backquote make-= network-process dbusbind
gfilenotify dynamic-setting system-font-= setting font-render-setting
move-toolbar gtk x-toolkit x multi-tt= y emacs)

Memory information:
((conses 16= 74953 5948)
 (symbols 48 17996 0)
 (miscs 40= 43 124)
 (strings 32 10952 5168)
 (string-by= tes 1 296625)
 (vectors 16 9370)
 (vector-slo= ts 8 386714 15587)
 (floats 8 70 63)
 (interv= als 56 175 9)
 (buffers 976 11)
 (heap 1024 2= 3572 1045))
= --=-vapKFm8WH3QM2+yHAcyg--