[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 <monnier@iro.umontreal.ca>
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.
>
>
>
- Seeking Advice about refactoring and advice snippet, Filipe Silva, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet, Narendra Joshi, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet, Yuri Khan, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet, Filipe Silva, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet, Stefan Monnier, 2017/02/10
- Re: Seeking Advice about refactoring and advice snippet,
Filipe Silva <=
- Re: Seeking Advice about refactoring and advice snippet, Chunyang Xu, 2017/02/10