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: doc elisp intro cross reference fixes Date: Sat, 29 Nov 2003 14:29:15 -0600 (CST) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200311292029.hATKTFE09057@raven.dms.auburn.edu> References: <87wua28zux.fsf@zip.com.au> <87ad6vdsxi.fsf@mail.jurta.org> <200311190418.hAJ4ITC02466@raven.dms.auburn.edu> <200311190528.hAJ5SrK02553@raven.dms.auburn.edu> <3FBBD155.2050703@yahoo.com> <200311192238.hAJMcTM06424@raven.dms.auburn.edu> <3FBD2533.6090503@yahoo.com> <200311262349.hAQNn2l02786@raven.dms.auburn.edu> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1070138631 2280 80.91.224.253 (29 Nov 2003 20:43:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 29 Nov 2003 20:43:51 +0000 (UTC) Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sat Nov 29 21:43:48 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 1AQBwS-0006Yr-00 for ; Sat, 29 Nov 2003 21:43:48 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AQBwS-0000NR-00 for ; Sat, 29 Nov 2003 21:43:48 +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 1AQCrc-0007VM-KK for emacs-devel@quimby.gnus.org; Sat, 29 Nov 2003 16:42:52 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AQCpd-00073C-RN for emacs-devel@gnu.org; Sat, 29 Nov 2003 16:40:49 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AQCos-0006tY-D7 for emacs-devel@gnu.org; Sat, 29 Nov 2003 16:40:33 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AQCoL-0006M6-9I; Sat, 29 Nov 2003 16:39:29 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by mx20.gnu.org with esmtp (Exim 4.24) id 1AQBoP-0000U7-9b; Sat, 29 Nov 2003 15:35:29 -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 hATKZXKk019783; Sat, 29 Nov 2003 14:35:34 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.6+Sun/8.11.6) id hATKTFE09057; Sat, 29 Nov 2003 14:29:15 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: rms@gnu.org In-reply-to: (message from Richard Stallman on Fri, 28 Nov 2003 18:14:53 -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:18212 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18212 Richard Stallman wrote: Indeed: (defalias 'set-variable 'customize-set-variable) Note that if you mean this literally, this is a non-trivial change in as far as prefix arguments are concerned. Right now, C-u set-variable will set the buffer-local value. Yes, we would want to add a similar C-u feature to customize-set-variable before doing this. Note that the optional argument is not the only difference between `customize-set-variable' and `set-variable'. Differences if both are called without optional argument on a variable VAR: 1. If VAR already has a buffer-local binding `set-variable' sets that buffer-local binding _even_ when called without prefix argument. The prefix argument just guarantees that a buffer-local binding will be made if there was none before. `custom-set-variable' sets the default value. 2. If we enter a form in the minibuffer, set-variable uses the unevaluated value, custom-set-variable the evaluated value. (See the ielm run below for examples.) If we would merge the two functions into one, we have to decide how to reconcile those two differences. The buffer-local issue is more complex. Currently there is a variable "custom-local-buffer". It _only_ tries to set a local value if the variable already has a local value, it does not make a buffer-local binding itself. It is essentially undocumented and unsupported. The necessary code to support it was never installed and was lost. There is some minimal supporting code in `custom-set-default' and `custom-set-minor-mode', but in no other part of Custom. I grepped. Not a single :set function (other than the two mentioned ones) supports it. That variable is more or less irrelevant to the issue at hand anyway. The buffer current at the time will be the buffer from which set-variable or custom-set-variable was called. The problem is that :set functions usually are not written to deal with buffer-local values. The authors of :set functions are not to blame for that, because (elisp)Customization does not mention anything about dealing with buffer-local-values: The default for SETFUNCTION is `set-default'. Hence, :set functions are supposed to generalize `set-default', nothing buffer-local in sight. Do we just ignore the :set function and use `set' when dealing with buffer-local values? Do we come up with a means to declare a :set function "safe for buffer-local use" and call it if it satisfies that criterion? Ielm run illustrating some of the above: ===File ~/set-var-ielm====================================== *** Welcome to IELM *** Type (describe-mode) for help. ELISP> (defvar aa 1 "*aha") aa ELISP> (make-variable-buffer-local 'aa) aa ELISP> (setq aa 2) 2 ELISP> ;; M-x set-variable RET aa RET (list (current-buffer) (point)) *** Read error *** End of file during parsing ELISP> aa (list (current-buffer) (point)) ELISP> (default-value 'aa) 1 ELISP> ;; M-x custom-set-variable RET aa RET (list (current-buffer) (point)) *** Read error *** End of file during parsing ELISP> aa (list (current-buffer) (point)) ELISP> (default-value 'aa) (# 420) ELISP> ============================================================