Commit graph

112 commits

Author SHA1 Message Date
Simen Heggestøyl
a9f8706fa8 Fix completion of colon after CSS property (Bug#29056)
* lisp/textmodes/css-mode.el (css-completion-at-point): Don't insert
": ;" after completing a CSS property unless the rest of the line is
empty.
2017-11-02 20:39:39 +01:00
Simen Heggestøyl
ff33053012 Fix indentation bug in multi-line CSS selectors
* lisp/textmodes/css-mode.el (css--colon-inside-selector-p): Fix
indentation of multi-line CSS selectors that include both a
pseudo-class and parenthesis.

* test/manual/indent/css-mode.css: Add test for the above change.
2017-10-13 21:57:52 +02:00
Simen Heggestøyl
60b7668b89 Keep eww buffer current when looking up CSS on MDN
* lisp/textmodes/css-mode.el (css-lookup-symbol): Keep the eww buffer
current when looking up CSS documentation on MDN.  This fixes a bug
where the eww buffer's content sometimes get mangled when switching
buffers mid-render.
2017-10-01 20:27:07 +02:00
Tom Tromey
48d39c39e8 Search for Syntax section when viewing MDN
* lisp/textmodes/css-mode.el (css--mdn-after-render): Also search for
"Syntax" section.
2017-09-16 21:55:05 -06:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November.  Change these FTP URLs to https://ftp.gnu.org
instead.  Make similar changes for URLs to other organizations moving
away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
2017-09-13 15:54:37 -07:00
Mark Oteiza
370d0e7aa7 Update uses of if-let and when-let
* lisp/dom.el (dom-previous-sibling):
* lisp/emacs-lisp/package.el (package--with-work-buffer):
(package--sort-deps-in-alist, package--sort-by-dependence):
(package-install-from-archive, package-install):
(package-menu-execute, package-menu--populate-new-package-list):
* lisp/filenotify.el (file-notify--rm-descriptor):
(file-notify--event-watched-file, file-notify--event-file-name):
(file-notify--event-file1-name, file-notify-rm-watch):
(file-notify-valid-p):
* lisp/gnus/message.el (message-toggle-image-thumbnails):
* lisp/gnus/nnimap.el (nnimap-request-move-article):
* lisp/ibuf-ext.el (ibuffer-repair-saved-filters):
* lisp/mpc.el (mpc-format):
* lisp/net/eww.el (eww-tag-meta, eww-process-text-input):
(eww-save-history):
* lisp/net/shr.el (shr-tag-base, shr-tag-object, shr-make-table-1):
* lisp/progmodes/prog-mode.el (prettify-symbols--post-command-hook):
* lisp/svg.el (svg-remove):
* lisp/textmodes/css-mode.el (css--named-color):
(css--colon-inside-funcall):
* lisp/textmodes/sgml-mode.el (html-current-buffer-classes):
(html-current-buffer-ids): Use if-let* and when-let* instead.
2017-09-12 13:18:10 -04:00
Simen Heggestøyl
141cc78aa4 Support indentation of detached Less CSS rulesets
* lisp/textmodes/css-mode.el (css-smie-rules): Provide better support
for indentation of detached rulesets passed to Less mixins.

* test/manual/indent/less-css-mode.less: New file.
2017-08-15 14:38:15 +02:00
Simen Heggestøyl
4219240e1d Change default CSS property face
* lisp/textmodes/css-mode.el (css-property): Inherit from
`font-lock-keyword-face' instead of `font-lock-variable-name-face' to
distinguish CSS properties from variables.
2017-07-30 11:30:13 +02:00
Simen Heggestøyl
3d7221d09a Remove :options' from css-electric-keys'
* lisp/textmodes/css-mode.el (css-electric-keys): Remove `:options`
since it just duplicates the default value.
2017-06-20 21:03:22 +02:00
Simen Heggestøyl
8960f6aa36 Complete CSS property values less eagerly (Bug#27392)
* lisp/textmodes/css-mode.el (css--complete-property-value): Be less
eager by looking for a colon after the property which values are being
completed for.

* test/lisp/textmodes/css-mode-tests.el (css-test-complete-property):
Add a test case ensuring that properties that are prefixes of other
properties don't hinder further completion.
2017-06-17 10:38:29 +02:00
Simen Heggestøyl
ee051688c1 Fix highlighting of CSS selectors with double hyphens
* lisp/textmodes/css-mode.el (css--font-lock-keywords): Fix
highlighting of selectors that contain double hyphens.  They would be
mistaken for a variable.
2017-06-11 19:32:17 +02:00
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