From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alex Schroeder Newsgroups: gmane.emacs.devel Subject: Re: [CVS] f7, f8 bound.. Date: Thu, 05 Sep 2002 00:25:51 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: <87lm6htms0.fsf@emacswiki.org> References: <87ofbji88u.fsf@emacswiki.org> <200209021705.g82H50d07442@rum.cs.yale.edu> <200209022324.g82NOoO08761@rum.cs.yale.edu> <20020903130247.GA6318@gnu.org> <20020903173120.GA29981@gnu.org> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1031178222 19848 127.0.0.1 (4 Sep 2002 22:23:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 4 Sep 2002 22:23:42 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17miYn-0005A0-00 for ; Thu, 05 Sep 2002 00:23:41 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17mj8B-0003qB-00 for ; Thu, 05 Sep 2002 01:00:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17miaN-0000LU-00; Wed, 04 Sep 2002 18:25:19 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17miYp-0000JT-00 for emacs-devel@gnu.org; Wed, 04 Sep 2002 18:23:43 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17miYm-0000J4-00 for emacs-devel@gnu.org; Wed, 04 Sep 2002 18:23:42 -0400 Original-Received: from relay02.cablecom.net ([62.2.33.102]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17miYl-0000J0-00 for emacs-devel@gnu.org; Wed, 04 Sep 2002 18:23:40 -0400 Original-Received: from smtp.swissonline.ch (mail-4.swissonline.ch [62.2.32.85]) by relay02.cablecom.net (8.12.5/8.12.5/SOL/AWF/MXRELAY/20020820) with ESMTP id g84MNcWs062680 for ; Thu, 5 Sep 2002 00:23:38 +0200 (CEST) (envelope-from alex@emacswiki.org) Original-Received: from confusibombus (dclient217-162-239-98.hispeed.ch [217.162.239.98]) by smtp.swissonline.ch (8.11.6/8.11.6/SMTPSOL/AWF/2002040101) with ESMTP id g84MNcH16628 for ; Thu, 5 Sep 2002 00:23:38 +0200 (MEST) Original-Received: from alex by confusibombus with local (Exim 3.35 #1 (Debian)) id 17miat-0000Ae-00 for ; Thu, 05 Sep 2002 00:25:51 +0200 Original-To: emacs-devel@gnu.org X-Face: ^BC$`[IcggstLPyen&dqF+b2'zyK#r.mU*'Nms}@&4zw%SJ#5!/7SMVjBS7'lb;QK)|IPU5U'o1'522W4TyzB3Ab*IBo^iw]l4|kUbdZuUDO6=Um-.4IzhNiV'B"@K#jy_(wW|Zbk[34flKY^|PrQ?$u2\fKg^]AY>wOX#H32i In-Reply-To: ("Robert J. Chassell"'s message of "Wed, 4 Sep 2002 15:30:30 +0000 (UTC)") Original-Lines: 115 User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2.90 (i686-pc-linux-gnu) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:7485 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:7485 "Robert J. Chassell" writes: > You confuse me: Suppose I set something with a setq and then, either > earlier or later in my .emacs file, a customize statement sets a > symbol property that has the same effect as my setq -- this means I > have to think both about binding variables and symbol properties. > Why? > > What mental model is leading you to think that two different kinds of > expression are a good idea? Or am I misunderstanding you. The mental model I use is that custom and setq both change the values of variables. This leads to confusion if you use either more than once -- because now order of evaluation is important. This is true for two setq, too. The mental model does not say that the actual lisp expressions, must be similar. Often they are; sometimes they are not. Custom is very powerful. When custom sets variables, it can do all kinds of funky stuff: The simplest example is perhaps this: (defcustom whitespace-global-mode nil "Toggle global Whitespace mode. Setting this variable directly does not take effect; use either \\[customize] or the function `whitespace-global-mode' \(which see)." :set (lambda (sym val) (whitespace-global-mode (or val 0))) :initialize 'custom-initialize-default :type 'boolean :group 'whitespace :require 'whitespace) Setting this variable via custom (such as when loading the customizations at startup) will call the function whitespace-global-mode. Obviously a mental model that tries to understand custom on the basis of setq is too limited to capture this. My code does something else: When you call defkeymap with a default value, the variable is set to the default value. Custom, however, saves only the *additions* to the file. This, because we don't want to save the entire global-map to .emacs if the user adds a single keybinding, for example. >From this stance, having a variable with the standard value and another variable with the additions for custom continues to fit the mental model. Hope that helps. As to pretty printing and sharing -- that would indeed be nice, and would not involve fancy tricks. You could, for example, split the one call to custom-set-variables into one call per variable. The simplicity of the current approach is saving: You only need to search for the one and only sexp that starts with custom-set-variables, and replace it. Finding all individual new custom-set-variable statements, deleting them, and writing another set, opens the door to lots of bugs. Example (schematically): Currently we use one sexp: (custom-set-variables ((a 1) (b 2))) If we explicitly allow (from a tech point of view!) the pasting and copying, we'd have something like this: (custom-set-variable a 1) (custom-set-variable b 2) But what do we do in this case: (custom-set-variable a 1) (when foo (custom-set-variable b 2)) We can easily find all the sexps and delete them. But where do we write the new customizations: At the point of the first or the last sexp we deleted? Furthermore, assume when we save variables that -- when set -- should enable a global minor mode. We *could* save these commands as required ("the Customize GUI that generates a readable .emacs file that people can study, modify, and share, if they wish" -- perhaps that translates to "lisp code similar to what i would write by hand"). Well, in that case we get into the kinds of problems lots of code wizards get into: We cannot eat the dogfood we write to files. So discouraging people from manually fiddling with the save-file helps us reduce the number of potential bugs. We could now improve this saving, or provide functions to import and export settings -- but I for one do not care too much for it. > Or are you thinking that people who use Customize are too ignorant > to ever want to share or learn about Emacs? Are you figuring that > these people should be given a low grade, not for hackers, way to > set values? Are you thinking that hackers will never want to use > Customize, even for setting things for which they think Customize is > useful? I do not understand the questions. Is this sarcasm? Sorry, English is my third language. Yes, sometimes custom is the right thing for people that want to customize Emacs without learning lisp. Sometimes custom is the right thing for hackers that do not want to spend too much time thinking about the complex datastructures they want to modify (as one might see in Gnus, for example). So all the options you offer seem to be pretty narrow. Personally, I do not use custom anymore at home, but I still use it regularly at work. Alex.