1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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.
This commit is contained in:
Simen Heggestøyl 2016-04-24 11:03:22 +02:00
parent 5cb7620027
commit 8e2e252932
2 changed files with 16 additions and 7 deletions

View file

@ -792,13 +792,15 @@ the symbol VALUE-CLASS."
Completion candidates are looked up in `css-property-alist' by
the string PROPERTY."
(or (gethash property css--property-value-cache)
(seq-mapcat
(lambda (value)
(if (stringp value)
(list value)
(or (css--value-class-lookup value)
(css--property-values (symbol-name value)))))
(cdr (assoc property css-property-alist)))))
(let ((values
(seq-mapcat
(lambda (value)
(if (stringp value)
(list value)
(or (css--value-class-lookup value)
(css--property-values (symbol-name value)))))
(cdr (assoc property css-property-alist)))))
(puthash property values css--property-value-cache))))
(defun css--complete-property-value ()
"Complete property value at point."