]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow CSS completion with multiple rules on one line
authorPhilip K <philipk@posteo.net>
Sun, 6 Sep 2020 22:17:15 +0000 (00:17 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 6 Sep 2020 22:17:15 +0000 (00:17 +0200)
* css-mode.el (css--complete-property-value): Check for semi-colon
when completing property values (bug#43242).

lisp/textmodes/css-mode.el

index 8c824461d22fe51bd2021143bbdd6e4eaed4c3db..03edd4703eab344623f7e944b12c24cdce8f0889 100644 (file)
@@ -1356,21 +1356,17 @@ the string PROPERTY."
 
 (defun css--complete-property-value ()
   "Complete property value at point."
-  (let ((property
-         (save-excursion
-           (re-search-backward ":[^/]" (line-beginning-position) t)
-           (when (eq (char-after) ?:)
-             (let ((property-end (point)))
-               (skip-chars-backward "-[:alnum:]")
-               (let ((prop (buffer-substring (point) property-end)))
-                 (car (member prop css-property-ids))))))))
+  (let ((property (and (looking-back "\\([[:alnum:]-]+\\):[^/][^;]*"
+                                     (line-beginning-position) t)
+                       (member (match-string-no-properties 1)
+                               css-property-ids))))
     (when property
       (let ((end (point)))
         (save-excursion
           (skip-chars-backward "[:graph:]")
           (list (point) end
                 (append '("inherit" "initial" "unset")
-                        (css--property-values property))))))))
+                        (css--property-values (car property)))))))))
 
 (defvar css--html-tags (mapcar #'car html-tag-alist)
   "List of HTML tags.