help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make emacs ask to save modified non-file buffers


From: Xah
Subject: make emacs ask to save modified non-file buffers
Date: Sun, 22 Jun 2008 17:23:26 -0700 (PDT)
User-agent: G2/1.0

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/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]