GNU bug report logs - #6892
Please add a way to jump to advices

Previous Next

Package: emacs;

Reported by: Ken Hori <fplemma <at> gmail.com>

Date: Sat, 21 Aug 2010 18:17:01 UTC

Severity: wishlist

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

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 6892 in the body.
You can then email your comments to 6892 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#6892; Package emacs. (Sat, 21 Aug 2010 18:17:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ken Hori <fplemma <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 21 Aug 2010 18:17:01 GMT) Full text and rfc822 format available.

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

From: Ken Hori <fplemma <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Please add a way to jump to advices
Date: Sat, 21 Aug 2010 11:17:21 -0700
There is describe-function and describe-variable, but no describe-advice.

(describe-function 'foo) describes function foo, but if it's adviced it states
"[t]his function is advised," along with its documentation -- but
without a way to
actually jump to its source.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6892; Package emacs. (Mon, 09 May 2022 16:43:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Ken Hori <fplemma <at> gmail.com>
Cc: 6892 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#6892: Please add a way to jump to advices
Date: Mon, 09 May 2022 18:41:52 +0200
Ken Hori <fplemma <at> gmail.com> writes:

> There is describe-function and describe-variable, but no describe-advice.
>
> (describe-function 'foo) describes function foo, but if it's adviced it states
> "[t]his function is advised," along with its documentation -- but
> without a way to
> actually jump to its source.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This seems to still be the case with advice-add:

(defun bar ()
  (interactive)
  (forward-line 1))

(advice-add 'bar :before (lambda () (forward-line 1)))

leads to:

---
bar is an interactive Lisp function in ‘/tmp/ad.el’.

(bar)

This function has :before advice: No documentation
---

And no links to the advice.

I'm sure this has come up before -- does advice add no pointers (to
load-history, I guess?) that the help system could pick up?

Or has that been considered and rejected before?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6892; Package emacs. (Mon, 09 May 2022 16:51:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Ken Hori <fplemma <at> gmail.com>, 6892 <at> debbugs.gnu.org
Subject: Re: bug#6892: Please add a way to jump to advices
Date: Mon, 09 May 2022 12:50:22 -0400
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> This seems to still be the case with advice-add:
>
> (defun bar ()
>   (interactive)
>   (forward-line 1))
>
> (advice-add 'bar :before (lambda () (forward-line 1)))

But it should work if you do

    (advice-add 'bar :before #'bar--skip-line)
    (defun bar--skip-line () (forward-line 1))

> I'm sure this has come up before -- does advice add no pointers (to
> load-history, I guess?) that the help system could pick up?

`define-advice` could, but `advice-add` is definitely not limited to
uses at top-level, so it shouldn't mess with `load-history`.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6892; Package emacs. (Tue, 10 May 2022 02:02:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Ken Hori <fplemma <at> gmail.com>, 6892 <at> debbugs.gnu.org
Subject: Re: bug#6892: Please add a way to jump to advices
Date: Tue, 10 May 2022 04:01:35 +0200
[Message part 1 (text/plain, inline)]
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> But it should work if you do
>
>     (advice-add 'bar :before #'bar--skip-line)
>     (defun bar--skip-line () (forward-line 1))

Ah, yes, and then we get a nice link, so that's fine.

>> I'm sure this has come up before -- does advice add no pointers (to
>> load-history, I guess?) that the help system could pick up?
>
> `define-advice` could, but `advice-add` is definitely not limited to
> uses at top-level, so it shouldn't mess with `load-history`.

And it seems like define-advice already does everything right here.  With:

(defun bar ()
  (interactive)
  (forward-line 1))

(define-advice bar (:around (oldfun &rest args) test)
  (apply oldfun args))

load-history gets:

 ("/tmp/ad.el"
  (defun . bar)
  (defun . bar <at> test))

[Message part 2 (image/png, inline)]
[Message part 3 (text/plain, inline)]
And everything is buttonified as requested in the bug report, so I guess
everything here has been fixed in the years since this was reported, and
I'm therefore closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

bug closed, send any further explanations to 6892 <at> debbugs.gnu.org and Ken Hori <fplemma <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 10 May 2022 02:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 07 Jun 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 322 days ago.

Previous Next


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