[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to advice save-buffers-kill-terminal?
From: |
Michael Heerdegen |
Subject: |
Re: How to advice save-buffers-kill-terminal? |
Date: |
Thu, 14 Apr 2016 15:52:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Shiyao Ma <i@introo.me> writes:
> For the following code:
>
> (advice-add 'save-buffers-kill-terminal :around #'(lambda (oldfunc &rest r)
> (cl-flet ((yes-or-no-p
> (msg)
>
> (message "test:%S" msg)))
> (apply oldfunc r))))
>
>
> The yes-or-no-p in cl-flet doesn't affect the calling of yes-or-no-p inside
> save-buffers-kill-terminal.
>
> After a quick look, I found the suspicious *- lexical-binding:t -*- in
> files.el.
>
>
> Any possibility to modify that yes-or-no-p inside
> save-buffers-kill-terminal?
[Skipping the usual warnings that this is generally a bad idea]
Use `cl-letf' to bind a `symbol-function' place.
BTW, you are not just searching for `confirm-kill-emacs'?
Michael.