[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Closing all files in a tag table

    Date: Mon, 26 Aug 91 17:45+0100
    From: Vincent Keunen <keunen@milou.nrb.be>
    When I do a tags search on a large system, all the files are open in the
    editor.  Is there a way to close them all, or close all files in a tag
    table, or close the files where the tags search didn't find anything?

Unlike some text editors, buffers in Zmacs are copies of the files they
represent.  As such, they are not "open" and do not need to be "closed".

It isn't necessary to get rid of buffers just because you're not using
them.  Indeed, it may be space and time-wise inefficient to do so.  But
if you are bothered by the visual clutter and believe you are really
done with the buffers, you can kill them in a variety of ways. (By the way,
you should make sure all the buffers you want to save have been saved before
doing any of this.  You can use m-X Save File Buffers to help you with that.)

 m-X Kill Buffer (also available as c-X K) will kill and individual buffer.

 Clicking Right on a buffer name in a buffer listing (gotten by c-X c-B)
 will offer a menu of actions, one of which is to kill the buffer.

Both of those commands work on a per-file basis, not in bulk.  There is
no way of operating on a whole system worth of buffers at once, but
there are commands that deal with files in bulk.  The two commands which
are probably of most use to you in this circumstance are:

 c-m-X Edit Buffers (also available as c-X c-sh-B) will offer you a
 buffer containing a list of buffers which you can edit with commands
 similar to Dired.  Press Help when in such a buffer for information
 on what the commands are.

 m-X Kill Or Save Buffers (also available as c-X c-m-B) will offer you a
 pop-up menu in which you can use check boxes to specify which buffers to
 save, kill, etc.

Note that if Edit Buffers gets a numeric argument, it will prompt for a
substring to match against when showing you the list of buffers.  So let's
say you have 100 editor buffers and 50 of them are the ones you want to kill.
Let's further assume that all of those live in a directory named >ACME>tools>.
The buffer name of all those buffers will have ">ACME>tools" in its name,
so if you press

 control-U control-X control-shift-B

you will get a prompt for a substring in which you can type


followed by Return.  This will get you a buffer containing names
only of the buffers that matched that substring.  You can then use normal
cursor motion commands to move around in the buffer, and press "D" on the
lines that correspond to buffers you want to remove. (Press "U" if you make
a mistake.)

Oh, by the way, if you're only looking at the file for the purpose of
search, you might want to consider the CP command name "Find String",
which doesn't read anything into editor buffers in the first place.

  :Find String message-id, "message id" :Systems Zwei, Zmail

Good luck...