From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: How to advice save-buffers-kill-terminal? Date: Wed, 20 Apr 2016 00:52:40 +0000 Message-ID: <87ega1rtif.fsf@student.uu.se> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1461113597 19390 80.91.229.3 (20 Apr 2016 00:53:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Apr 2016 00:53:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 20 02:53:08 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1asgOA-0000PE-C5 for geh-help-gnu-emacs@m.gmane.org; Wed, 20 Apr 2016 02:53:06 +0200 Original-Received: from localhost ([::1]:39124 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asgO9-0008Jc-Qb for geh-help-gnu-emacs@m.gmane.org; Tue, 19 Apr 2016 20:53:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asgNy-0008Fx-9C for help-gnu-emacs@gnu.org; Tue, 19 Apr 2016 20:52:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asgNv-0000dI-3d for help-gnu-emacs@gnu.org; Tue, 19 Apr 2016 20:52:54 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:45224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asgNu-0000dE-TP for help-gnu-emacs@gnu.org; Tue, 19 Apr 2016 20:52:51 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1asgNr-0000Dx-Tk for help-gnu-emacs@gnu.org; Wed, 20 Apr 2016 02:52:47 +0200 Original-Received: from c-9ce1e655.08-680-7570702.cust.bredbandsbolaget.se ([85.230.225.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Apr 2016 02:52:47 +0200 Original-Received: from embe8573 by c-9ce1e655.08-680-7570702.cust.bredbandsbolaget.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 20 Apr 2016 02:52:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 40 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-9ce1e655.08-680-7570702.cust.bredbandsbolaget.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:5Y8sJva8EBOLtlSAdyc2OQg2A1U= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:109794 Archived-At: Shiyao Ma 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 -