unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* make emacs ask to save modified non-file buffers
@ 2008-06-23  0:23 Xah
  2008-06-23  0:48 ` Lennart Borgman (gmail)
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Xah @ 2008-06-23  0:23 UTC (permalink / raw)
  To: help-gnu-emacs

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.

Thanks.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-06-23  8:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-23  0:23 make emacs ask to save modified non-file buffers Xah
2008-06-23  0:48 ` Lennart Borgman (gmail)
     [not found] ` <mailman.13718.1214182118.18990.help-gnu-emacs@gnu.org>
2008-06-23  4:02   ` Xah
2008-06-23  6:26     ` Lennart Borgman (gmail)
2008-06-23  8:48 ` Juanma Barranquero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).