home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / emacs / help / 3547 < prev    next >
Encoding:
Text File  |  1992-07-28  |  2.1 KB  |  51 lines

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