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

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

Re: How to advice save-buffers-kill-terminal?


From: Emanuel Berg
Subject: Re: How to advice save-buffers-kill-terminal?
Date: Wed, 20 Apr 2016 00:52:40 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (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)

*Sigh*!

Did I ever hear of I guy who succeeded doing anything
with advices? Yes: several times!

:)

Here is what I would do. In the now commented-out
"kill-everything" function is where you shut
everything down gracefully, e.g., Gnus and any other
software you might run.

    (defun no-confirm-emacs-quit ()
      (interactive)
      ; (kill-everything)
      (save-buffers-kill-terminal t) ) ; silently save ... kill

    (define-key (current-global-map)
      [remap save-buffers-kill-terminal] #'no-confirm-emacs-quit)

Full example source:

    http://user.it.uu.se/~embe8573/conf/emacs-init/quit.el

Sensible blog post on this theme:

    
http://user.it.uu.se/~embe8573/blogomatic/emacs/automatization-hooks-advices-or-new-functions.html

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 25 Blogomatic articles -                   




reply via email to

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