help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crappyness of Emacs Version 24.5.1 defadvice


From: Rémi Vanicat
Subject: Re: Crappyness of Emacs Version 24.5.1 defadvice
Date: Wed, 29 Jun 2016 15:54:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Davin Pearson <address@hidden> writes:

> On Wednesday, June 29, 2016 at 2:22:01 AM UTC+12, Drew Adams wrote:
>> > > The old behavior is preferable so I know which file the advice
>> > > is coming from.
>> > 
>> > Could someone tell me how to get the old behavior back?
>> 
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14734
>> ("REGRESSION: defadvice broken wrt doc strings (C-h f)")
>> 
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14070
>> ("incorrect doc from `C-h f' when use `defadvice' with `before'")
>> 
>> This post by Stefan provides the rationale behind the new advice
>> system.  (You might want to read the rest of the thread too.)
>> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16402#31
>> ("Document nadvice.el stuff in Elisp manual before Emacs 24.4")
>
> I tried the following code but it doesn't work.
>
> (advice-add 'describe-mode
>             :around 
>             #'(lambda () (delete-other-windows) ad-do-it)
>             )
>

  (defun my-describe-mode-before-advice (oldfun &optional buffer)
    "my documentation"
    (delete-other-windows)
    (apply oldfun buffer))

  (advice-add 'describe-mode :around #'my-describe-mode-before-advice)

Or better with a before advice:

  (defun my-describe-mode-before-advice (&optional buffer)
    "my documentation"
    (delete-other-windows))

  (advice-add 'describe-mode :before #'my-desccribe-mode-before-advice)


-- 
Rémi Vanicat




reply via email to

[Prev in Thread] Current Thread [Next in Thread]