From: Alan Mackenzie Date: Wed, 5 Nov 2014 17:57:50 +0000 (+0000) Subject: Fix wrong bound to c-font-lock-declarators. Fixes bug #18948. X-Git-Tag: emacs-24.4.90~265 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ceb7a7dfb8a2c2b17ac876e693d462ec65dcd97a;p=emacs.git Fix wrong bound to c-font-lock-declarators. Fixes bug #18948. progmodes/cc-fonts.el (c-font-lock-declarations): Pass "(point-max)" as bound to c-font-lock-declarators, not "limit", as the buffer is sometimes narrowed to less than "limit" (e.g., in the presence of macros). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4a3b1dcd96a..111f98b8d4e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-11-05 Alan Mackenzie + + Fix wrong bound to c-font-lock-declarators. Fixes bug #18948. + * progmodes/cc-fonts.el (c-font-lock-declarations): Pass + "(point-max)" as bound to c-font-lock-declarators, not "limit", as + the buffer is sometimes narrowed to less than "limit" (e.g., in + the presence of macros). + 2014-11-05 Michael Albinus * net/tramp.el (tramp-error-with-buffer): Show connection buffer diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index bf5630da045..6ebd6c6a8fc 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1279,6 +1279,8 @@ casts and declarations are fontified. Used on level 2 and higher." c-font-lock-maybe-decl-faces (lambda (match-pos inside-macro) + ;; Note to maintainers: don't use `limit' inside this lambda form; + ;; c-find-decl-spots sometimes narrows to less than `limit'. (setq start-pos (point)) (when ;; The result of the form below is true when we don't recognize a @@ -1507,7 +1509,7 @@ casts and declarations are fontified. Used on level 2 and higher." ;; At a real declaration? (if (memq (c-forward-type t) '(t known found)) (progn - (c-font-lock-declarators limit t is-typedef) + (c-font-lock-declarators (point-max) t is-typedef) nil) ;; False alarm. Return t to go on to the next check. (goto-char start-pos)