From 2865541594f18898c234a2ed076879ce2f887693 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 1 Aug 2019 20:14:32 -0400 Subject: [PATCH] Fix c-after-change in narrowed buffer * lisp/progmodes/cc-mode.el (c-after-change): Include the c-clear-string-fences call in the save-restriction, so that it has access to the widened buffer. --- lisp/progmodes/cc-mode.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index a5e158933b..9df4224448 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -1989,10 +1989,10 @@ c-after-change ;; When `combine-after-change-calls' is used we might get calls ;; with regions outside the current narrowing. This has been ;; observed in Emacs 20.7. - (unwind-protect - (progn - (c-restore-string-fences (point-min) (point-max)) - (save-restriction + (save-restriction + (unwind-protect + (progn + (c-restore-string-fences (point-min) (point-max)) (save-match-data ; c-recognize-<>-arglists changes match-data (widen) @@ -2032,8 +2032,8 @@ c-after-change (save-excursion (mapc (lambda (fn) (funcall fn beg end old-len)) - c-before-font-lock-functions))))) - (c-clear-string-fences)))) + c-before-font-lock-functions)))) + (c-clear-string-fences))))) ;; A workaround for syntax-ppss's failure to notice syntax-table text ;; property changes. (when (fboundp 'syntax-ppss) -- 2.11.0