From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rupert Swarbrick Newsgroups: gmane.emacs.help Subject: Re: saving buffers options Date: Fri, 22 Aug 2008 18:09:33 +0100 Organization: albasani.net Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Trace: ger.gmane.org 1219427194 4210 80.91.229.12 (22 Aug 2008 17:46:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Aug 2008 17:46:34 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 22 19:47:28 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KWajN-0006b8-H7 for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Aug 2008 19:47:25 +0200 Original-Received: from localhost ([127.0.0.1]:50663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWaiQ-0002I9-0u for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Aug 2008 13:46:26 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!newsfeed.straub-nv.de!news.albasani.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 68 Original-X-Trace: news.albasani.net wRXoCkKJdJRlGOd33YhE+t7XUP3PPF7Zwx6AIXe94eYvKCQYCJFh3NOoBdfIeb+PlxHr80Z3JoH3NBuk6pV1I+hrFyfVoL77HXNjV2pp9d9r50aPwKm8VSGshmohBbKX Original-X-Complaints-To: abuse@albasani.net Original-NNTP-Posting-Date: Fri, 22 Aug 2008 17:09:38 +0000 (UTC) X-User-ID: qOALMtO6x5KnNRqGdTBYtmZuv1l8eiAr9vUrKQg5eqg= Cancel-Lock: sha1:OezYGw0FuQS3pEeaVi5wdJMK6VM= User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) X-NNTP-Posting-Host: wZ9AXzOTff0pvy1jChcW5M8ztipNq3/TpvgZV0LEIzc= Original-Xref: news.stanford.edu gnu.emacs.help:161549 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:56894 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Transfer-Encoding: quoted-printable "Rustom Mody" writes: > Some buffers can be closed without any questions but for some -- > typically file buffers -- if a changed buffer is (tried to be) closed, > a question is asked: Do you want save this...?? > > I want to get this question for python-mode, shell-mode etc. Is there > some option for this? > > Thanks. Looking at C-h f kill-buffer, I see that kill-buffer-query-functions is called on kill, but my emacs only has=20 (gnuserv-kill-buffer-query-function) in there, so it can't be that which checks whether you want to save dirty files... However, I just hacked this up: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline; filename=a (defvar savable-shell-modes '(python-mode shell-mode eshell-mode)) (defun rjs/really-kill-shell-p () (if (member major-mode savable-shell-modes) (or (not (buffer-modified-p)) (y-or-n-p "Really exit without saving this file? ")) t)) (push #'rjs/really-kill-shell-p kill-buffer-query-functions) --=-=-= which seems to work here. Clearly you'll want to edit savable-shell-modes and possibly change more than that... But there's a quick start I think. Rupert --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iJwEAQECAAYFAkiu8s4ACgkQRtd/pJbYVoZXDQQAtyxhQtL9HQK7U00m8iWxxGM6 UBxnK+jyAQSgObRYQExGB8m+1+whuAdwf6fL2i5eGFoA2JTiIsdbe84xhupfpT9J YTUBqKMD4Ec6GzlrE/6CsCDM5516GMD1yxVw/TeRJwH4E0UhGtVLzUCqY6yBVZp1 vLt5pcOQMY7X6TuKkQ0= =i+Fy -----END PGP SIGNATURE----- --==-=-=--