Subject: bug#12338: 24.2.50; Error during redisplay (apropos which-function-mode?)

From: Eli Zaretskii <[email-masked]>
Date: Mon, 03 Sep 2012 00:32:12 +0300

> From: Jambunathan K <[email-masked]>
> Date: Mon, 03 Sep 2012 02:28:37 +0530
> 
> 
> My message buffer is getting populated with these messages
> 
> ,----
> |     Error during redisplay: (eval (replace-regexp-in-string "%" "%%"
> |     (gethash (selected-window) which-func-table which-func-unknown)))
> |     signaled (wrong-type-argument arrayp nil)
> `----
> 
> I have following configs that concerns `which-function-mode'
> 
> ,----
> | 2 matches for "which" in buffer: .emacs
> |      84: '(which-function-mode t))
> |     111: '(which-func ((t (:inherit font-lock-function-name-face))))
> `----
> 
> Can someone remove these messages or fix underlying problem?

The messages cannot be removed: this is the only way to signal an
error that happens during redisplay, without wedging Emacs.  That's
because displaying an error message in the normal way re-enters
redisplay, which will again signal an error, ad nauseam.

As you can see in which-func.el, the expression being evaluated is
which-func-current, which is part of which-func-format.  Hopefully,
this is enough to find the culprit.  (I don't see the error messages
if I just enable which-func-mode in 'emacs -Q".)