home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / gnu / emacs / help / 3763 < prev    next >
Encoding:
Text File  |  1992-08-18  |  1.3 KB  |  39 lines

  1. Nntp-Posting-Host: alaska.et.byu.edu
  2. Lines: 26
  3. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!eff!news.byu.edu!news
  4. Message-ID: <!3@byu.edu>
  5. Date: Tue, 18 Aug 92 10:05:57 MDT
  6. From: gritton@alaska.et.byu.edu (Jamie Gritton)
  7. Organization: Brigham Young University, Provo UT USA
  8. Newsgroups: gnu.emacs.help
  9. Subject: Re: delete-all-buffers?
  10. Reply-To: gritton@byu.edu
  11. References: <1992Aug18.141726.4044@bernina.ethz.ch>
  12.  
  13. hetrick@amazonas.ips.id.ethz.ch ( Jim Hetrick) writes:
  14.  
  15. > I often find myself at the end of some editting session doing
  16. > C-x k, C-x k, C-x k, C-x k,... until I just have *scratch* left.
  17. > Is there a command to do this or a short elisp script?
  18.  
  19.    Here's what I use. The code comes from the save-buffers-kill-emacs
  20. function with the unneeded parts removed. Its handy that the C-x C-k
  21. was previously unbound, because it's similar the the C-x k to kill a
  22. single buffer.
  23.  
  24. (define-key ctl-x-map "\C-k" 'kill-buffers)
  25.  
  26. (defun kill-buffers ()
  27.   "Kill all buffers, asking permission on unmodified ones."
  28.   (interactive)
  29.   (let ((list (buffer-list)))
  30.     (while list
  31.       (let* ((buffer (car list))
  32.              (name (buffer-name buffer)))
  33.         (and (not (string-equal name ""))
  34.              (kill-buffer buffer)))
  35.       (setq list (cdr list))))
  36.   (cd "~"))
  37. --
  38. James Gritton - gritton@byu.edu - I disclaim
  39.