GNU bug report logs - #14070
24.3.50; incorrect doc from `C-h f' when use `defadvice' with `before'

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: "Drew Adams" <drew.adams@HIDDEN>; Keywords: notabug wontfix; merged with #13581, #14734; dated Wed, 27 Mar 2013 17:27:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Forcibly Merged 13581 14070 14734. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 14070 <at> debbugs.gnu.org:


Received: (at 14070) by debbugs.gnu.org; 27 Mar 2013 19:42:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 27 15:42:26 2013
Received: from localhost ([127.0.0.1]:48194 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UKwEr-00026x-E5
	for submit <at> debbugs.gnu.org; Wed, 27 Mar 2013 15:42:25 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:38345)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <drew.adams@HIDDEN>) id 1UKwEo-00026p-T6
	for 14070 <at> debbugs.gnu.org; Wed, 27 Mar 2013 15:42:24 -0400
Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93])
	by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with
	ESMTP id r2RJdtHL010714
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Wed, 27 Mar 2013 19:39:55 GMT
Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157])
	by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	r2RJdreQ024654
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 27 Mar 2013 19:39:54 GMT
Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70])
	by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id
	r2RJdrCM017258; Wed, 27 Mar 2013 14:39:53 -0500
Received: from dradamslap1 (/10.159.226.59)
	by default (Oracle Beehive Gateway v4.0)
	with ESMTP ; Wed, 27 Mar 2013 12:39:53 -0700
From: "Drew Adams" <drew.adams@HIDDEN>
To: "'Stefan Monnier'" <monnier@HIDDEN>
References: <79A351DEEF3B4F8196433EFE91EF6E14@HIDDEN>
	<jwvvc8cfylj.fsf-monnier+emacs@HIDDEN>
Subject: RE: bug#14070: 24.3.50;
	incorrect doc from `C-h f' when use `defadvice' with `before'
Date: Wed, 27 Mar 2013 12:39:48 -0700
Message-ID: <3EEBBD3DA8FD43D39F0161782FABC48A@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <jwvvc8cfylj.fsf-monnier+emacs@HIDDEN>
Thread-Index: Ac4rIA3AM/E4PV0xRmuWzs/Og2sD3wAADOsg
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157
X-Source-IP: ucsinet21.oracle.com [156.151.31.93]
X-Spam-Score: -2.8 (--)
X-Debbugs-Envelope-To: 14070
Cc: 14070 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.5 (-----)

> > :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'.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14070; Package emacs. Full text available.
Added tag(s) notabug. Request was from Stefan Monnier <monnier@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 14070 <at> debbugs.gnu.org:


Received: (at 14070) by debbugs.gnu.org; 27 Mar 2013 19:22:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 27 15:22:14 2013
Received: from localhost ([127.0.0.1]:48133 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UKvvK-0000ck-20
	for submit <at> debbugs.gnu.org; Wed, 27 Mar 2013 15:22:14 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:35574)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <monnier@HIDDEN>)
	id 1UKvvG-0000cS-Pw; Wed, 27 Mar 2013 15:22:12 -0400
Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca
	[132.204.27.242])
	by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r2RJJhVH029292; 
	Wed, 27 Mar 2013 15:19:43 -0400
Received: by faina.iro.umontreal.ca (Postfix, from userid 20848)
	id 0D5F0B4178; Wed, 27 Mar 2013 15:19:43 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: "Drew Adams" <drew.adams@HIDDEN>
Subject: Re: bug#14070: 24.3.50;
	incorrect doc from `C-h f' when use `defadvice' with `before'
Message-ID: <jwvvc8cfylj.fsf-monnier+emacs@HIDDEN>
References: <79A351DEEF3B4F8196433EFE91EF6E14@HIDDEN>
Date: Wed, 27 Mar 2013 15:19:42 -0400
In-Reply-To: <79A351DEEF3B4F8196433EFE91EF6E14@HIDDEN> (Drew Adams's
	message of "Wed, 27 Mar 2013 10:24:10 -0700")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV4531=0
X-NAI-Spam-Version: 2.3.0.9362 : core <4531> : streams <929216> : uri <1377754>
X-Spam-Score: -2.9 (--)
X-Debbugs-Envelope-To: 14070
Cc: 14070 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.8 (----)

tags 14070 notabug
thanks

>  :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'.

> 2. How can you tell where that advice is defined?

You can't because defadvice does not record this information.
If you replace your advice with something like:

   (advice-add 'query-replace :before
               #'respect-search/replace-region-as-default-flag)
   (defun respect-search/replace-region-as-default-flag (&rest ignore)
     (interactive
      (let ((common
             (query-replace-read-args
              (concat "Query replace"
                      (and current-prefix-arg  " word")
                      (and transient-mark-mode  mark-active
                           (not search/replace-region-as-default-flag)
                           " in region"))
              nil)))
        (list (nth 0 common) (nth 1 common) (nth 2 common)
              (and transient-mark-mode  mark-active  (region-beginning))
              (and transient-mark-mode  mark-active  (region-end)))))
     nil)

then C-h f should tell you it's a before advice and should let you click
your way to its source code.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#14070; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Mar 2013 17:26:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 27 13:26:56 2013
Received: from localhost ([127.0.0.1]:47967 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1UKu7f-0004hh-OB
	for submit <at> debbugs.gnu.org; Wed, 27 Mar 2013 13:26:54 -0400
Received: from eggs.gnu.org ([208.118.235.92]:47832)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <drew.adams@HIDDEN>) id 1UKu7c-0004hR-6J
	for submit <at> debbugs.gnu.org; Wed, 27 Mar 2013 13:26:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <drew.adams@HIDDEN>) id 1UKu5F-0007XR-8R
	for submit <at> debbugs.gnu.org; Wed, 27 Mar 2013 13:24:22 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-105.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED,
	RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_WHITELIST autolearn=disabled
	version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:60421)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <drew.adams@HIDDEN>) id 1UKu5F-0007XN-4v
	for submit <at> debbugs.gnu.org; Wed, 27 Mar 2013 13:24:21 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59182)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <drew.adams@HIDDEN>) id 1UKu5D-0001Rx-3V
	for bug-gnu-emacs@HIDDEN; Wed, 27 Mar 2013 13:24:21 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <drew.adams@HIDDEN>) id 1UKu5B-0007Vc-LJ
	for bug-gnu-emacs@HIDDEN; Wed, 27 Mar 2013 13:24:19 -0400
Received: from userp1040.oracle.com ([156.151.31.81]:29359)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <drew.adams@HIDDEN>) id 1UKu5B-0007VR-E0
	for bug-gnu-emacs@HIDDEN; Wed, 27 Mar 2013 13:24:17 -0400
Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238])
	by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with
	ESMTP id r2RHOFW2016074
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
	for <bug-gnu-emacs@HIDDEN>; Wed, 27 Mar 2013 17:24:16 GMT
Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157])
	by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id
	r2RHOFcX003585
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <bug-gnu-emacs@HIDDEN>; Wed, 27 Mar 2013 17:24:15 GMT
Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70])
	by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id
	r2RHOEiX013860
	for <bug-gnu-emacs@HIDDEN>; Wed, 27 Mar 2013 12:24:14 -0500
Received: from dradamslap1 (/10.159.226.59)
	by default (Oracle Beehive Gateway v4.0)
	with ESMTP ; Wed, 27 Mar 2013 10:24:14 -0700
From: "Drew Adams" <drew.adams@HIDDEN>
To: <bug-gnu-emacs@HIDDEN>
Subject: 24.3.50; incorrect doc from `C-h f' when use `defadvice' with `before'
Date: Wed, 27 Mar 2013 10:24:10 -0700
Message-ID: <79A351DEEF3B4F8196433EFE91EF6E14@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 11
Thread-Index: Ac4rD+RV6p56N9zBTmG6U+MTZo0iiA==
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157
X-Source-IP: acsinet22.oracle.com [141.146.126.238]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -6.2 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.2 (------)

emacs -Q
 
Evaluate this sexp:
 
(defadvice query-replace
 (before respect-search/replace-region-as-default-flag activate)
  nil
  (interactive
   (let ((common
          (query-replace-read-args
           (concat "Query replace"
                   (and current-prefix-arg  " word")
                   (and transient-mark-mode  mark-active
                        (not search/replace-region-as-default-flag)
                        " in region"))
           nil)))
     (list (nth 0 common) (nth 1 common) (nth 2 common)
           (and transient-mark-mode  mark-active  (region-beginning))
           (and transient-mark-mode  mark-active  (region-end))))))
 
Then C-h f query-replace.  You see this as part of the description:
 
 :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'.)
 
2. How can you tell where that advice is defined?  It doesn't matter
whether you put that defadvice in a file foo.el and load that.  Neither
C-h f query-replace nor clicking `ad-Advice-query-replace' in that
description tells you anything about where the actual advice
`respect-search/replace-region-as-default-flag' is defined.


In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
 of 2013-03-23 on VBOX
Bzr revision: 112115 eliz@HIDDEN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -IC:/emacs/libs/libXpm-3.5.10/include -IC:/emacs/libs/libXpm-3.5.10/src
 -IC:/emacs/libs/libpng-dev_1.4.3-1_win32/include
 -IC:/emacs/libs/zlib-dev_1.2.5-2_win32/include
 -IC:/emacs/libs/giflib-4.1.4-1-lib/include
 -IC:/emacs/libs/jpeg-6b-4-lib/include
 -IC:/emacs/libs/tiff-3.8.2-1-lib/include
 -IC:/emacs/libs/libxml2-2.7.8-w32-bin/include/libxml2
 -IC:/emacs/libs/gnutls-3.1.10-w32/include
 -IC:/emacs/libs/libiconv-1.14-2-mingw32-dev/include'
 





Acknowledgement sent to "Drew Adams" <drew.adams@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#14070; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 28 Apr 2016 22:45:02 UTC

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