From d2d6e4452c8f2cf571f2d866b248131b3ef31c3a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Simen=20Heggest=C3=B8yl?= Date: Sat, 3 Jun 2017 13:29:06 +0200 Subject: [PATCH] Support a new CSS indentation style * lisp/textmodes/css-mode.el (css-smie-rules): Indent after property immediately followed by a newline. * test/manual/indent/css-mode.css: Add test for the change above. * test/manual/indent/scss-mode.scss: Ditto. --- lisp/textmodes/css-mode.el | 5 ++++- test/manual/indent/css-mode.css | 7 +++++++ test/manual/indent/scss-mode.scss | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 458ed9f8bb2..45d750af755 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1208,7 +1208,10 @@ for determining whether point is within a selector." (smie-backward-sexp ";") (smie-indent-virtual))) (`(:before . ,(or "{" "(")) - (if (smie-rule-hanging-p) (smie-rule-parent 0))))) + (if (smie-rule-hanging-p) (smie-rule-parent 0))) + (`(:after . ":-property") + (when (smie-rule-hanging-p) + css-indent-offset)))) ;;; Completion diff --git a/test/manual/indent/css-mode.css b/test/manual/indent/css-mode.css index 0845c02c299..79b082188f5 100644 --- a/test/manual/indent/css-mode.css +++ b/test/manual/indent/css-mode.css @@ -65,8 +65,15 @@ div::before { 5.0, 6.0 ); } + @font-face { src: url("Sans-Regular.eot") format("eot"), url("Sans-Regular.woff") format("woff"), url("Sans-Regular.ttf") format("truetype"); } + +@font-face { + src: + url("Sans-Regular.eot") format("eot"), + url("Sans-Regular.woff") format("woff"); +} diff --git a/test/manual/indent/scss-mode.scss b/test/manual/indent/scss-mode.scss index f9911ad11b7..a3dd41eeb47 100644 --- a/test/manual/indent/scss-mode.scss +++ b/test/manual/indent/scss-mode.scss @@ -92,3 +92,17 @@ div:last-child { "Nimbus Sans L", sans-serif; } } + +body { + font: + 15px "Helvetica Neue", Helvetica, Arial, + "Nimbus Sans L", sans-serif; + font-family: + sans-serif; + + article { + font: + 15px "Helvetica Neue", Helvetica, Arial, + "Nimbus Sans L", sans-serif; + } +} -- 2.39.2