Subject: bug#14070: 24.3.50; incorrect doc from `C-h f' when use `defadvice' with `before'

From: "Drew Adams" <[email-masked]>
Date: Wed, 27 Mar 2013 12:39:48 -0700

> > :around advice: `ad-Advice-query-replace'
> > 1. It should be :before, not :around, no?
> > (When you click on that link it confirms that it is 
> > `Before-advice'.)
> 
> ad-Advice-query-replace is an "advice container" which in 
> turns contains all the advice added via `defadvice'.

Maybe so, but the point is that the description in `C-h f' is unclear.  The
occurrence of `:around', in particular (and why show a keyword here?) can
mislead.

If you cannot say anything here about what kinds of advice are currently
included in this container, then at least remove the :around - there is no
around advice in the recipe I gave.

The bug is about improving the doc displayed to users.  Please consider
reopening it and untagging it `notabug', until such improvement has actually
been made.

> > 2. How can you tell where that advice is defined?
> 
> You can't because defadvice does not record this information.

3. (Let me know if you prefer a separate enhancement request for this.)

So how about fixing that?

> If you replace your advice with something like:
> 
>    (advice-add 'query-replace :before
>                #'respect-search/replace-region-as-default-flag)

No such function, up through Emacs 24.3: `advice-add'.

Yes, it exists in the version I filed the bug for.  But I am not interested only
in that version.  And I am also interested in defadvice - which is still
supported AFAIK.

>    (defun respect-search/replace-region-as-default-flag (&rest ignore)
>      (interactive...)
>      nil)
> then C-h f should tell you it's a before advice and should 
> let you click your way to its source code.

Sounds good.

4. (Let me know if you prefer a separate bug report for this.)

`advice-add' should have face `font-lock-keyword-face', like `defun' etc.
And the advised function should have face `font-lock-function-name-face'.