aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2008-04-06 20:33:05 +0000
committerAlan Mackenzie2008-04-06 20:33:05 +0000
commitafd2c2fc7447755c7cad3a8f78df36bc3f5bca45 (patch)
tree28a8c98fbde898ae872b8aba324a5a3ce2f54758
parent088a2895a9ad972c74d21c558c34405d50ad379a (diff)
downloademacs-afd2c2fc7447755c7cad3a8f78df36bc3f5bca45.tar.gz
emacs-afd2c2fc7447755c7cad3a8f78df36bc3f5bca45.zip
(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.
-rw-r--r--lisp/progmodes/cc-mode.el28
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index b122b392dd5..36a69acf407 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -597,7 +597,9 @@ that requires a literal mode spec at compile time."
597 (make-local-hook 'before-change-functions) 597 (make-local-hook 'before-change-functions)
598 (add-hook 'before-change-functions 'c-before-change nil t) 598 (add-hook 'before-change-functions 'c-before-change nil t)
599 (make-local-hook 'after-change-functions) 599 (make-local-hook 'after-change-functions)
600 (add-hook 'after-change-functions 'c-after-change nil t)) 600 (add-hook 'after-change-functions 'c-after-change nil t)
601 (setq font-lock-extend-after-change-region-function
602 'c-extend-after-change-region)) ; Currently (2008-04), only used by AWK.
601 603
602(defun c-setup-doc-comment-style () 604(defun c-setup-doc-comment-style ()
603 "Initialize the variables that depend on the value of `c-doc-comment-style'." 605 "Initialize the variables that depend on the value of `c-doc-comment-style'."
@@ -1003,19 +1005,17 @@ This does not load the font-lock package. Use after
1003 (make-local-hook 'font-lock-mode-hook) 1005 (make-local-hook 'font-lock-mode-hook)
1004 (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t)) 1006 (add-hook 'font-lock-mode-hook 'c-after-font-lock-init nil t))
1005 1007
1006(defmacro c-advise-fl-for-region (function) 1008(defun c-extend-after-change-region (beg end old-len)
1007 `(defadvice ,function (before get-awk-region activate) 1009 "Extend the region to be fontified, if necessary."
1008;; When font-locking an AWK Mode buffer, make sure that any string/regexp is 1010 ;; Note: the parameters are ignored here. This somewhat indirect
1009;; completely font-locked. 1011 ;; implementation exists because it is minimally different from the
1010 (when (eq major-mode 'awk-mode) 1012 ;; stand-alone CC Mode which, lacking
1011 (save-excursion 1013 ;; font-lock-extend-after-change-region-function, is forced to use advice
1012 (ad-set-arg 1 c-new-END) ; end 1014 ;; instead.
1013 (ad-set-arg 0 c-new-BEG))))) ; beg 1015 ;;
1014 1016 ;; Of the seven CC Mode languages, currently (2008-04) only AWK Mode makes
1015(c-advise-fl-for-region font-lock-after-change-function) 1017 ;; non-null use of this function.
1016(c-advise-fl-for-region jit-lock-after-change) 1018 (cons c-new-BEG c-new-END))
1017(c-advise-fl-for-region lazy-lock-defer-rest-after-change)
1018(c-advise-fl-for-region lazy-lock-defer-line-after-change)
1019 1019
1020 1020
1021;; Support for C 1021;; Support for C