* 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.
"xx-small" "x-small" "small" "medium" "large" "x-large"
"xx-large")
(alphavalue number)
"xx-small" "x-small" "small" "medium" "large" "x-large"
"xx-large")
(alphavalue number)
(attachment "scroll" "fixed" "local")
(bg-image image "none")
(bg-layer bg-image position repeat-style attachment box)
(attachment "scroll" "fixed" "local")
(bg-image image "none")
(bg-layer bg-image position repeat-style attachment box)
(final-bg-layer
bg-image position repeat-style attachment box color)
(font-variant-css21 "normal" "small-caps")
(final-bg-layer
bg-image position repeat-style attachment box color)
(font-variant-css21 "normal" "small-caps")
(generic-family
"serif" "sans-serif" "cursive" "fantasy" "monospace")
(generic-voice "male" "female" "child")
(generic-family
"serif" "sans-serif" "cursive" "fantasy" "monospace")
(generic-voice "male" "female" "child")
"historical-ligatures" "no-historical-ligatures")
(image uri image-list element-reference gradient)
(image-list "image()")
"historical-ligatures" "no-historical-ligatures")
(image uri image-list element-reference gradient)
(image-list "image()")
+ (integer "calc()")
+ (length "calc()" number)
(line-height "normal" number length percentage)
(line-style
"none" "hidden" "dotted" "dashed" "solid" "double" "groove"
(line-height "normal" number length percentage)
(line-style
"none" "hidden" "dotted" "dashed" "solid" "double" "groove"
(line-width length "thin" "medium" "thick")
(linear-gradient "linear-gradient()")
(margin-width "auto" length percentage)
(line-width length "thin" "medium" "thick")
(linear-gradient "linear-gradient()")
(margin-width "auto" length percentage)
(numeric-figure-values "lining-nums" "oldstyle-nums")
(numeric-fraction-values "diagonal-fractions" "stacked-fractions")
(numeric-spacing-values "proportional-nums" "tabular-nums")
(numeric-figure-values "lining-nums" "oldstyle-nums")
(numeric-fraction-values "diagonal-fractions" "stacked-fractions")
(numeric-spacing-values "proportional-nums" "tabular-nums")
"step-end" "steps()" "cubic-bezier()")
(specific-voice identifier)
(target-name string)
"step-end" "steps()" "cubic-bezier()")
(specific-voice identifier)
(target-name string)
(transform-list
"matrix()" "translate()" "translateX()" "translateY()" "scale()"
"scaleX()" "scaleY()" "rotate()" "skew()" "skewX()" "skewY()"
(transform-list
"matrix()" "translate()" "translateX()" "translateY()" "scale()"
"scaleX()" "scaleY()" "rotate()" "skew()" "skewX()" "skewY()"
other entries in this list, not to properties.
The following classes have been left out above because they
other entries in this list, not to properties.
The following classes have been left out above because they
-cannot be completed sensibly: `angle', `element-reference',
-`frequency', `id', `identifier', `integer', `number',
-`percentage', `string', and `time'.")
+cannot be completed sensibly: `element-reference', `id',
+`identifier', `percentage', and `string'.")
(defcustom css-electric-keys '(?\} ?\;) ;; '()
"Self inserting keys which should trigger re-indentation."
(defcustom css-electric-keys '(?\} ?\;) ;; '()
"Self inserting keys which should trigger re-indentation."
"Return a list of value completion candidates for VALUE-CLASS.
Completion candidates are looked up in `css-value-class-alist' by
the symbol VALUE-CLASS."
"Return a list of value completion candidates for VALUE-CLASS.
Completion candidates are looked up in `css-value-class-alist' by
the symbol VALUE-CLASS."
- (seq-mapcat
- (lambda (value)
- (if (stringp value)
- (list value)
- (css--value-class-lookup value)))
- (cdr (assq value-class css-value-class-alist))))
+ (seq-uniq
+ (seq-mapcat
+ (lambda (value)
+ (if (stringp value)
+ (list value)
+ (css--value-class-lookup value)))
+ (cdr (assq value-class css-value-class-alist)))))
(defun css--property-values (property)
"Return a list of value completion candidates for PROPERTY.
(defun css--property-values (property)
"Return a list of value completion candidates for PROPERTY.
;; removed, it'll contain at least two instances of `auto'.
(should
(equal (sort (css--property-values "flex") #'string-lessp)
;; removed, it'll contain at least two instances of `auto'.
(should
(equal (sort (css--property-values "flex") #'string-lessp)
- '("auto" "content" "none"))))
+ '("auto" "calc()" "content" "none"))))
(ert-deftest css-test-value-class-lookup ()
(should
(equal (sort (css--value-class-lookup 'position) #'string-lessp)
(ert-deftest css-test-value-class-lookup ()
(should
(equal (sort (css--value-class-lookup 'position) #'string-lessp)
- '("bottom" "center" "left" "right" "top"))))
+ '("bottom" "calc()" "center" "left" "right" "top"))))
(provide 'css-mode-tests)
;;; css-mode-tests.el ends here
(provide 'css-mode-tests)
;;; css-mode-tests.el ends here