unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21638: 25.0.50; font-lock for CSS variables
@ 2015-10-06 17:57 Tom Tromey
  2015-10-06 19:24 ` Simen Heggestøyl
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2015-10-06 17:57 UTC (permalink / raw)
  To: 21638


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:]]\\|\\\\\\(?:[^.-\x1f\x7f]\\|[0-9a-fA-F]+[ 
	.\f]?\\)\\)\\)\\(?:[-[:alnum:]]\\|\\\\\\(?:[^.-\x1f\x7f]\\|[0-9a-fA-F]+[ 
	.\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))





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#21638: 25.0.50; font-lock for CSS variables
  2015-10-06 17:57 bug#21638: 25.0.50; font-lock for CSS variables Tom Tromey
@ 2015-10-06 19:24 ` Simen Heggestøyl
  2015-10-06 21:10   ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Simen Heggestøyl @ 2015-10-06 19:24 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 21638, monnier

Tom Tromey <tom@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





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#21638: 25.0.50; font-lock for CSS variables
  2015-10-06 19:24 ` Simen Heggestøyl
@ 2015-10-06 21:10   ` Tom Tromey
  2015-10-07 17:28     ` Simen Heggestøyl
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2015-10-06 21:10 UTC (permalink / raw)
  To: Simen Heggestøyl; +Cc: 21638, Tom Tromey, monnier

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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#21638: 25.0.50; font-lock for CSS variables
  2015-10-06 21:10   ` Tom Tromey
@ 2015-10-07 17:28     ` Simen Heggestøyl
  0 siblings, 0 replies; 4+ messages in thread
From: Simen Heggestøyl @ 2015-10-07 17:28 UTC (permalink / raw)
  To: Tom Tromey; +Cc: 21638-done, monnier

Tom Tromey <tom@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-07 17:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 17:57 bug#21638: 25.0.50; font-lock for CSS variables Tom Tromey
2015-10-06 19:24 ` Simen Heggestøyl
2015-10-06 21:10   ` Tom Tromey
2015-10-07 17:28     ` Simen Heggestøyl

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).