[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in clone-indirect-buffer and clone-indirect-buffer-other-window
From: |
Juri Linkov |
Subject: |
Re: Bug in clone-indirect-buffer and clone-indirect-buffer-other-window |
Date: |
Sun, 22 Jan 2006 02:45:01 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
> The second discrepancy is: although the info page indicates that the
> only difference between clone-indirect-buffer and
> clone-indirect-buffer-other-window is that the latter selects the
> buffer in another window, I do not believe that this is the case.
> The clone-indirect-buffer function accepts an argument and prompts
> for a name while the clone-indirect-buffer-other-window function
> ignores any numeric argument. I would like to see the
> clone-indirect-buffer-other-window function accept an argument
> as well.
>
> I will do that. Thanks.
Actually, your latest fix doesn't work: clone-indirect-buffer and
clone-indirect-buffer-other-window use different arguments, so to make
the behavior of clone-indirect-buffer-other-window similar to
clone-indirect-buffer, a new argument `newname' should be added.
The following patch also changes the prompt strings of `clone-buffer',
`clone-indirect-buffer' and `clone-indirect-buffer-other-window'.
(Note that the command `make-indirect-buffer' is already ok: it correctly
uses the interactive specification string "BName of indirect buffer: "
where the first character "B" is necessary. But all other commands
construct a list of arguments instead of using the interactive specification
string).
Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.784
diff -c -r1.784 simple.el
*** lisp/simple.el 20 Jan 2006 01:22:07 -0000 1.784
--- lisp/simple.el 22 Jan 2006 00:38:57 -0000
***************
*** 5196,5202 ****
(error "Cannot clone a file-visiting buffer"))
(if (get major-mode 'no-clone)
(error "Cannot clone a buffer in %s mode" mode-name))
! (list (if current-prefix-arg (read-string "Name: "))
t)))
(if buffer-file-name
(error "Cannot clone a file-visiting buffer"))
--- 5221,5228 ----
(error "Cannot clone a file-visiting buffer"))
(if (get major-mode 'no-clone)
(error "Cannot clone a buffer in %s mode" mode-name))
! (list (if current-prefix-arg
! (read-buffer "Name of new cloned buffer: " (current-buffer)))
t)))
(if buffer-file-name
(error "Cannot clone a file-visiting buffer"))
***************
*** 5266,5272 ****
(if (get major-mode 'no-clone-indirect)
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
(list (if current-prefix-arg
! (read-string "BName of indirect buffer: "))
t)))
(if (get major-mode 'no-clone-indirect)
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
--- 5292,5298 ----
(if (get major-mode 'no-clone-indirect)
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
(list (if current-prefix-arg
! (read-buffer "Name of indirect buffer: " (current-buffer)))
t)))
(if (get major-mode 'no-clone-indirect)
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
***************
*** 5280,5300 ****
buffer))
! (defun clone-indirect-buffer-other-window (buffer &optional norecord)
! "Create an indirect buffer that is a twin copy of BUFFER.
! Select the new buffer in another window.
Optional second arg NORECORD non-nil means do not put this buffer at
! the front of the list of recently selected ones."
(interactive
(progn
(if (get major-mode 'no-clone-indirect)
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
! (list (if current-prefix-arg
! (read-string "BName of indirect buffer: "))
! t)))
(let ((pop-up-windows t))
! (set-buffer buffer)
! (clone-indirect-buffer nil t norecord)))
;;; Handling of Backspace and Delete keys.
--- 5306,5334 ----
buffer))
! (defun clone-indirect-buffer-other-window (base-buffer &optional norecord
newname)
! "Create an indirect buffer that is a twin copy of BASE-BUFFER.
! Select the new buffer in another window. The argument BASE-BUFFER defaults
! to the current buffer.
!
Optional second arg NORECORD non-nil means do not put this buffer at
! the front of the list of recently selected ones.
!
! Optional third arg NEWNAME specifies the name of the new indirect buffer.
! Interactively, read NEWNAME from the minibuffer when invoked with
! a prefix arg. If NEWNAME is nil or if not called with a prefix arg,
! NEWNAME defaults to the current buffer's name. The name is modified by
! adding a `<N>' suffix to it or by incrementing the N in an existing suffix."
(interactive
(progn
(if (get major-mode 'no-clone-indirect)
(error "Cannot indirectly clone a buffer in %s mode" mode-name))
! (list nil nil
! (if current-prefix-arg
! (read-buffer "Name of indirect buffer: " (current-buffer))))))
(let ((pop-up-windows t))
! (if base-buffer (set-buffer base-buffer))
! (clone-indirect-buffer newname t norecord)))
;;; Handling of Backspace and Delete keys.
--
Juri Linkov
http://www.jurta.org/emacs/