From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: young Newsgroups: gmane.emacs.help Subject: Re: Is it possible not to quit emacs when buffer is modified? Date: Thu, 20 Aug 2009 11:44:54 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7977a3af-ff41-443d-a1f8-f8e4e5c53f82@y10g2000prf.googlegroups.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1250797256 24380 80.91.229.12 (20 Aug 2009 19:40:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Aug 2009 19:40:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 20 21:40:47 2009 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 1MeDV8-0006sO-T3 for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Aug 2009 21:40:47 +0200 Original-Received: from localhost ([127.0.0.1]:51809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeDV8-00075x-7u for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Aug 2009 15:40:46 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!y10g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: 216.31.211.11 Original-X-Trace: posting.google.com 1250793894 11424 127.0.0.1 (20 Aug 2009 18:44:54 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 20 Aug 2009 18:44:54 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y10g2000prf.googlegroups.com; posting-host=216.31.211.11; posting-account=1n6WnAoAAACbXH3nD5I7RQWqdkbTxZki User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.1) Gecko/20090715 Firefox/3.5.1,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:172162 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:67312 Archived-At: On Aug 19, 9:49=A0pm, "A.Politz" wrote: > On Aug 20, 2:22=A0am, YOUNG wrote: > > > Hi, > > > If a buffer does not connect to a file but it is modified, if you type > > c-x c, emacs just quits and losts the data. > > > Is there a way to protect of it? > > > Regards, > > Youngwhan > > One way to avoid this is the `buffer-offer-save' variable, e.g like > this. > > (add-hook 'first-change-hook > =A0 =A0 =A0 =A0 =A0 #'(lambda nil > =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; set for all 'regular' buffers > =A0 =A0 =A0 =A0 =A0 =A0 =A0 (unless (string-match "\\`[ *].*[*]\\'" > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (= buffer-name)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq buffer-offer-save t)))) > > -ap Thank you! It works! Regards, Youngwhan