all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Xah <xahlee@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: make emacs ask to save modified non-file buffers
Date: Mon, 23 Jun 2008 02:48:29 +0200	[thread overview]
Message-ID: <485EF2DD.9050508@gmail.com> (raw)
In-Reply-To: <635b5b5f-398f-44a0-8bf2-873a050696bb@v1g2000pra.googlegroups.com>

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.


(info "(elisp) Killing Buffers")




  reply	other threads:[~2008-06-23  0:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-23  0:23 make emacs ask to save modified non-file buffers Xah
2008-06-23  0:48 ` Lennart Borgman (gmail) [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=485EF2DD.9050508@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=xahlee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.