diff options
| author | Alan Mackenzie | 2008-04-06 21:13:11 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2008-04-06 21:13:11 +0000 |
| commit | 8714fc186962821f0cbc28d2643a601882dbeeaa (patch) | |
| tree | 28f0d032a24c3c67358c234f8e59c4a530f8831b | |
| parent | f172d0f8f64c51c1de47f23b637cc486833bbd1b (diff) | |
| download | emacs-8714fc186962821f0cbc28d2643a601882dbeeaa.tar.gz emacs-8714fc186962821f0cbc28d2643a601882dbeeaa.zip | |
(c-basic-common-init): Set font-lock-extend-after-change-region-function.
(c-extend-after-change-region): New function, used in
font-lock-extend-after-change-region-function, thus superseding advice on
the Font Lock after change functions.
(c-advise-fl-for-region): Remove this macro.
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 938b7caeb30..1ed3eca7e2f 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -600,7 +600,9 @@ that requires a literal mode spec at compile time." | |||
| 600 | (make-local-hook 'before-change-functions) | 600 | (make-local-hook 'before-change-functions) |
| 601 | (add-hook 'before-change-functions 'c-before-change nil t) | 601 | (add-hook 'before-change-functions 'c-before-change nil t) |
| 602 | (make-local-hook 'after-change-functions) | 602 | (make-local-hook 'after-change-functions) |
| 603 | (add-hook 'after-change-functions 'c-after-change nil t)) | 603 | (add-hook 'after-change-functions 'c-after-change nil t) |
| 604 | (setq font-lock-extend-after-change-region-function | ||
| 605 | 'c-extend-after-change-region)) ; Currently (2008-04), only used by AWK. | ||
| 604 | 606 | ||
| 605 | (defun c-setup-doc-comment-style () | 607 | (defun c-setup-doc-comment-style () |
| 606 | "Initialize the variables that depend on the value of `c-doc-comment-style'." | 608 | "Initialize the variables that depend on the value of `c-doc-comment-style'." |
| @@ -1006,19 +1008,17 @@ This does not load the font-lock package. Use after | |||
| 1006 | (make-local-hook 'font-lock-mode-hook) | 1008 | (make-local-hook 'font-lock-mode-hook) |
| 1007 | (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t)) | 1009 | (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t)) |
| 1008 | 1010 | ||
| 1009 | (defmacro c-advise-fl-for-region (function) | 1011 | (defun c-extend-after-change-region (beg end old-len) |
| 1010 | `(defadvice ,function (before get-awk-region activate) | 1012 | "Extend the region to be fontified, if necessary." |
| 1011 | ;; When font-locking an AWK Mode buffer, make sure that any string/regexp is | 1013 | ;; Note: the parameters are ignored here. This somewhat indirect |
| 1012 | ;; completely font-locked. | 1014 | ;; implementation exists because it is minimally different from the |
| 1013 | (when (eq major-mode 'awk-mode) | 1015 | ;; stand-alone CC Mode which, lacking |
| 1014 | (save-excursion | 1016 | ;; font-lock-extend-after-change-region-function, is forced to use advice |
| 1015 | (ad-set-arg 1 c-new-END) ; end | 1017 | ;; instead. |
| 1016 | (ad-set-arg 0 c-new-BEG))))) ; beg | 1018 | ;; |
| 1017 | 1019 | ;; Of the seven CC Mode languages, currently (2008-04) only AWK Mode makes | |
| 1018 | (c-advise-fl-for-region font-lock-after-change-function) | 1020 | ;; non-null use of this function. |
| 1019 | (c-advise-fl-for-region jit-lock-after-change) | 1021 | (cons c-new-BEG c-new-END)) |
| 1020 | (c-advise-fl-for-region lazy-lock-defer-rest-after-change) | ||
| 1021 | (c-advise-fl-for-region lazy-lock-defer-line-after-change) | ||
| 1022 | 1022 | ||
| 1023 | 1023 | ||
| 1024 | ;; Support for C | 1024 | ;; Support for C |