[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: make emacs ask to save modified non-file buffers
From: |
Xah |
Subject: |
Re: make emacs ask to save modified non-file buffers |
Date: |
Sun, 22 Jun 2008 21:02:52 -0700 (PDT) |
User-agent: |
G2/1.0 |
> (info "(elisp) Killing Buffers")
I was already reading that page but it doesn't seems to suggest a
solution.
Namely, how to make kill-buffer ask user to save, for buffers that's
not associated with file.
looking at Aquamacs's source... looks like the “solved” it by actually
define its own kill-buffer wrapper, e.g. close-current-window-
asktosave.
Xah
∑ http://xahlee.org/
☄
On Jun 22, 5:48 pm, "Lennart Borgman (gmail)"
<lennart.borg...@gmail.com> wrote:
> Xah wrote:
> > when i create a new buffer, how can i make emacs ask to save if it is
> > modified?
>
> > for example, i have this function:
>
> > (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)
> > ))
>
> > after calling, it'll create a new buffer. Then, if user edit the
> > buffer, then close it (using either kill-buffer or kill-this-buffer),
> > then i want emacs to ask whether to save it if the buffer has been
> > modified.
>
> > according to the manual, the var buffer-offer-save will do it only if
> > the buffer is a visiting buffer. Then the manual talks about save-some-
> > buffers second argument but i don't see how this fits together, since
> > i don't actually want to call save-some-buffers.
>