home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!unido!pki-nbg!hoz1!brianw
- From: brianw@iti.org (Brian Wallis)
- Newsgroups: gnu.emacs.help
- Subject: Re: Save *scratch* on exit (Was Re: #XXX# file remains ...)
- Message-ID: <brianw.712392166@hoz1>
- Date: 29 Jul 92 06:42:46 GMT
- References: nickel@cs.tu-berlin.DE (Juergen Nickelsen) <NICKEL.92Jul26152853@desaster.cs.tu-berlin.de> <DODD.92Jul27083627@mycenae.cchem>
- Sender: news@pki-nbg.philips.de
- Distribution: gnu
- Lines: 39
-
- dodd@mycenae.cchem (Lawrence R. Dodd) writes:
-
- >>>>>> On Sun, 26 Jul 1992 14:28:53 GMT, nickel@cs.tu-berlin.DE (Juergen Nickelsen) said:
-
- >> On a related issue, I think someone a while back asked how one can
- >> get emacs to ask the user about saving *scratch* buffers when
- >> exiting emacs. Right now standard emacs just wipes them is there a
- >> way to get it to attach some importance to *scratch* buffers? Just
- >> a simple "save buffer to disk?" would be nice.
-
- > Juergen> Put the following into your ~/.emacs:
-
- > Juergen> (save-excursion
- > Juergen> (set-buffer "*scratch*")
- > Juergen> (setq buffer-file-name "~/*scratch*"))
-
- >This seems to work great for *scratch* but is there a way to set it up for all
- >buffers not attached to files?
-
- This elisp fragment will list the buffers that have files and the ones
- that don't. Should be able to make a simple function to save the
- un-filed ones from this. I suspect you don't really want to do that
- though. There are a number that you would probably want to filter out
- like " *Minibuf-0*" (note the space) and " *Completions"
-
- (let ((blist (buffer-list)))
- (while (setq buf (car blist))
- (setq blist (cdr blist))
- (let ((bname (buffer-name buf))(name (buffer-file-name buf)))
- (if (not name)
- (message "buffer %s has no file" bname)
- (message "buffer %s has a file %s" bname name)))
- (sleep-for 1)))
-
- --
- --------------------------------------------------------------------
- Brian Wallis <brianw@philips.oz.au> Phone: +49 911 526 6220
- Philips Public Telecommunications Systems Fax: +49 911 526 2094
- Melbourne, Australia (Currently resident in Nurnberg, Germany)
-