GNU bug report logs - #8941
which-func-ff-hook should be less noisy

Previous Next

Package: emacs;

Reported by: Juanma Barranquero <lekktu <at> gmail.com>

Date: Mon, 27 Jun 2011 12:05:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8941 in the body.
You can then email your comments to 8941 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8941; Package emacs. (Mon, 27 Jun 2011 12:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juanma Barranquero <lekktu <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 27 Jun 2011 12:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>
Subject: which-func-ff-hook should be less noisy
Date: Mon, 27 Jun 2011 14:03:16 +0200
In this change,

revno: 102581
committer: Stefan Monnier <monnier <at> iro.umontreal.ca>
branch nick: trunk
timestamp: Fri 2010-12-03 19:49:49 -0500
message:
  * lisp/progmodes/which-func.el (which-func-ff-hook): Log the error message.
  (which-func-update-1): Distinguish symbols from strings.
  (which-function): Stay within 80 columns.

there was added this bit

@@ -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).

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.

If, on the other hand, the intent is to warn the user so s/he adds the
mode to which-func-non-auto-modes (which, IMHO, runs counter to
allowing which-func-modes = t), then I'd suggest to use a delayed
warning

     (push (list 'which-func (error-message-string err) :error)
delayed-warnings-list)

which has the double advantage that it is more visible and can be filtered out.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8941; Package emacs. (Mon, 04 Jul 2011 20:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 8941 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 8941 <at> debbugs.gnu.org
Subject: Re: bug#8941: which-func-ff-hook should be less noisy
Date: Mon, 04 Jul 2011 16:42:20 -0400
> @@ -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))))
     (error
-     (message "which-func-ff-hook error: %S" err)
+     (unless (equal err (error "This buffer cannot use `imenu-default-create-index-function'"))
+       (message "which-func-ff-hook error: %S" err))
      (setq which-func-mode nil))))
 
 (defun which-func-update ()





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8941; Package emacs. (Mon, 04 Jul 2011 22:10:02 GMT) Full text and rfc822 format available.

Message #11 received at 8941 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 8941 <at> debbugs.gnu.org
Subject: Re: bug#8941: which-func-ff-hook should be less noisy
Date: Tue, 5 Jul 2011 00:08:48 +0200
On Mon, Jul 4, 2011 at 22:42, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> Would the patch below work?

Yes, if you add the missing quote before (error ...) in

> +     (unless (equal err (error "This buffer cannot use `imenu-default-create-index-function'"))

    Juanma




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Tue, 05 Jul 2011 19:17:03 GMT) Full text and rfc822 format available.

Notification sent to Juanma Barranquero <lekktu <at> gmail.com>:
bug acknowledged by developer. (Tue, 05 Jul 2011 19:17:04 GMT) Full text and rfc822 format available.

Message #16 received at 8941-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 8941-done <at> debbugs.gnu.org
Subject: Re: bug#8941: which-func-ff-hook should be less noisy
Date: Tue, 05 Jul 2011 14:56:50 -0400
>> Would the patch below work?
> Yes, if you add the missing quote before (error ...) in
>> +     (unless (equal err (error "This buffer cannot use `imenu-default-create-index-function'"))

Thanks, installed,


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 03 Aug 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 22 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.