unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6892: Please add a way to jump to advices
@ 2010-08-21 18:17 Ken Hori
  2022-05-09 16:41 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Ken Hori @ 2010-08-21 18:17 UTC (permalink / raw)
  To: 6892

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.





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

* bug#6892: Please add a way to jump to advices
  2010-08-21 18:17 bug#6892: Please add a way to jump to advices Ken Hori
@ 2022-05-09 16:41 ` Lars Ingebrigtsen
  2022-05-09 16:50   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-09 16:41 UTC (permalink / raw)
  To: Ken Hori; +Cc: 6892, Stefan Monnier

Ken Hori <fplemma@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





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

* bug#6892: Please add a way to jump to advices
  2022-05-09 16:41 ` Lars Ingebrigtsen
@ 2022-05-09 16:50   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-05-10  2:01     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-05-09 16:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Ken Hori, 6892

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






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

* bug#6892: Please add a way to jump to advices
  2022-05-09 16:50   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-05-10  2:01     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-10  2:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Ken Hori, 6892

[-- Attachment #1: Type: text/plain, Size: 788 bytes --]

Stefan Monnier <monnier@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@test))


[-- Attachment #2: Type: image/png, Size: 29058 bytes --]

[-- Attachment #3: Type: text/plain, Size: 290 bytes --]


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

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

end of thread, other threads:[~2022-05-10  2:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-21 18:17 bug#6892: Please add a way to jump to advices Ken Hori
2022-05-09 16:41 ` Lars Ingebrigtsen
2022-05-09 16:50   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-05-10  2:01     ` Lars Ingebrigtsen

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