unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8941: which-func-ff-hook should be less noisy
@ 2011-06-27 12:03 Juanma Barranquero
  2011-07-04 20:42 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2011-06-27 12:03 UTC (permalink / raw)
  To: 8941

In this change,

revno: 102581
committer: Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8941: which-func-ff-hook should be less noisy
  2011-06-27 12:03 bug#8941: which-func-ff-hook should be less noisy Juanma Barranquero
@ 2011-07-04 20:42 ` Stefan Monnier
  2011-07-04 22:08   ` Juanma Barranquero
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-07-04 20:42 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 8941

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






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8941: which-func-ff-hook should be less noisy
  2011-07-04 20:42 ` Stefan Monnier
@ 2011-07-04 22:08   ` Juanma Barranquero
  2011-07-05 18:56     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2011-07-04 22:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 8941

On Mon, Jul 4, 2011 at 22:42, Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#8941: which-func-ff-hook should be less noisy
  2011-07-04 22:08   ` Juanma Barranquero
@ 2011-07-05 18:56     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2011-07-05 18:56 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 8941-done

>> 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-05 18:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-27 12:03 bug#8941: which-func-ff-hook should be less noisy Juanma Barranquero
2011-07-04 20:42 ` Stefan Monnier
2011-07-04 22:08   ` Juanma Barranquero
2011-07-05 18:56     ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).