[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
make-indirect-buffer
From: |
Luc Teirlinck |
Subject: |
make-indirect-buffer |
Date: |
Sat, 13 Mar 2004 17:23:22 -0600 (CST) |
I am currently checking buffers.texi. The CLONE argument to
`make-indirect-buffer' is currently not documented in the Elisp
manual. No problem there, I will document it. However, I do not want
to document bugs and I believe the behavior illustrated in the ielm
run below is a bug. I believe that the intent of the CLONE argument
to `make-indirect-buffer' is to _initialize_ the "state" of the
indirect buffer from the base buffer, but nevertheless return a "true"
indirect buffer, with its own buffer-local-variables. That would be a
useful thing to do. What happens instead is that we wind up with shared
local variables, whose value when set in either buffer also affects
the value in the other. (On the other hand, newly created local
variables are _not_ shared in this way.) I believe this is a bug and
that no local variables should be "shared" in that fashion.
Ielm run illustrating this:
===File ~/indi-ielm=========================================
*** Welcome to IELM *** Type (describe-mode) for help.
ELISP> (set-buffer "*scratch*")
#<buffer *scratch*>
ELISP> (make-local-variable 'aa)
aa
ELISP> (setq aa 1)
1
ELISP> (make-indirect-buffer "*scratch*" "clone" t)
#<buffer clone>
ELISP> (set-buffer "clone")
#<buffer clone>
ELISP> (make-local-variable 'bb)
bb
ELISP> (setq aa 2)
2
ELISP> (setq bb 2)
2
ELISP> (set-buffer "*scratch*")
#<buffer *scratch*>
ELISP> aa
2 ;; This is what I believe is a bug. I expected `1'.
ELISP> bb
*** Eval error *** Symbol's value as variable is void: bb
ELISP> (default-value 'aa)
*** Eval error *** Symbol's value as variable is void: aa
ELISP> ============================================================
Doc string of `make-indirect-buffer':
make-indirect-buffer is an interactive built-in function.
(make-indirect-buffer BASE-BUFFER NAME &optional CLONE)
Create and return an indirect buffer for buffer BASE-BUFFER, named NAME.
BASE-BUFFER should be an existing buffer (or buffer name).
NAME should be a string which is not the name of an existing buffer.
Optional argument CLONE non-nil means preserve BASE-BUFFER's state,
such as major and minor modes, in the indirect buffer.
CLONE nil means the indirect buffer's state is reset to default values.
- make-indirect-buffer,
Luc Teirlinck <=