diff options
author | Simen Heggestøyl <simenheg@gmail.com> | 2016-04-24 11:03:22 +0200 |
---|---|---|
committer | Simen Heggestøyl <simenheg@gmail.com> | 2016-04-24 15:02:05 +0200 |
commit | 8e2e252932faf3320f72a0b62136c4606e09ebc3 (patch) | |
tree | aaaaa5b71b2b8ac3fbfc6b27985f1b07c71ce43c /lisp/textmodes/css-mode.el | |
parent | 5cb7620027f78a3a0f473972a0584c8ea1791398 (diff) | |
download | emacs-8e2e252932faf3320f72a0b62136c4606e09ebc3.tar.gz |
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.
Diffstat (limited to 'lisp/textmodes/css-mode.el')
-rw-r--r-- | lisp/textmodes/css-mode.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 2a61fe3736b..8a4daac353a 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -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." |