Commit graph

101 commits

Author SHA1 Message Date
Simen Heggestøyl
d2d6e4452c Support a new CSS indentation style
* lisp/textmodes/css-mode.el (css-smie-rules): Indent after property
immediately followed by a newline.

* test/manual/indent/css-mode.css: Add test for the change above.

* test/manual/indent/scss-mode.scss: Ditto.
2017-06-03 15:09:01 +02:00
Simen Heggestøyl
8deef1d6a7 Expand docstring for CSS mode
* lisp/textmodes/css-mode.el (css-completion-at-point, css-mode):
Expand docstrings.
2017-05-18 17:59:56 +02:00
Paul Eggert
723b16a875 ; Spelling fixes 2017-05-06 18:30:14 -07:00
Tom Tromey
f0708fc5e4 Add color highlighting to css-mode
Bug#25525
* lisp/textmodes/css-mode.el (css--color-map): New constant.
(css-value-class-alist): Use css--color-map.
(css--number-regexp, css--percent-regexp)
(css--number-or-percent-regexp, css--angle-regexp): New constants.
(css--color-skip-blanks, css--rgb-color, css--hsl-color): New
functions.
(css--colors-regexp): New constant.
(css--hex-color, css--named-color, css--compute-color)
(css--contrasty-color, css--fontify-colors)
(css--fontify-region): New functions.
(css-mode): Set font-lock-fontify-region-function.
(css-mode-syntax-table): Set syntax on more characters.
(css-fontify-colors): New defcustom.
(scss-mode-syntax-table): Define syntax for ?$ and ?%.
* test/lisp/textmodes/css-mode-tests.el (css-test-property-values):
Update.
(css-test-rgb-parser, css-test-hsl-parser)
(css-test-named-color): New tests.
* etc/NEWS: Add entry.
2017-05-03 16:00:25 -06:00
Simen Heggestøyl
bdd0c8600f Fix highlighting of short selectors in CSS mode
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Highlight
selectors where the part before a colon is only one character long,
such as `a:hover'.
2017-04-16 11:55:33 +02:00
Simen Heggestøyl
02220c174e Add grid layout module to CSS property list
* lisp/textmodes/css-mode.el (css-property-alist)
(css-value-class-alist): Add new properties and value classes from CSS
Grid Layout Module.
2017-04-13 18:54:19 +02:00
Simen Heggestøyl
7d2d954d6a Add one more CSS pseudo-class
* lisp/textmodes/css-mode.el (css-pseudo-class-ids): Add
`focus-within'.
2017-03-29 19:52:13 +02:00
Simen Heggestøyl
6967c4f067 Update list of CSS pseudo-classes
* lisp/textmodes/css-mode.el (css-pseudo-class-ids): Update list of
pseudo-classes.
2017-03-29 19:39:04 +02:00
Simen Heggestøyl
f7040f5b16 Add `touch-action' to list of CSS properties
* lisp/textmodes/css-mode.el (css-property-alist): Add `touch-action'
property.
2017-03-12 16:54:15 +01:00
Stefan Monnier
fe578ae4dd * lisp/textmodes/css-mode.el (css-completion-at-point): Auto-insert
": ;" after completing a property.
2017-02-28 09:29:06 -05:00
Tom Tromey
c2e19a7340 Fix bug in css--mdn-find-symbol
* lisp/textmodes/css-mode.el (css--mdn-find-symbol): Skip whitespace
before skipping word characters.
test/lisp/textmodes/css-mode-tests.el (css-mdn-symbol-guessing): Add
regression test.
2017-02-11 08:43:47 -07:00
Simen Heggestøyl
5e222f6737 * lisp/textmodes/css-mode.el: Require subr-x at compile time 2017-02-05 22:23:57 +01:00
Tom Tromey
148100d983 typo fix
(css--colon-inside-selector-p): Fix typo in docstring.
2017-02-04 13:22:39 -07:00
Simen Heggestøyl
f6ff7bb1fc Fix indentation of multiline CSS property values
* lisp/textmodes/css-mode.el (css-smie-grammar): Give colons belonging
to properties higher precedence.
(css--colon-inside-selector-p, css--colon-inside-funcall): New
functions for helping SMIE during tokenization.
(css-smie--forward-token, css-smie--backward-token): Distinguish
colons belonging to properties from other colons.

* test/manual/indent/css-mode.css: Add tests for the changes above.

* test/manual/indent/scss-mode.scss: Ditto.
2017-02-04 20:19:54 +01:00
Tom Tromey
68e8f4bb4a css-mode documentation lookup feature
* etc/NEWS: Mention new feature.
* lisp/textmodes/css-mode.el (css-mode-map): New defvar.
(css--mdn-lookup-history): New defvar.
(css-lookup-url-format): New defcustom.
(css--mdn-property-regexp, css--mdn-completion-list): New defconsts.
(css--mdn-after-render, css--mdn-find-symbol, css-lookup-symbol): New
defuns.
* test/lisp/textmodes/css-mode-tests.el (css-mdn-symbol-guessing): New
test.
2017-01-30 15:53:10 -07:00
Tom Tromey
8083d258ba Treat ":root" as a css-selector
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Recognize bare
":root" as selector.
2017-01-17 15:35:39 -07:00
Tom Tromey
e27239ad1b Fix comment in css-mode.el
* lisp/textmodes/css-mode.el: Remove obsolete comment.
2017-01-16 17:22:05 -07:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Simen Heggestøyl
4478cf0ac8 Add will change module to CSS property list
* lisp/textmodes/css-mode.el (css-property-alist)
(css-value-class-alist): Add new property and value class from CSS
Will Change Module.
2016-11-26 11:11:28 +01:00
Simen Heggestøyl
6ddcb0f10f Support completion of classes and IDs in CSS mode
* lisp/textmodes/css-mode.el (css-class-list-function): New variable
holding the function to call for retrieving completions of class
names.
(css-id-list-function): New variable holding the function to call for
retrieving completions of IDs.
(css--foreign-completions): New function for retrieving completions
from other buffers.
(css--complete-selector): Support completing HTML class names and IDs
from other buffers in addition to completing HTML tags.

* lisp/textmodes/sgml-mode.el (html--buffer-classes-cache): New
variable holding a cache for `html-current-buffer-classes'.
(html--buffer-ids-cache): New variable holding a cache for
`html-current-buffer-ids'.
(html-current-buffer-classes): New function returning a list of class
names used in the current buffer.
(html-current-buffer-ids): New function returning a list of IDs used
in the current buffer.
(html-mode): Set `css-class-list-function' and `css-id-list-function'
to `html-current-buffer-classes' and `html-current-buffer-ids'
respectively.
2016-09-24 13:55:36 +02:00
Simen Heggestøyl
09428ffc63 Add "supports" to list of CSS at-rules
* lisp/textmodes/css-mode.el (css-at-ids): Add "supports" at-rule.
2016-08-26 19:16:47 +02:00
Simen Heggestøyl
c0a5ae906d Complete "initial" and "unset" in CSS mode
* lisp/textmodes/css-mode.el (css--complete-property-value): Make
"initial" and "unset" completion candidates for all CSS properties,
just like "inherit".

* test/lisp/textmodes/css-mode-tests.el
(css-test-complete-property-value): Update test to reflect the above
change.
2016-07-06 19:25:10 +02:00
Etienne Prud’homme
162bc021a1 Add completion of colors in CSS mode
* lisp/textmodes/css-mode.el (css-value-class-alist): Add CSS colors
from "CSS Color Module Level 3".

* test/lisp/textmodes/css-mode-tests.el (css-test-property-values):
Update test.
2016-05-22 12:54:02 +02:00
Simen Heggestøyl
d546ed13b0 Support completion of HTML tags in CSS selectors
* lisp/textmodes/css-mode.el (css--html-tags): New variable holding a
list of HTML tags for completion.
(css--nested-selectors-allowed): New variable for determining whether
nested selectors are allowed in the current mode.
(css--complete-selector): New function for completing part of a CSS
selector.
(css-completion-at-point): Support completion of selectors.
(scss-mode): Allow nested selectors.
2016-05-05 21:22:36 +02:00
Simen Heggestøyl
07d729130e Add completion of `calc()' in CSS mode
* lisp/textmodes/css-mode.el (css-value-class-alist): Add `calc()' as
a completion candidate for several value classes.
(css--value-class-lookup): Return only unique results.

* test/lisp/textmodes/css-mode-tests.el
(css-test-property-values-no-duplicates)
(css-test-value-class-lookup): Update to reflect the above changes.
2016-04-26 20:41:04 +02:00
Simen Heggestøyl
e6d6a99455 Don't let `css--property-values' return duplicates
* lisp/textmodes/css-mode.el (css--property-values): Don't return
duplicate values.

* test/lisp/textmodes/css-mode-tests.el (css-test-property-values):
Take the above into account.
(css-test-property-values-no-duplicates): Test that duplicates aren't
returned by `css--property-values'.
2016-04-24 19:58:36 +02:00
Simen Heggestøyl
8e2e252932 Cache results of `css--property-values'
* lisp/textmodes/css-mode.el (css--property-values): Cache computed
values.

* test/lisp/textmodes/css-mode-tests.el (css-test-property-value-cache):
New regression test for the above.
2016-04-24 15:02:05 +02:00
Simen Heggestøyl
0c9f35a9b0 Add "keyframes" to list of CSS at-rules
* lisp/textmodes/css-mode.el (css-at-ids): Add "keyframes" at-rule.
2016-04-20 20:08:56 +02:00
Etienne Prud'homme
728b1c7f13 Support completion of at-rules in SCSS mode
lisp/textmodes/css-mode.el (scss-at-ids): New defconst holding
SCSS-specific at-rules.
(css--at-ids): New buffer-local variable holding the list of at-rules
for the current mode.
(css--complete-at-rule): Retrieve at-rules from `css--at-ids`.
(scss-mode): Set `css--at-ids'.

Copyright-paperwork-exempt: yes
2016-04-05 23:12:11 +02:00
Simen Heggestøyl
750e1e1942 Support completion of bang-rules in CSS mode
lisp/textmodes/css-mode.el (css--bang-ids): New buffer-local variable
holding the list of bang-rules for the current mode.
(css--font-lock-keywords): Retrieve bang-rules from `css--bang-ids'
instead of computing them.
(css--complete-bang-rule): New function for completing a bang-rule.
(css-completion-at-point): Add support for completing bang-rules.
(scss-font-lock-keywords): Change from a variable to a function in
order to recompute `css--font-lock-keywords' when `css--bang-ids' has
changed.
(scss-mode): Set `css--bang-ids' and recompute font-lock keywords.
2016-03-31 21:21:34 +02:00
Simen Heggestøyl
269d5631ab Support completion of attribute values in CSS mode
* lisp/textmodes/css-mode.el (css-property-alist): New defconst
holding CSS identifiers and the values they can have.
(css-property-ids): Compute dynamically from `css-property-alist'.
(css-value-class-alist): New defconst holding property value classes
and their values.
(css--property-value-cache): New variable providing a cache for
`css--property-values'.
(css--value-class-lookup): New function for computing a list of values
in a value class.
(css--property-values): New function for computing a list of possible
values for a CSS property.
(css--complete-property-value): New function for completing a property
value.
(css-completion-at-point): Add support for completing property values.
* test/lisp/textmodes/css-mode-tests.el: New file.
2016-03-23 19:03:47 +01:00
Simen Heggestøyl
fb0959e713 Declare $ as an expression prefix in SCSS
* lisp/textmodes/css-mode.el (scss-mode-syntax-table): Declare $ as an
expression prefix (bug#22841).
2016-02-29 17:06:26 +11:00
Lars Ingebrigtsen
3e2883c4ce Revert "Declare $ as an expression prefix in SCSS"
This reverts commit ffb33264f2.

Revering to fix author name.
2016-02-29 17:05:14 +11:00
Simen
ffb33264f2 Declare $ as an expression prefix in SCSS
* lisp/textmodes/css-mode.el (scss-mode-syntax-table): Declare $ as an
expression prefix (bug#22841).
2016-02-29 17:03:39 +11:00
Simen Heggestøyl
5a0472e8ea Add column layout module to CSS property list
* lisp/textmodes/css-mode.el (css-property-ids): Add properties from
CSS Multi-column Layout Module.
2016-02-16 21:52:59 +01:00
Simen Heggestøyl
ab7583a2b0 Add fragmentation module to CSS property list
* lisp/textmodes/css-mode.el (css-property-ids): Add properties from
CSS Fragmentation Module Level 3.
2016-02-14 20:31:46 +01:00
Simen Heggestøyl
1d07dcd720 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.
2016-02-01 21:38:25 +01:00
Simen Heggestøyl
2df0e04296 Highlight CSS variables with variable name face
* lisp/textmodes/css-mode.el (css-nmstart-re): Don't match variables.
(css--font-lock-keywords): Highlight variables in
`font-lock-variable-name-face'.
2016-01-30 20:47:18 +01:00
Simen Heggestøyl
dadb841a06 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.
* test/indent/scss-mode.scss: Add a test for it.
2016-01-14 19:24:03 +01:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Tom Tromey
2ed9de442c set :safe on css-indent-offset
* lisp/textmodes/css-mode.el (css-indent-offset): Add :safe 'integerp.
2015-12-28 13:13:00 -07:00
Simen Heggestøyl
3cd29a5d15 Highlight CSS variable definitions
* lisp/textmodes/css-mode.el (css-nmstart-re): Tweak regexp to accept
CSS variables.  (Bug#21638)
2015-10-07 19:19:42 +02:00
Simen Heggestøyl
d9d2e37658 Add overflow module to CSS property list
* lisp/textmodes/css-mode.el (css-property-ids): Add properties from CSS
Overflow Module Level 3.
2015-09-19 16:25:40 +02:00
Paul Eggert
284c470ef7 Backslash cleanup in Elisp source files
This patch should not change behavior.  It typically omits backslashes
where they are redundant (e.g., in the string literal "^\$").
In a few places, insert backslashes where they make regular
expressions clearer: e.g., replace "^\*" (equivalent to "^*") with
"^\\*", which has the same effect as a regular expression.
Also, use ‘\ %’ instead of ‘\%’ when avoiding confusion with SCCS IDs,
and similarly use ‘\ $’ instead of ‘\$’ when avoiding confusion with
RCS IDs, as that makes it clearer that the backslash is intended.
2015-09-17 16:09:39 -07:00
Simen Heggestøyl
c6af816aff Fix indentation rule in css-mode
* lisp/textmodes/css-mode.el (css-smie-rules): Fix indentation of
brackets in presence of pseudo-selectors.  (Bug#21328)
2015-08-28 19:36:10 +02:00
Simen Heggestøyl
7372c1ab06 Handle comments inside unquoted URIs in css-mode
* lisp/textmodes/css-mode.el (css--uri-re): New defconst.
(css-syntax-propertize-function): New defconst.
(css--font-lock-keywords): Handle parens around unquoted URIs.
(css-mode): Set `syntax-propertize-function'.
2015-08-22 19:13:10 +02:00
Simen Heggestøyl
1dee790fc1 css-mode.el: Support multi-line comment filling
Fixes: debbugs:20256

* lisp/textmodes/css-mode.el (css-fill-paragraph): Support multi-line
comment filling.
(css-adaptive-fill): New function.
(css-mode): Set `adaptive-fill-function'.
(scss-mode): Set `comment-continue'.
2015-04-18 20:25:40 +02:00
Simen Heggestøyl
e597344849 css-mode.el: Add "not" pseudo-class
Fixes: debbugs:20267

* textmodes/css-mode.el (css-pseudo-class-ids): Add "not" to list
of CSS pseudo-classes.
2015-04-09 21:01:02 +02:00
Stefan Monnier
6083965958 css-mode.el (css-smie-rules): Fix indentation after complex selectors
Fixes: debbugs:20282

* lisp/textmodes/css-mode.el (css-smie-rules): Don't get confused by
inner structure of selectors.
2015-04-09 10:51:23 -04:00