GNU bug report logs - #22211
[PATCH] Add a face for CSS/SCSS variables

Previous Next

Package: emacs;

Reported by: Simen Heggestøyl <simenheg <at> gmail.com>

Date: Sat, 19 Dec 2015 11:13:02 UTC

Severity: wishlist

Tags: patch

Done: Simen Heggestøyl <simenheg <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Simen Heggestøyl <simenheg <at> gmail.com>
Subject: bug#22211: closed (Re: bug#22211: [PATCH] Add a face for CSS/SCSS
 variables)
Date: Sun, 31 Jan 2016 14:31:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#22211: [PATCH] Add a face for CSS/SCSS variables

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 22211 <at> debbugs.gnu.org.

-- 
22211: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22211
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Simen Heggestøyl <simenheg <at> gmail.com>
To: 22211-done <at> debbugs.gnu.org
Subject: Re: bug#22211: [PATCH] Add a face for CSS/SCSS variables
Date: Sun, 31 Jan 2016 15:29:59 +0100
[Message part 3 (text/plain, inline)]
Installed in emacs-25.
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Simen Heggestøyl <simenheg <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: [PATCH] Add a face for CSS/SCSS variables
Date: Sat, 19 Dec 2015 12:12:25 +0100
[Message part 6 (text/plain, inline)]
Hi,

I'd like to propose the following patch, which introduces a new face
to be used commonly for CSS and SCSS variable names.

-- Simen


From dd89467a604d85d7fd2194bfd1a97c6834806727 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <simenheg <at> gmail.com>
Date: Fri, 18 Dec 2015 22:38:08 +0100
Subject: [PATCH] Add a face for CSS/SCSS variables

* lisp/textmodes/css-mode.el (css-nmstart-re): Don't match variables.
(css-variable): New face for variables.
(css--font-lock-keywords): Highlight variables.
(scss-font-lock-keywords): Use the new variable face.
---
lisp/textmodes/css-mode.el | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 3e84b43..8c20df7 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -215,7 +215,7 @@ css-syntax-propertize-function
(defconst css-escapes-re
  "\\\\\\(?:[^\000-\037\177]\\|[0-9a-fA-F]+[ \n\t\r\f]?\\)")
(defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re 
"\\)"))
-(defconst css-nmstart-re (concat "\\(?:--\\)?\\(?:[[:alpha:]]\\|" 
css-escapes-re "\\)"))
+(defconst css-nmstart-re (concat "\\(?:[[:alpha:]]\\|" css-escapes-re 
"\\)"))
(defconst css-ident-re ;; (concat css-nmstart-re css-nmchar-re "*")
  ;; Apparently, "at rules" names can start with a dash, e.g. 
@-moz-keyframes.
  (concat css-nmchar-re "+"))
@@ -233,6 +233,8 @@ css-property
  :group 'css)
(defface css-proprietary-property '((t :inherit (css-property italic)))
  "Face to use for vendor-specific properties.")
+(defface css-variable '((t :inherit font-lock-variable-name-face))
+  "Face to use for variables.")

(defun css--font-lock-keywords (&optional sassy)
  `((,(concat "!\\s-*"
@@ -246,6 +248,8 @@ css--font-lock-keywords
    ;; Since "An at-rule consists of everything up to and including 
the next
    ;; semicolon (;) or the next block, whichever comes first."
    (,(concat "@" css-ident-re) (0 font-lock-builtin-face))
+    ;; Variables.
+    (,(concat "--" css-ident-re) (0 'css-variable))
    ;; Selectors.
    ;; FIXME: attribute selectors don't work well because they may 
contain
    ;; strings which have already been highlighted as f-l-string-face 
and
@@ -525,7 +529,7 @@ scss-mode-syntax-table
    st))

(defvar scss-font-lock-keywords
-  (append `((,(concat "$" css-ident-re) (0 
font-lock-variable-name-face)))
+  (append `((,(concat "$" css-ident-re) (0 'css-variable)))
          (css--font-lock-keywords 'sassy)
          `((,(concat "@mixin[ \t]+\\(" css-ident-re "\\)[ \t]*(")
             (1 font-lock-function-name-face)))))
-- 
2.6.4


[Message part 7 (text/html, inline)]

This bug report was last modified 9 years and 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.