[Top][All Lists]

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

Re: *Occur in buf*?

From: Sam Steingold
Subject: Re: *Occur in buf*?
Date: 30 Jul 2002 10:20:25 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> * In message <address@hidden>
> * On the subject of "Re: *Occur in buf*?"
> * Sent on 29 Jul 2002 10:31:27 +0200
> * Honorable address@hidden (Kim F. Storm) writes:
> Miles Bader <address@hidden> writes:
> > On Sun, Jul 28, 2002 at 02:15:01AM +0200, Kim F. Storm wrote:
> > > 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.
E.g., have a buffer-local variable 'uniquify-buffer-name' or a similar
property of the major-mode name, which would hold a mode-specific
function which is to be run in the buffer being renamed.

E.g., for occur-mode:

(defun occur-mode-uniquify ()
  (concat "*Occur: " (mapconcat #'buffer-name
                                (car (cddr occur-revert-arguments)) "/")

for help-mode:

(defun help-mode-uniquify ()
  (concat "*Help: "
          (case (car help-xref-stack-item)
            ((describe-function describe-variable)
             (symbol-name (cadr help-xref-stack-item)))
             (concat "keybindings in buffer "
                     (buffer-name (window-buffer
                                   (car help-return-method)))))
            (t "???"))


Then `rename-buffer', `clone-buffer' &c will DTRT automatically.

Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
When you are arguing with an idiot, your opponent is doing the same.

reply via email to

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