GNU bug report logs - #21638
25.0.50; font-lock for CSS variables

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Tue, 6 Oct 2015 17:59:01 UTC

Severity: minor

Found in version 25.0.50

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21638 in the body.
You can then email your comments to 21638 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#21638; Package emacs. (Tue, 06 Oct 2015 17:59:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tom Tromey <tom <at> tromey.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 06 Oct 2015 17:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tom Tromey <tom <at> tromey.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; font-lock for CSS variables
Date: Tue, 06 Oct 2015 11:57:07 -0600
Right now CSS mode doesn't treat CSS variable definitions as
properties.  I think it should.

Here's the patch that worked for me:

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 5f4eebd..97dd8ab 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -289,7 +289,7 @@ css--font-lock-keywords
                      nil)))
     ;; Properties.  Again, we don't limit ourselves to css-property-ids.
     (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
-              "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"
+              "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|--\\|"
               css-nmstart-re "\\)" css-nmchar-re "*"
               "\\)\\s-*:")
      (1 (if (match-end 2) 'css-proprietary-property 'css-property)))

Tom




In GNU Emacs 25.0.50.3 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6)
 of 2015-10-06
Repository revision: b8adff8426a4532a0971e9a470d3347aafd99b35
Windowing system distributor 'Fedora Project', version 11.0.11702000
Configured using:
 'configure --prefix=/home/tromey/Emacs/install/
 --with-file-notification=no'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS
LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: CSS

Minor modes in effect:
  bug-reference-prog-mode: t
  diff-auto-refine-mode: t
  erc-spelling-mode: t
  erc-truncate-mode: t
  flyspell-mode: t
  which-function-mode: t
  projectile-global-mode: t
  projectile-mode: t
  erc-notify-mode: t
  erc-notifications-mode: t
  erc-services-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  savehist-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  auto-fill-function: #[128 \300\301\302.#\207 [apply smie-auto-fill #[128 \301\302\300!."\207 [normal-auto-fill-function apply default-value] 4 

(fn &rest ARGS)] nil] 5 nil]
  transient-mark-mode: t

Recent messages:
	") (put-text-property (point) (match-end 0) (quote font-lock-multiline) t) nil))) ("\\(?:[{;]\\|^\\)[ 	]*\\(\\(?:\\([-_]\\(?:khtml\\|m\\(?:oz\\|s\\)\\|o\\|webkit\\)-\\)\\|--\\|\\(?:[[:alpha:]]\\|\\\\\\(?:[^.-]\\|[0-9a-fA-F]+[ 
	.]?\\)\\)\\)\\(?:[-[:alnum:]]\\|\\\\\\(?:[^.-]\\|[0-9a-fA-F]+[ 
	.]?\\)\\)*\\)\\s-*:" (1 (if (match-end 2) (quote css-proprietary-property) (quote css-property)))) ("url\\((\\)[[:space:]]*\\(?:\\\\.\\|[^()[:space:]
'\"]\\)+[[:space:]]*\\()\\)" (1 (quote default) t) (2 (quote default) t)))
Mark set
Mark saved where search started
Saving file /home/tromey/firefox-git/tree-2/devtools/client/styleinspector/test/doc_copystyles.css...
Wrote /home/tromey/firefox-git/tree-2/devtools/client/styleinspector/test/doc_copystyles.css
Finding changes in /home/tromey/Emacs/emacs/lisp/textmodes/css-mode.el...done
Quit [4 times]
funcall-interactively: No recursive edit is in progress

Load-path shadows:
/home/tromey/.emacs.d/elpa/bubbles-0.5/bubbles hides /home/tromey/Emacs/install/share/emacs/25.0.50/lisp/play/bubbles

Features:
(shadow mail-hist emacsbug whitespace css-mode texinfo git-commit-mode
log-edit pcvs-util smerge-mode gnus-fun eieio-opt speedbar sb-image
ezimage dframe dabbrev git-rebase-mode flow-fill misearch multi-isearch
add-log bug-reference js json cc-mode cc-fonts cc-guess cc-menus cc-cmds
gnus-html url-cache mm-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie url-domsuf url-util url-parse
url-vars shr-color shr dom browse-url mm-archive bbdb-gui bbdb-hooks
bbdb-rmail rmailsum rmail sort smiley gnus-cite gnus-bcklg gnus-async qp
gnus-ml disp-table copyright vc-mtn vc-hg vc-git diff-mode vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs term/xterm xterm gnus-topic nndraft nnmh
nnfolder utf-7 bbdb-gnus bbdb-snarf mail-extr bbdb-com warnings
gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg nntp
gnus-cache gnus-registry registry eieio-compat eieio-base gnus-art mm-uu
mml2015 mm-view mml-smime smime dig mailcap gnus-sum gnus-group
gnus-undo smtpmail sendmail gnus-start gnus-cloud nnimap nnmail
mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range
message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader
gnus-win gnus gnus-ems nnheader mail-utils gnutls network-stream nsm
starttls tls erc-spelling erc-truncate flyspell ispell diminish appt
diary-lib diary-loaddefs cal-menu calendar cal-loaddefs which-func imenu
projectile ibuf-macs ibuf-ext ibuffer minimap autorevert filenotify
desktop frameset cus-start cus-load erc-notify erc-desktop-notifications
notifications dbus xml erc-services erc-list erc-menu erc-join erc-ring
erc-networks erc-pcomplete pcomplete erc-track erc-match erc-netsplit
erc-hl-nicks color erc-button erc-fill erc-stamp wid-edit erc-goodies
erc erc-backend erc-compat format-spec auth-source eieio byte-opt
bytecomp byte-compile cl-extra cconv gnus-util mm-util help-fns
mail-prsvr password-cache thingatpt pp status dired-aux dired-x dired
advice vc-dir ewoc vc vc-dispatcher flycheck derived easy-mmode cl-seq
edmacro kmacro find-func help-mode rx subr-x dash jka-compr sh-script
smie executable compile let-alist cc-styles cc-align cc-engine cc-vars
cc-defs bbdb cl timezone ange-ftp comint ansi-color ring server savehist
finder-inf bbdb-autoloads dwarf-mode-autoloads eieio-core cl-macs gv
cl-loaddefs pcase cl-lib lisppaste-autoloads pydoc-info-autoloads
info-look weblogger-autoloads info package easymenu epg-config time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-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 cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript 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 dbusbind dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 1584563 702016)
 (symbols 48 102069 0)
 (miscs 40 23022 3346)
 (strings 32 661191 206096)
 (string-bytes 1 24535493)
 (vectors 16 104304)
 (vector-slots 8 2294514 218530)
 (floats 8 874 1102)
 (intervals 56 38889 1534)
 (buffers 976 98)
 (heap 1024 301266 64795))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21638; Package emacs. (Tue, 06 Oct 2015 19:26:02 GMT) Full text and rfc822 format available.

Message #8 received at 21638 <at> debbugs.gnu.org (full text, mbox):

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Tom Tromey <tom <at> tromey.com>
Cc: 21638 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#21638: 25.0.50; font-lock for CSS variables
Date: Tue, 06 Oct 2015 21:24:53 +0200
Tom Tromey <tom <at> tromey.com> writes:
> Right now CSS mode doesn't treat CSS variable definitions as
> properties.  I think it should.
>
> Here's the patch that worked for me:
>
> [...]
>
> Tom

Hi Tom!

Good idea. The patch seems to do the job, but it also has the side
effect that '---foo', '----foo' and so on are recognized as
properties.

Putting it instead at the start of 'css-nmstart-re' seems to fix that:

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 5f4eebd..3e84b43 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -215,7 +215,7 @@
 (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 "+"))

Though I'm unsure what 'css-nmstart-re' is intended to contain, since
it's missing a docstring. Maybe Stefan knows?

-- Simen




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21638; Package emacs. (Tue, 06 Oct 2015 21:11:02 GMT) Full text and rfc822 format available.

Message #11 received at 21638 <at> debbugs.gnu.org (full text, mbox):

From: Tom Tromey <tom <at> tromey.com>
To: Simen Heggestøyl <simenheg <at> gmail.com>
Cc: 21638 <at> debbugs.gnu.org, Tom Tromey <tom <at> tromey.com>,
 monnier <at> iro.umontreal.ca
Subject: Re: bug#21638: 25.0.50; font-lock for CSS variables
Date: Tue, 06 Oct 2015 15:10:35 -0600
Simen> Good idea. The patch seems to do the job, but it also has the side
Simen> effect that '---foo', '----foo' and so on are recognized as
Simen> properties.

Yeah, sorry, I forgot that the rest had to look like an identifier.

Simen> Though I'm unsure what 'css-nmstart-re' is intended to contain, since
Simen> it's missing a docstring. Maybe Stefan knows?

Considering that this is the only use I think you are on safe ground.

Tom




Reply sent to Simen Heggestøyl <simenheg <at> gmail.com>:
You have taken responsibility. (Wed, 07 Oct 2015 17:29:02 GMT) Full text and rfc822 format available.

Notification sent to Tom Tromey <tom <at> tromey.com>:
bug acknowledged by developer. (Wed, 07 Oct 2015 17:29:02 GMT) Full text and rfc822 format available.

Message #16 received at 21638-done <at> debbugs.gnu.org (full text, mbox):

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Tom Tromey <tom <at> tromey.com>
Cc: 21638-done <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#21638: 25.0.50; font-lock for CSS variables
Date: Wed, 07 Oct 2015 19:28:26 +0200
Tom Tromey <tom <at> tromey.com> writes:
> Simen> Good idea. The patch seems to do the job, but it also has the side
> Simen> effect that '---foo', '----foo' and so on are recognized as
> Simen> properties.
>
> Yeah, sorry, I forgot that the rest had to look like an identifier.
>
> Simen> Though I'm unsure what 'css-nmstart-re' is intended to contain,
> Simen> since
> Simen> it's missing a docstring. Maybe Stefan knows?
>
> Considering that this is the only use I think you are on safe ground.
>
> Tom

Alright Tom, I've installed the fix.

Thanks for the report!

-- Simen




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 05 Nov 2015 12:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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