From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: make-indirect-buffer Date: Sat, 13 Mar 2004 17:23:22 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200403132323.i2DNNMa01190@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1079223591 17743 80.91.224.253 (14 Mar 2004 00:19:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 14 Mar 2004 00:19:51 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Mar 14 01:19:45 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B2JM1-0002y7-00 for ; Sun, 14 Mar 2004 01:19:45 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B2JM1-0003hD-00 for ; Sun, 14 Mar 2004 01:19:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B2JL8-0005p8-VW for emacs-devel@quimby.gnus.org; Sat, 13 Mar 2004 19:18:50 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B2Ihm-0004Jt-Up for emacs-devel@gnu.org; Sat, 13 Mar 2004 18:38:10 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B2Igv-00049U-Ce for emacs-devel@gnu.org; Sat, 13 Mar 2004 18:37:48 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B2IUv-0000ui-4O for emacs-devel@gnu.org; Sat, 13 Mar 2004 18:24:53 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id i2DNOmKt020174 for ; Sat, 13 Mar 2004 17:24:48 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id i2DNNMa01190; Sat, 13 Mar 2004 17:23:22 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:20414 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20414 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*") # ELISP> (make-local-variable 'aa) aa ELISP> (setq aa 1) 1 ELISP> (make-indirect-buffer "*scratch*" "clone" t) # ELISP> (set-buffer "clone") # ELISP> (make-local-variable 'bb) bb ELISP> (setq aa 2) 2 ELISP> (setq bb 2) 2 ELISP> (set-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.