-;;; css-mode.el --- Major mode to edit CSS files
+;;; css-mode.el --- Major mode to edit CSS files -*- lexical-binding: t -*-
-;; Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2011 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
;; Keywords: hypermedia
;; vice-versa).
(t nil)))
elems))
-
+
(defun css-extract-props-and-vals ()
(with-temp-buffer
(progn
(re-search-forward "[ \t\n]+|[ \t\n]+<a href=\"cascade.html#value-def-inherit\" class=\"noxref\"><span class=\"value-inst-inherit\">inherit</span></a>")
(match-beginning 0)))))
- ;;
+ ;;
(push (cons prop (css-extract-parse-val-grammar vals-string props))
props)))))
props)))
(defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re "\\)"))
(defconst css-nmstart-re (concat "\\(?:[[:alpha:]]\\|" css-escapes-re "\\)"))
(defconst css-ident-re (concat css-nmstart-re css-nmchar-re "*"))
+(defconst css-proprietary-nmstart-re ;; Vendor-specific properties.
+ "[-_]\\(?:ms\\|moz\\|o\\|webkit\\|khtml\\)-")
(defconst css-name-re (concat css-nmchar-re "+"))
(defface css-selector '((t :inherit font-lock-function-name-face))
(defface css-property '((t :inherit font-lock-variable-name-face))
"Face to use for properties."
:group 'css)
+(defface css-proprietary-property '((t :inherit (css-property italic)))
+ "Face to use for vendor-specific properties.")
(defvar css-font-lock-keywords
`(("!\\s-*important" . font-lock-builtin-face)
;; No face.
nil)))
;; Properties. Again, we don't limit ourselves to css-property-ids.
- (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\(" css-ident-re "\\)\\s-*:")
- (1 'css-property))))
+ (,(concat "\\(?:[{;]\\|^\\)[ \t]*\\("
+ "\\(?:\\(" css-proprietary-nmstart-re "\\)\\|"
+ css-nmstart-re "\\)" css-nmchar-re "*"
+ "\\)\\s-*:")
+ (1 (if (match-end 2) 'css-proprietary-property 'css-property)))))
(defvar css-font-lock-defaults
'(css-font-lock-keywords nil t))
-;;;###autoload (add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
;;;###autoload
(define-derived-mode css-mode fundamental-mode "CSS"
"Major mode to edit Cascading Style Sheets."
(fill-paragraph justify)
;; Don't try filling again.
t)))
-
+
((and (null (nth 8 ppss))
(or (nth 1 ppss)
(and (ignore-errors
(save-excursion
(forward-comment (- (point-max)))
;; FIXME: We should also skip punctuation.
- (not (memq (char-before) '(?\; ?\{)))))))))))
+ (not (or (bobp) (memq (char-before) '(?\; ?\{))))))))))))
(defun css-forward-sexp (n)
(let ((forward-sexp-function nil))
(if (looking-at "\\s(")
(css-indent-calculate)
(css-indent-calculate-virtual))))))))))
-
+
(defun css-indent-line ()
"Indent current line according to CSS indentation rules."
(indent-line-to indent)))))
(provide 'css-mode)
-;; arch-tag: b4d8b8e2-b130-4e74-b3aa-cd8f1ab659d0
;;; css-mode.el ends here