emacs-devel
[Top][All Lists]
Advanced

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

Re: address@hidden: finding clone]


From: Stuart D. Herring
Subject: Re: address@hidden: finding clone]
Date: Mon, 1 May 2006 14:28:45 -0700 (PDT)
User-agent: SquirrelMail/1.4.3a-11.EL3

> What code does "the buffer clone package" refer to?

The builtin function `make-indirect-buffer' and the functions
`clone-indirect-buffer' and `clone-indirect-buffer-other-window' in
simple.el.

> I would suggest having a routine such as the following that will allow you
> to find
> an existing clone once it's been lost in a pile of buffers

His routine is not entirely without merit, but would be better implemented
with `buffer-base-buffer' as follows:

defun switch-to-clone (&optional buffer)
  "Select another buffer with the same base buffer as BUFFER.
BUFFER defaults to the current buffer.
Non-indirect buffers are considered to be their own bases.
If BUFFER is indirect, the buffer selected may be its base buffer or another
indirect buffer with the same base buffer.  If BUFFER is not indirect, the
buffer selected will be an indirect buffer with it as base."
  (interactive)
  (setq buffer (get-buffer (or buffer (current-buffer))))
  (let ((l (buffer-list)) (b (or (buffer-base-buffer buffer) buffer)) found)
    (while (and l (not found))
      (and (not (eq (car l) buffer))
           (eq (or (buffer-base-buffer (car l)) (car l)) b)
           (setq found (car l)))
      (setq l (cdr l)))
    (if found (switch-to-buffer found)
      (error "No indirect buffers for that buffer"))))

I'm not really sure it's useful enough to warrant inclusion; a very
similar effect can be achieved by naming indirect buffers
CLONE_originalname or originalname_CLONE or so and using completion.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

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