[comp.emacs] Buffer-menu kill all files?

hollen@zeta.megatek.uucp (Dion Hollenbeck) (08/04/89)

After having done a tags-search on 50 or 60 files as specified by
my tags file and switching to the Buffer Menu, is there a way
to mark ALL files for deletion with one command?  I would then
go the bottom of the menu  and unmark the 6 or seven files which
I would want to remain.

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

        uunet!megatek!hollen       or  hollen@megatek.uucp

nate@hobbes.intel.com (Nate Hess) (08/05/89)

In article <668@megatek.UUCP>, hollen@zeta (Dion Hollenbeck) writes:
>is there a way to mark ALL files for deletion with one command?

With the cursor on the first buffer in the list, type  99d


--woodstock
-- 
	   "What I like is when you're looking and thinking and looking
	   and thinking...and suddenly you wake up."   - Hobbes

woodstock@hobbes.intel.com   ...!{decwrl|hplabs!oliveb}!intelca!mipos3!nate 

hollen@zeta.megatek.uucp (Dion Hollenbeck) (08/08/89)

From article <624@mipos3.intel.com>, by nate@hobbes.intel.com (Nate Hess):
> In article <668@megatek.UUCP>, hollen@zeta (Dion Hollenbeck) writes:
>>is there a way to mark ALL files for deletion with one command?
> 
> With the cursor on the first buffer in the list, type  99d
> 
> --woodstock

Thanks for the valiant try, but no cigar.  Buffer-menu-mode and the
attendant sparse keymap do not allow numbers and every press of '9'
elicits a beep from the keyboard.  I have added some code to
buff-menu.el, but I cannot get the key to map which would execute it.
Maybe someone could help.  Here is the code:

ADDED THE FOLLOWING LINE TO THE KEYMAP DEFINITION:

  (define-key Buffer-menu-mode-map "a" 'Buffer-menu-mark-all-delete)

ADDED THE FOLLOWING FUNCTION DEFINITION:

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


ADDED THE FOLLOWING TO MY .EMACS FILE SO THAT MY BUFFER MENU DEFINITIONS
WOULD BE USED INSTEAD OF THE USUAL ONES.  IS MY BUFF-MENU KEYMAP BEING
DEFINED FIRST AND THE STANDARD ONE RE-DEFINING IT?

(load "/usr2/hollen/Emacs/buff-menu.el")


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

        uunet!megatek!hollen       or  hollen@megatek.uucp

nate@hobbes.intel.com (Nate Hess) (08/08/89)

In article <669@megatek.UUCP>, hollen@zeta (Dion Hollenbeck) writes:
>ADDED THE FOLLOWING LINE TO THE KEYMAP DEFINITION:

>  (define-key Buffer-menu-mode-map "a" 'Buffer-menu-mark-all-delete)

>ADDED THE FOLLOWING FUNCTION DEFINITION:

[... Function deleted ...]

>ADDED THE FOLLOWING TO MY .EMACS FILE SO THAT MY BUFFER MENU DEFINITIONS
>WOULD BE USED INSTEAD OF THE USUAL ONES.  IS MY BUFF-MENU KEYMAP BEING
>DEFINED FIRST AND THE STANDARD ONE RE-DEFINING IT?

That is a good guess.  You might want to put the (define-key ...) in
buffer-menu-mode-hook, to ensure that the keymap you're changing has
been created and initialized before you modify it.

--woodstock
-- 
	   "What I like is when you're looking and thinking and looking
	   and thinking...and suddenly you wake up."   - Hobbes

woodstock@hobbes.intel.com   ...!{decwrl|hplabs!oliveb}!intelca!mipos3!nate