[Top][All Lists]

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

Re: *Occur in buf*?

From: Stefan Monnier
Subject: Re: *Occur in buf*?
Date: Fri, 09 Aug 2002 03:32:24 -0400

> > > > Alternatively, always name the buffer *Occur*, but provide a
> > > > occur-save-buffer command (bound to `s') which renames the buffer
> > > > to *Occur: buffer*; then the user can easily save precious occur
> > > > buffers on a needed basis.
> > > As I noted, there already is such a command -- it's called `clone-buffer'.
> > I know, but the idea was to rename the occur buffer automatically to
> > include the name of the original buffer.  E.g. *Occur: xdisp.c* .
> TRT, IMO, is to make `generate-new-buffer-name' mode-specific.

I think this is a good idea.  I'm not sure if a generic function
is necessary or if we can get away with a standard `buffer-topic'
variable (would contain the source buffer name for *Occur* buffers,
or the command name for *Help* buffers, ...) which rename-uniquely
and friends would use to generate pretty names.
I like the idea of `buffer-topic' (better name welcome) since we could
display it in ibuffer as well.

This issue of "*Help*" vs "*Help fun*" and friends is old.  There are
two issues:
- how to generate pretty names when calling rename-uniquely
(or clone-buffer since Miles seems to shy away from r-u ;-) and I think
your proposal above is a good solution to this problem (although
not as easy as it seems because the current foo<N> stuff is hardcoded
at a few places).
- whether to use a single buffer or several.  This one is more difficult
and will probably require customization.  Ideally

    (add-hook 'occur-mode-hook 'give-unique-name)

is all that's needed, but `give-unique-name' is still to be written.
Also ideally, there should be some way to set this hook "globally".

Of course this is also related to `uniquify', of course.  E.g.
in PCL-CVS I use "several buffers" by default so you don't need
to M-x r-u but then you may need to kill old *cvs* buffers
after a while.  By default the first buffer is called *cvs* but
is renamed by uniquify (just like dired buffers) as soon as
a second *cvs* buffer is created.

Maybe `buffer-topic' could be somewhat merged with
list-buffers-directory (used by dired and PCL-CVS to tell ibuffer
and uniquify which directory this is related to).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]