* bug#21230: 25.0.50; scss-mode: Font Lock hangs on Sass lists
@ 2015-08-10 15:42 Simen Heggestøyl
2016-01-09 12:55 ` Simen Heggestøyl
0 siblings, 1 reply; 3+ messages in thread
From: Simen Heggestøyl @ 2015-08-10 15:42 UTC (permalink / raw)
To: 21230
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
In scss-mode, Font Lock hangs on particular instances of Sass lists.
To see an example of this, paste the following into a buffer, and
activate scss-mode + font-lock-mode:
$list: (
('string', #000000, #fff)
('string', #000000, #fff)
('string', #000000, #fff)
('string', #000000, #fff)
('string', #000000, #fff)
('string', #000000, #fff)
);
Font Lock hangs, and I find that I have to press C-g a number of times
to be able to continue editing.
In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6)
of 2015-08-10 on x240
Repository revision: a9bb9d8fc22417d1fafd8001d89a91c33c8b39ec
Windowing system distributor `The X.Org Foundation', version
11.0.11702000
System Description: Debian GNU/Linux testing (stretch)
Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY LIBXML2 FREETYPE XFT
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: SCSS
[-- Attachment #2: Type: text/html, Size: 1497 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#21230: 25.0.50; scss-mode: Font Lock hangs on Sass lists
2015-08-10 15:42 bug#21230: 25.0.50; scss-mode: Font Lock hangs on Sass lists Simen Heggestøyl
@ 2016-01-09 12:55 ` Simen Heggestøyl
2016-01-14 18:37 ` Simen Heggestøyl
0 siblings, 1 reply; 3+ messages in thread
From: Simen Heggestøyl @ 2016-01-09 12:55 UTC (permalink / raw)
To: 21230; +Cc: Stefan Monnier
[-- Attachment #1.1: Type: text/plain, Size: 263 bytes --]
It seems that this happens because scss-mode thinks that the list
elements are selectors. The attached patch attempts to fix this by
disallowing parenthesis in selectors, except for in the function
notation that might appear right after pseudo-classes.
-- Simen
[-- Attachment #1.2: Type: text/html, Size: 331 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Disallow-parenthesis-in-non-pseudo-CSS-selectors.patch --]
[-- Type: text/x-patch, Size: 2467 bytes --]
From f4ff7b89348142f103412e9aa6b3e2352dbfa567 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <simenheg@gmail.com>
Date: Sat, 2 Jan 2016 23:44:58 +0100
Subject: [PATCH] Disallow parenthesis in non-pseudo CSS selectors
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Disallow
parenthesis in selectors except for in the function notation that
might appear right after a pseudo-class.
---
lisp/textmodes/css-mode.el | 10 +++++-----
test/indent/scss-mode.scss | 10 ++++++++++
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 48c2484..d402fb1 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -257,13 +257,13 @@ css--font-lock-keywords
(if (not sassy)
;; We don't allow / as first char, so as not to
;; take a comment as the beginning of a selector.
- "[^@/:{} \t\n][^:{}]+"
+ "[^@/:{}() \t\n][^:{}()]+"
;; Same as for non-sassy except we do want to allow { and }
;; chars in selectors in the case of #{$foo}
;; variable interpolation!
(concat "\\(?:" scss--hash-re
- "\\|[^@/:{} \t\n#]\\)"
- "[^:{}#]*\\(?:" scss--hash-re "[^:{}#]*\\)*"))
+ "\\|[^@/:{}() \t\n#]\\)"
+ "[^:{}()#]*\\(?:" scss--hash-re "[^:{}()#]*\\)*"))
;; Even though pseudo-elements should be prefixed by ::, a
;; single colon is accepted for backward compatibility.
"\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids
@@ -271,8 +271,8 @@ css--font-lock-keywords
"\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)"
"\\(?:([^)]+)\\)?"
(if (not sassy)
- "[^:{}\n]*"
- (concat "[^:{}\n#]*\\(?:" scss--hash-re "[^:{}\n#]*\\)*"))
+ "[^:{}()\n]*"
+ (concat "[^:{}()\n#]*\\(?:" scss--hash-re "[^:{}()\n#]*\\)*"))
"\\)*"
"\\)\\(?:\n[ \t]*\\)*{")
(1 'css-selector keep))
diff --git a/test/indent/scss-mode.scss b/test/indent/scss-mode.scss
index 7a29929..02a4a98 100644
--- a/test/indent/scss-mode.scss
+++ b/test/indent/scss-mode.scss
@@ -55,3 +55,13 @@ article[role="main"] {
}
.box { @include border-radius(10px); }
+
+// bug:21230
+$list: (
+ ('a', #000000, #fff)
+ ('b', #000000, #fff)
+ ('c', #000000, #fff)
+ ('d', #000000, #fff)
+ ('e', #000000, #fff)
+ ('f', #000000, #fff)
+);
--
2.6.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-14 18:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10 15:42 bug#21230: 25.0.50; scss-mode: Font Lock hangs on Sass lists Simen Heggestøyl
2016-01-09 12:55 ` Simen Heggestøyl
2016-01-14 18:37 ` Simen Heggestøyl
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.