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

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Wed, 27 Mar 2013 17:27:01 UTC

Severity: minor

Tags: notabug, wontfix

Merged with 13581, 14734

Found in version 24.3.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 14070 <at> debbugs.gnu.org
Subject: bug#14070: 24.3.50; incorrect doc from `C-h f' when use `defadvice' with `before'
Date: Wed, 27 Mar 2013 15:19:42 -0400
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




This bug report was last modified 5 years and 240 days ago.

Previous Next


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