]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/cc-mode.el (c-advise-fl-for-region): Fix compiler warning
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 4 Aug 2023 03:43:12 +0000 (23:43 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 4 Aug 2023 03:43:12 +0000 (23:43 -0400)
Make sure we macro-expand `defadvice` only when we want to use it.

lisp/progmodes/cc-mode.el

index dd699b9a11975adb557fccc48d6cfd0cefe2aca1..a96863cd15e0b3def849b7914b682403d326a390 100644 (file)
@@ -2723,18 +2723,18 @@ This function is called from `c-common-init', once per mode initialization."
 ;; Emacs < 22 and XEmacs
 (defmacro c-advise-fl-for-region (function)
   (declare (debug t))
-  `(defadvice ,function (before get-awk-region activate)
-     ;; Make sure that any string/regexp is completely font-locked.
-     (when c-buffer-is-cc-mode
-       (save-excursion
-        (ad-set-arg 1 c-new-END)   ; end
-        (ad-set-arg 0 c-new-BEG)))))   ; beg
-
-(unless (boundp 'font-lock-extend-after-change-region-function)
-  (c-advise-fl-for-region font-lock-after-change-function)
-  (c-advise-fl-for-region jit-lock-after-change)
-  (c-advise-fl-for-region lazy-lock-defer-rest-after-change)
-  (c-advise-fl-for-region lazy-lock-defer-line-after-change))
+  (unless (boundp 'font-lock-extend-after-change-region-function)
+    `(defadvice ,function (before get-awk-region activate)
+       ;; Make sure that any string/regexp is completely font-locked.
+       (when c-buffer-is-cc-mode
+        (save-excursion
+          (ad-set-arg 1 c-new-END)   ; end
+          (ad-set-arg 0 c-new-BEG))))))        ; beg
+
+(c-advise-fl-for-region font-lock-after-change-function)
+(c-advise-fl-for-region jit-lock-after-change)
+(c-advise-fl-for-region lazy-lock-defer-rest-after-change)
+(c-advise-fl-for-region lazy-lock-defer-line-after-change)
 
 ;; Connect up to `electric-indent-mode' (Emacs 24.4 and later).
 (defun c-electric-indent-mode-hook ()