|
From: | Stefan Monnier |
Subject: | Re: Seeking Advice about refactoring and advice snippet |
Date: | Fri, 10 Feb 2017 14:55:17 -0500 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> 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.
[Prev in Thread] | Current Thread | [Next in Thread] |