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

  1. Path: sparky!uunet!dtix!darwin.sura.net!mips!sdd.hp.com!usc!elroy.jpl.nasa.gov!news.claremont.edu!ucivax!megatek!hollen
  2. From: hollen@megatek.UUCP (Dion Hollenbeck)
  3. Newsgroups: gnu.emacs.help
  4. Subject: Re: delete-all-buffers?
  5. Message-ID: <HOLLEN.92Aug18120152@peg.megatek.UUCP>
  6. Date: 18 Aug 92 20:01:52 GMT
  7. References: <1992Aug18.141726.4044@bernina.ethz.ch>
  8. Sender: hollen@megatek.uucp (Dion Hollenbeck)
  9. Organization: Megatek Corporation, San Diego, California
  10. Lines: 53
  11. In-Reply-To: hetrick@amazonas.ips.id.ethz.ch's message of Tue, 18 Aug 1992 14: 17:26 GMT
  12.  
  13. >>>>> On Tue, 18 Aug 1992 14:17:26 GMT, hetrick@amazonas.ips.id.ethz.ch ( Jim Hetrick) said:
  14.  
  15. Jim> I often find myself at the end of some editting session doing
  16. Jim> C-x k, C-x k, C-x k, C-x k,... until I just have *scratch* left.
  17. Jim> Is there a command to do this or a short elisp script? I'm just
  18. Jim> beginning to begin to learn lisp so an example of such would be 
  19. Jim> nice to see. 
  20.  
  21. First, there is really no reason to need to kill all buffers.  Just
  22. C-x C-c and if you have no buffers which need saving, you are exited.
  23.  
  24. However, if you insist on killing all buffers, then I wrote the
  25. following code to clean up after doing massive tags searches.
  26.  
  27.  
  28. ;;
  29. ;; Modifications to buffer-menu-mode
  30. ;;
  31. ;;     Dion Hollenbeck 8/28/90
  32. ;;
  33.  
  34. ;;  Add key to buffer menu mode
  35. (defun buffer-menu-mode-hook-fun ()
  36.     "Add key mapping for Buffer-menu-mark-all-delete function"
  37.   (define-key Buffer-menu-mode-map "a" 'Buffer-menu-mark-all-delete)
  38.   (use-local-map Buffer-menu-mode-map)
  39. )
  40. (setq buffer-menu-mode-hook 'buffer-menu-mode-hook-fun)
  41.  
  42. ;;  Change C-x C-b to be buffer-menu
  43. (define-key ctl-x-map "\C-b" 'buffer-menu)
  44.  
  45. ;;  Define additional function for buffer menu mode
  46.  
  47. (defun Buffer-menu-mark-all-delete ()
  48.   "Mark all buffers to be deleted by \\[Buffer-menu-execute] command.
  49.     Move to the end of the buffer menu."
  50.   (interactive)
  51.   (goto-char (point-min))
  52.   (while (looking-at " [-M]") (forward-line 1))
  53.   (while (looking-at "[ .]") 
  54.     (Buffer-menu-delete)
  55.   )
  56. )
  57.  
  58.  
  59. This will mark all buffers for deletion and then you type "x" which
  60. will delete all the buffers.  Hope this is helpful.
  61.  
  62. -- 
  63. Dion Hollenbeck       UUCP: {uunet, ucsd, sun}!megatek!hollen
  64.                       INTERNET:            hollen@megatek.com
  65. Megatek Corporation  9645 Scranton Rd.  San Diego, Ca.  92121
  66.