all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xah <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: make emacs ask to save modified non-file buffers
Date: Sun, 22 Jun 2008 21:02:52 -0700 (PDT)	[thread overview]
Message-ID: <33a818e4-d6db-4e30-a952-f496c1d6657d@s33g2000pri.googlegroups.com> (raw)
In-Reply-To: mailman.13718.1214182118.18990.help-gnu-emacs@gnu.org

> (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.
>


  parent reply	other threads:[~2008-06-23  4:02 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)
     [not found] ` <mailman.13718.1214182118.18990.help-gnu-emacs@gnu.org>
2008-06-23  4:02   ` Xah [this message]
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=33a818e4-d6db-4e30-a952-f496c1d6657d@s33g2000pri.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.