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

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

Re: Seeking Advice about refactoring and advice snippet


From: Filipe Silva
Subject: Re: Seeking Advice about refactoring and advice snippet
Date: Fri, 10 Feb 2017 21:12:34 -0200

Stefan I noticed that your hack works even with M-x extended-buffer-menu,
while my advices don't.

I don't understand fully what that snippet does but that's some powerful
stuff, thank you!

On Fri, Feb 10, 2017 at 5:55 PM, Stefan Monnier <address@hidden>
wrote:

> > How would you refactor that snippet to apply the dry principle?
>
> Here's how I'd refactor it:
>
>     (with-current-buffer (get-buffer "*scratch*")
>       (add-hook 'kill-buffer-hook
>                 (lambda () (error "DENIED! don't kill my precious
> *scratch*!!"))
>                 nil t))
>
> ;-)
>
>
>         Stefan
>
>
> PS: Along the same lines: kill-this-buffer calls kill-buffer, so you
> shouldn't need to advise kill-this-buffer.
>
>
>


reply via email to

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