[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
buffer-offer-save variable bug?
From: |
Xah Lee |
Subject: |
buffer-offer-save variable bug? |
Date: |
Wed, 24 Sep 2008 07:06:02 -0700 (PDT) |
User-agent: |
G2/1.0 |
there seems to be a bug on how the var buffer-offer-save behaves.
Accordig to its inline doc: “Non-nil in a buffer means always offer to
save buffer on exit. Do so even if the buffer is not visiting a
file.” but it does not seem to behave that way. Possibly this is not
bug but due to my ignorance of other elisp detail...
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 “File‣Close”.
You'll see that emacs closes the buffer immediately without offering
save.
Xah
∑ http://xahlee.org/
☄
On Sep 24, 5:51 am, rustom <rustompm...@gmail.com> wrote:
> On Sep 24, 4:42 pm, Xah Lee <x...@xahlee.org> 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...
- buffer-offer-save variable bug?,
Xah Lee <=