[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8941: which-func-ff-hook should be less noisy

From: Stefan Monnier
Subject: bug#8941: which-func-ff-hook should be less noisy
Date: Mon, 04 Jul 2011 16:42:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> @@ -207,6 +207,7 @@
>           (setq imenu--index-alist
>                 (save-excursion (funcall imenu-create-index-function))))
>      (error
> +     (message "which-func-ff-hook error: %S" err)
>       (setq which-func-mode nil))))

> which "logs" the error message. Unfortunately, when you have
> `which-func-modes' set to t, you receive that message a lot for what
> it is not an error (which-func-mode is simply unsupported in that
> buffer / mode).

Hmm... that's a problem.

> I don't want to remove it, because I suppose Stefan put it for a
> reason. Now, if the reason is simply to log the error in *Messages*,
> either doing it directly, or conditionalizing it somehow according to
> (eq which-func-modes t) would be better.

The intention is to make sure errors in Imenu don't get ignored
silently, otherwise diagnosing problems can be difficult.  But of
course, we need to distinguish between "we got an error because Imenu is
not supported in this buffer" and real errors.
Sadly, imenu does not make it easy to figure out whether it is
enabled/configured in a given buffer.  You'd have to check
- imenu-create-index-function
- imenu-prev-index-position-function and imenu-extract-index-name-function
- imenu--generic-function
- imenu-generic-expression
Would the patch below work?

=== modified file 'lisp/progmodes/which-func.el'
--- lisp/progmodes/which-func.el        2011-05-12 07:07:06 +0000
+++ lisp/progmodes/which-func.el        2011-07-04 20:42:04 +0000
@@ -206,7 +206,8 @@
          (setq imenu--index-alist
                (save-excursion (funcall imenu-create-index-function))))
-     (message "which-func-ff-hook error: %S" err)
+     (unless (equal err (error "This buffer cannot use 
+       (message "which-func-ff-hook error: %S" err))
      (setq which-func-mode nil))))
 (defun which-func-update ()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]