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#22508: [PATCH] Highlight two additional SCSS keywords Date: Sun, 31 Jan 2016 22:35:25 +0100 Message-ID: <1454276125.9296.0@smtp.gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-V7c9SXCCMButEkpqnGXj" X-Trace: ger.gmane.org 1454276196 16172 80.91.229.3 (31 Jan 2016 21:36:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 31 Jan 2016 21:36:36 +0000 (UTC) Cc: Stefan Monnier To: 22508@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 31 22:36:25 2016 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 1aPzfH-00011V-NR for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Jan 2016 22:36:11 +0100 Original-Received: from localhost ([::1]:43367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPzfG-00058B-Of for geb-bug-gnu-emacs@m.gmane.org; Sun, 31 Jan 2016 16:36:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPzfC-00057r-Uw for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2016 16:36:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPzf7-0003z1-Ue for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2016 16:36:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPzf7-0003yx-Rk for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2016 16:36:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aPzf7-00073K-Le for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2016 16:36:01 -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, 31 Jan 2016 21:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22508 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.145427614327083 (code B ref -1); Sun, 31 Jan 2016 21:36:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Jan 2016 21:35:43 +0000 Original-Received: from localhost ([127.0.0.1]:43494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aPzep-00072l-Ki for submit@debbugs.gnu.org; Sun, 31 Jan 2016 16:35:43 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38271) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aPzen-00072Z-P8 for submit@debbugs.gnu.org; Sun, 31 Jan 2016 16:35:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPzeh-0003w3-Hj for submit@debbugs.gnu.org; Sun, 31 Jan 2016 16:35:36 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:48874) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPzeh-0003vy-Ez for submit@debbugs.gnu.org; Sun, 31 Jan 2016 16:35:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPzeg-000532-DA for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2016 16:35:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPzeb-0003u1-DD for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2016 16:35:34 -0500 Original-Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:36213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPzeb-0003tn-2A for bug-gnu-emacs@gnu.org; Sun, 31 Jan 2016 16:35:29 -0500 Original-Received: by mail-wm0-x233.google.com with SMTP id p63so45223808wmp.1 for ; Sun, 31 Jan 2016 13:35:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:subject:to:cc:message-id:mime-version:content-type; bh=gtgyLh2nOoQsMmqRDNAVxpcH8bdcIOZsitfZ5RnFNEM=; b=l1ZWuWi0uxoYGLi2WRQZGihmsx8sQgk02QTKHaeN90ReRfOYnudp/7M9fFI0uEejV+ X4HfnOVzEVR4+cEINibm3jNY2QOk5fUtpMlA/7Gc54dJ12jCK6YI7IbBqSW16bM8BkFa KLCuuJqLNqVG9lTUAyQMaqc9JaNrBq6LJoUjjBc8IIyyu6XKONgXSMI938i1yK4GUh/N vaB27MyxJxLMoRcCecsiRML+3i+esewUEWCatwxnf/A7uuSHDHqtGX35J+O1YvNoIx5Z BSJoEpWqzzTVAuiMzPEmxkK7m0O9udjU5lzEKerMKkZM8wjHWs22ChRyQ0FSVDCkbOKi x42w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:subject:to:cc:message-id:mime-version :content-type; bh=gtgyLh2nOoQsMmqRDNAVxpcH8bdcIOZsitfZ5RnFNEM=; b=ApJcqMM2uFjPEAkDVh4lQPlCYW/YNQ9RH0hke3tRyv2pqCnVO1yCg6tH20hHHEp+BH rvinuwVk716exZRcnpOFFaVf24Os0sBhn2lNAP2zU3n0pBs9UaPdvQtqK9RK5QKPj9d1 6Qr6cYrFyEYqKqWKyjADw1Sjuzh87gmrHRHL/FY8iGfodqWQm8jT9m7BYCicc72+wvY6 wIFJJk2ws0LMsdQ35hzf2jlXSpMs8NJV7frh9ptzp0KgPWGWWY0bnYk4iO4ViSEcyJCE tfimS5z2IjFsBEpAiZn0V0ZnQUCRSkWsCSJYBVLy7j9iacQNtobtX9GyjUqaq86n6g5Y 1c4Q== X-Gm-Message-State: AG10YORjZYokloS9hFhIXlCeLFu/t+EJ0knE+10XMN1nKcaN31qOUk3xAuNhvAFlRld00A== X-Received: by 10.194.116.71 with SMTP id ju7mr21779034wjb.2.1454276128073; Sun, 31 Jan 2016 13:35:28 -0800 (PST) Original-Received: from [192.168.100.6] (cm-84.210.143.4.getinternet.no. [84.210.143.4]) by smtp.gmail.com with ESMTPSA id js8sm26005269wjc.37.2016.01.31.13.35.26 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 31 Jan 2016 13:35:27 -0800 (PST) X-Mailer: geary/0.10.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:112162 Archived-At: --=-V7c9SXCCMButEkpqnGXj Content-Type: multipart/alternative; boundary="=-MicHDCBj43pTDyMWlrym" --=-MicHDCBj43pTDyMWlrym Content-Type: text/plain; charset=utf-8; format=flowed Hello! The attached patch adds highlighting for two additional "bang identifiers" in SCSS mode: !default and !optional. -- Simen --=-MicHDCBj43pTDyMWlrym Content-Type: text/html; charset=utf-8
Hello!

The attached patch adds highlighting for two additional "bang
identifiers" in SCSS mode: !default and !optional.

-- Simen
--=-MicHDCBj43pTDyMWlrym-- --=-V7c9SXCCMButEkpqnGXj Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Highlight-two-additional-SCSS-keywords.patch >From b9f1b493c36a51024b8fbc2cc9ba302f1437bf4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= Date: Sun, 31 Jan 2016 22:03:23 +0100 Subject: [PATCH] Highlight two additional SCSS keywords * lisp/textmodes/css-mode.el (css-bang-ids): New defconst holding CSS identifiers on the form !foo. (scss-bang-ids): New defconst holding SCSS identifiers on the form !foo. (css--font-lock-keywords): Highlight the new SCSS bang identifiers in `font-lock-builtin-face'. * test/indent/css-mode.css: Add bang rule test case. * test/indent/scss-mode.css: Add test cases for the introduced bang rules. --- lisp/textmodes/css-mode.el | 12 ++++++++++-- test/indent/css-mode.css | 2 +- test/indent/scss-mode.scss | 11 ++++++++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 96a82ba..b3a41d3 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -54,6 +54,14 @@ css-at-ids '("charset" "font-face" "import" "media" "namespace" "page") "Identifiers that appear in the form @foo.") +(defconst css-bang-ids + '("important") + "Identifiers that appear in the form !foo.") + +(defconst scss-bang-ids + '("default" "global" "optional") + "Additional identifiers that appear in the form !foo in SCSS.") + (defconst css-descriptor-ids '("ascent" "baseline" "bbox" "cap-height" "centerline" "definition-src" "descent" "font-family" "font-size" "font-stretch" "font-style" @@ -236,8 +244,8 @@ css-proprietary-property (defun css--font-lock-keywords (&optional sassy) `((,(concat "!\\s-*" - (regexp-opt (append (if sassy '("global")) - '("important")))) + (regexp-opt (append (if sassy scss-bang-ids) + css-bang-ids))) (0 font-lock-builtin-face)) ;; Atrules keywords. IDs not in css-at-ids are valid (ignored). ;; In fact the regexp should probably be diff --git a/test/indent/css-mode.css b/test/indent/css-mode.css index 24166b0..3a00739 100644 --- a/test/indent/css-mode.css +++ b/test/indent/css-mode.css @@ -9,7 +9,7 @@ article[role="main"] { } a, b:hover, c { - color: black; + color: black !important; } a, b:hover { /* bug:20282 */ diff --git a/test/indent/scss-mode.scss b/test/indent/scss-mode.scss index 02a4a98..e1ec90a 100644 --- a/test/indent/scss-mode.scss +++ b/test/indent/scss-mode.scss @@ -40,11 +40,20 @@ p.#{$name} var } article[role="main"] { $toto: 500 !global; - float: left; + $var-with-default: 300 !default; + float: left !important; width: 600px / 888px * 100%; height: 100px / 888px * 100%; } +%placeholder { + color: #f0f0f0; +} + +button { + @extend %placeholder !optional; +} + @import 'reset'; @mixin border-radius($radius) { -- 2.7.0 --=-V7c9SXCCMButEkpqnGXj--