(other :tag "always" t)
(integer :tag "size"))
:group 'font-lock)
-
-(defcustom font-lock-lines-before 0
- "*Number of lines before the changed text to include in refontification."
- :type 'integer
- :group 'font-lock
- :version "22.1")
\f
;; Originally these variable values were face names such as `bold' etc.
(when font-lock-syntax-table
(set-syntax-table font-lock-syntax-table))
(goto-char beg)
- (setq beg (line-beginning-position (- 1 font-lock-lines-before)))
+ (setq beg (line-beginning-position))
;; check to see if we should expand the beg/end area for
;; proper multiline matches
(when (and (> beg (point-min))
;; Called when any modification is made to buffer text.
(defun font-lock-after-change-function (beg end old-len)
(let ((inhibit-point-motion-hooks t)
- (inhibit-quit t))
+ (inhibit-quit t)
+ (region (font-lock-extend-region beg end old-len)))
(save-excursion
(save-match-data
- ;; Rescan between start of lines enclosing the region.
- (font-lock-fontify-region
- (progn (goto-char beg) (forward-line 0) (point))
- (progn (goto-char end) (forward-line 1) (point)))))))
+ (if region
+ ;; Fontify the region the major mode has specified.
+ (setq beg (car region) end (cdr region))
+ ;; Fontify the whole lines which enclose the region.
+ (setq beg (progn (goto-char beg) (line-beginning-position))
+ end (progn (goto-char end) (line-beginning-position 2))))
+ (font-lock-fontify-region beg end)))))
(defun font-lock-fontify-block (&optional arg)
"Fontify some lines the way `font-lock-fontify-buffer' would.
;;
;; (regexp-opt
;; '("define" "elif" "else" "endif" "error" "file" "if" "ifdef"
-;; "ifndef" "include" "line" "pragma" "undef"))
+;; "ifndef" "import" "include" "line" "pragma" "undef" "warning"))
;;
(defconst cpp-font-lock-keywords-source-directives
- "define\\|e\\(?:l\\(?:if\\|se\\)\\|ndif\\|rror\\)\\|file\\|i\\(?:f\\(?:n?def\\)?\\|nclude\\)\\|line\\|pragma\\|undef"
+ "define\\|e\\(?:l\\(?:if\\|se\\)\\|ndif\\|rror\\)\\|file\\|i\\(?:f\\(?:n?def\\)?\\|mport\\|nclude\\)\\|line\\|pragma\\|undef\\|warning"
"Regular expressoin used in `cpp-font-lock-keywords'.")
;; `cpp-font-lock-keywords-source-depth' is calculated from:
;;
;; (regexp-opt-depth (regexp-opt
;; '("define" "elif" "else" "endif" "error" "file" "if" "ifdef"
-;; "ifndef" "include" "line" "pragma" "undef")))
+;; "ifndef" "import" "include" "line" "pragma" "undef" "warning")))
;;
(defconst cpp-font-lock-keywords-source-depth 0
"An integer representing regular expression depth of `cpp-font-lock-keywords-source-directives'.
(list
;;
;; Fontify error directives.
- '("^#[ \t]*error[ \t]+\\(.+\\)" 1 font-lock-warning-face prepend)
+ '("^#[ \t]*\\(?:error\\|warning\\)[ \t]+\\(.+\\)" 1 font-lock-warning-face prepend)
;;
;; Fontify filenames in #include <...> preprocessor directives as strings.
'("^#[ \t]*\\(?:import\\|include\\)[ \t]*\\(<[^>\"\n]*>?\\)"
;; Erroneous structures.
("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\>" 1 font-lock-warning-face)
;; Words inside \\[] tend to be for `substitute-command-keys'.
- ("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend)
+ ("\\\\\\\\\\[\\(\\sw+\\)\\]" 1 font-lock-constant-face prepend)
;; Words inside `' tend to be symbol names.
("`\\(\\sw\\sw+\\)'" 1 font-lock-constant-face prepend)
;; Constant values.
("\\<:\\sw+\\>" 0 font-lock-builtin-face)
;; ELisp and CLisp `&' keywords as types.
- ("\\&\\sw+\\>" . font-lock-type-face)
+ ("\\<\\&\\sw+\\>" . font-lock-type-face)
;; ELisp regexp grouping constructs
((lambda (bound)
(catch 'found