From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Bug? buffer-offer-save Date: Wed, 24 Sep 2008 06:33:56 -0700 (PDT) Organization: http://groups.google.com Message-ID: <93ec08ad-072a-41ca-9400-96e9ed82032a@v13g2000pro.googlegroups.com> References: <873ajzwoqu.fsf@kobe.laptop> <823901dd-c54c-4e3b-b6ad-512d52724a46@z11g2000prl.googlegroups.com> <87ljxoffs6.fsf@atthis.clsnet.nl> <71208e97-140c-445d-8eda-1705f11b14b3@r15g2000prd.googlegroups.com> <095ef0c0-c7f4-494d-8bf6-8a5ee43fd934@i20g2000prf.googlegroups.com> <98bb399f-e2e7-4d6f-8d5f-4e56475b6ad1@v13g2000pro.googlegroups.com> <44ea9a7d-7f0b-4f24-9f18-1f06cbfe3ba2@g17g2000prg.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1222263908 30586 80.91.229.12 (24 Sep 2008 13:45:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Sep 2008 13:45:08 +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 Sep 24 15:46:04 2008 connect(): Connection refused 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 1KiUgh-0008Dt-Ns for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Sep 2008 15:45:52 +0200 Original-Received: from localhost ([127.0.0.1]:51072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KiUff-0003uM-Mk for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Sep 2008 09:44:47 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!v13g2000pro.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 42 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1222263236 31949 127.0.0.1 (24 Sep 2008 13:33:56 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 24 Sep 2008 13:33:56 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v13g2000pro.googlegroups.com; posting-host=24.6.185.159; posting-account=qPxGtQkAAADb6PWdLGiWVucht1ZDR6fn User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:162662 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:58004 Archived-At: To test this which seems like a bug to me, do this: eval this code: (defun new-empty-buffer () "Opens a new empty buffer." (interactive) (let ((buf (generate-new-buffer "untitled"))) (switch-to-buffer buf) (funcall (and initial-major-mode)) (setq buffer-offer-save t))) then call it. You'll have a new buffer. Now type something in it. Now, go to the menu =E2=80=9CFile=E2=80=A3Close=E2=80=9D. You'll see that emacs closes the buffer immediately without offering save. Xah =E2=88=91 http://xahlee.org/ =E2=98=84 On Sep 24, 5:51 am, rustom wrote: > On Sep 24, 4:42 pm, Xah Lee wrote: > > > I actually have the line > > (setq buffer-offer-save t) > > in my code for new-empty-buffer, but emacs still closes the buffer > > without saving, seemingly contrary to its doc. > > Do you have it on a hook? Like so? > > (add-hook 'lisp-interaction-mode-hook (function (lambda () (setq > buffer-offer-save t)))) > > The above works for me -- asking to save the scratch buffer *if > changed* > Only problem is that fundamental-mode does not AFAIK have a hook. > Wonder why...