From e9672b147f2e1f4879752f882fb58c7dc7ce3e9b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 3 Aug 2023 23:43:12 -0400 Subject: [PATCH] * lisp/progmodes/cc-mode.el (c-advise-fl-for-region): Fix compiler warning Make sure we macro-expand `defadvice` only when we want to use it. --- lisp/progmodes/cc-mode.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index dd699b9a119..a96863cd15e 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -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 () -- 2.39.2