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: Re: default-fill-column Date: Sat, 22 Nov 2003 15:23:34 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200311222123.hAMLNYW22498@raven.dms.auburn.edu> References: <200311151637.hAFGbtK17946@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1069536876 1848 80.91.224.253 (22 Nov 2003 21:34:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 22 Nov 2003 21:34:36 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Nov 22 22:34:33 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1ANfOj-0006RP-00 for ; Sat, 22 Nov 2003 22:34:33 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1ANfOj-0006My-00 for ; Sat, 22 Nov 2003 22:34:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ANgKG-0001zQ-RU for emacs-devel@quimby.gnus.org; Sat, 22 Nov 2003 17:34:00 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ANgIi-0001WX-KB for emacs-devel@gnu.org; Sat, 22 Nov 2003 17:32:24 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ANgIB-0001LQ-Ib for emacs-devel@gnu.org; Sat, 22 Nov 2003 17:32:22 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ANgHT-0001Dz-SM for emacs-devel@gnu.org; Sat, 22 Nov 2003 17:31:07 -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 hAMLTZKk029564; Sat, 22 Nov 2003 15:29:35 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id hAMLNYW22498; Sat, 22 Nov 2003 15:23:34 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: monnier@IRO.UMontreal.CA In-reply-to: (message from Stefan Monnier on 16 Nov 2003 17:58:05 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 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:18035 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18035 First, a reminder of the behavior: ===File ~/nov22ielm========================================= *** Welcome to IELM *** Type (describe-mode) for help. ELISP> (emacs-version) "GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, X toolkit)\n of 2003-11-22 on swt40.swt.com" ELISP> (local-variable-p 'fill-column) nil ELISP> fill-column 70 ELISP> (setq default-fill-column 75) 75 ELISP> fill-column 70 ELISP> (local-variable-p 'fill-column) nil ELISP> (default-value 'fill-column) 75 ELISP> (buffer-local-value 'fill-column (current-buffer)) 75 ELISP> fill-column 70 ELISP> (setq-default fill-column (default-value 'fill-column)) 75 ELISP> fill-column 75 ELISP> ============================================================ `default-fill-column' is just an example. The same holds for other variables of the same type. Reminder of Stefan's response: Looks like a plain bug indeed. Could we just declare those `default-*' variables obsolete and tell people to use `setq-default' and `default-value' instead so we can slowly hope to get rid of those things ? If Luc's bugs were already present in Emacs-20 and Emacs-21, then we wouldn't even have to fix them. That would, according to me, be a satisfactory solution. There could be one problem, however. Indeed, the functionality of these variables is not equivalent with `setq-default'. `setq-default' changes the value in all buffers without buffer-local binding, whereas (setq default-fill-column 75) only affects the value in newly created buffers. This is achieved in a very precarious way, however, because both the preserved value itself and its type (buffer-local versus default) are ambiguous and unstable. If one wants to make new defaults for these variables apply only to newly created buffers, either automatically or as an option, then I see at least three possibilities: 1. Make all these variables behave like enable-multibyte-characters and default-enable-multibyte-characters. For those, there is no problem, because enable-multibyte-characters is always buffer-local, even if the user never set it, and kill-local-variable has no effect on it. Thus the default value always only affects newly created buffers and the problem in the above *ielm* run never occurs for them. 2. Make setq-default and set-default, for these variables, scan through the buffer-list and make all current global values buffer-local before resetting the default. 3. Leave setq-default and set-default alone, but define a new function set-default-new-buffers (or whatever) that would behave as described in (2), not just for the variables we are talking about, but for all variables. It seems to me that this function could be written in Lisp and that this would not be too difficult. Could be useful for other variables too. (2) and (3) still would require making the default-* variables obsolete (but without loosing their functionality), whereas (1) would get rid of the problem without a need to slowly get rid of them. Sincerely, Luc.