Path: utzoo!utgpu!watmath!att!dptg!rutgers!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-sdd!megatek!eta!hollen
From: hollen@eta.megatek.uucp (Dion Hollenbeck)
Newsgroups: comp.emacs
Subject: Re: Buffer-menu kill all files (SOLUTION)
Message-ID: <679@megatek.UUCP>
Date: 9 Aug 89 15:07:44 GMT
References: <661@mipos3.intel.com>
Sender: news@megatek.UUCP
Lines: 40

Thanks to all who responded to my question.  With help from them and
some more poking around myself, the solution is as follows for anyone
who could benefit by it.  The reason I needed this code is that I have
been using tags-search and after a search I sometimes end up with
up to 60 or so files being edited by Emacs.  This is a quick way to
kill all of them.  When the function finishes, the point is at the
bottom of the buffer list window and I can merely move up the the first
file I want to keep, use "u" on all my regular files to be kept and
then "x" to delete all the ones used in tags-search.


ALL THE FOLLOWING WERE ADDED IN MY .EMACS FILE:

;;  Add key to buffer menu mode
(defun buffer-menu-mode-hook-fun ()
    "Add key mapping for Buffer-menu-mark-all-delete function"
  (define-key Buffer-menu-mode-map "a" 'Buffer-menu-mark-all-delete)
  (use-local-map Buffer-menu-mode-map)
)

;;  Add function name to mode hook
(setq buffer-menu-mode-hook 'buffer-menu-mode-hook-fun)

;;  Define additional function for buffer menu mode
(defun Buffer-menu-mark-all-delete ()
  "Mark all buffers to be deleted by \\[Buffer-menu-execute] command.
    Finish at the end of the buffer menu."
  (interactive)
  (goto-char (point-min))
  (while (looking-at " [-M]") (forward-line 1))
  (while (looking-at "[ .]") 
    (Buffer-menu-delete)
  )
)


	Dion Hollenbeck             (619) 455-5590 x2814
	Megatek Corporation, 9645 Scranton Road, San Diego, CA  92121

        uunet!megatek!hollen       or  hollen@megatek.uucp