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: [roland.winkler@physik.uni-erlangen.de: documentation bug: customization type `option'] Date: Fri, 02 Jul 2004 11:19:26 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <871xjuojfl.fsf@emacswiki.org> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1088759997 4178 80.91.224.253 (2 Jul 2004 09:19:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 2 Jul 2004 09:19:57 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Jul 02 11:19:47 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 1BgKCx-0003R3-00 for ; Fri, 02 Jul 2004 11:19:47 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BgKCw-0002qj-00 for ; Fri, 02 Jul 2004 11:19:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BgKEk-00014q-Nt for emacs-devel@quimby.gnus.org; Fri, 02 Jul 2004 05:21:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BgKEg-00014M-QC for emacs-devel@gnu.org; Fri, 02 Jul 2004 05:21:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BgKEf-000143-SS for emacs-devel@gnu.org; Fri, 02 Jul 2004 05:21:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BgKEf-000140-Nq for emacs-devel@gnu.org; Fri, 02 Jul 2004 05:21:33 -0400 Original-Received: from [62.2.95.247] (helo=smtp.hispeed.ch) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BgKCh-0002tv-R9; Fri, 02 Jul 2004 05:19:32 -0400 Original-Received: from confusibombus (80-218-5-94.dclient.hispeed.ch [80.218.5.94]) by smtp.hispeed.ch (8.12.6/8.12.6/tornado-1.0) with ESMTP id i629JRqj017909 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO); Fri, 2 Jul 2004 11:19:28 +0200 Original-Received: from alex by confusibombus with local (Exim 4.34) id 1BgKCd-0000cj-8T; Fri, 02 Jul 2004 11:19:27 +0200 Original-To: rms@gnu.org, roland.winkler@physik.uni-erlangen.de Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAACkElEQVR42s1a0bLsIAgzjv// y7kPd9pVKxKVdk6fzux2C4EAwR6QZBpcQEopIf3Fq3a52Lfh0Mjjk99zcWYBwA2ihEen9jVxfAf/ u0+Y2HQwNoVw4Dx34trRV6NSjiLPmfPt77jwiBxB/3PnZ3B2AGxzHnGu0wcBwAIAyQwZGvQhiFcy YLOFQcSB/MS82n3ec37vykNqRFTX9rVWR2U5+pZNIggll0CUOQN9BDdm1LfBmcZxIEqjL6r2JU/D galaB7Zg4jlY2ulnIx9OR4iMRl38CAFyKaA8jAxE7lNn650VKMULZ/54crqn0YQCJGQliebXkFIK hwqmGm28cgsSjz/hzRCMneQEwMjVoH3gWTtMPgIslJUV5uIluvUEkyzU+gUGQO62e9NuSdZCzNOM fDPC87iCqfE9gHinsIrSL16TPBfrYIeHzqKU90a50jCh54EcrgAUFo5ibzvebgr/I66USQ0CspQp IVSoBQK3WswDDIndIraHxoglqOjM1d044PQvu1NY0EHtqQR/XwJ+PeCs0x2dSlApZVw4MPER23PD 7JekoHxrqTRod/2Gx5nhx5dfAJhqPt7tDMIZxNN/7lOIaparPn7ZQ88drlORC2eLWXowxIq4gHTh VN1BSmsHoxYAbPWDTuGQuuecS+aYQUYpfr0YqPQOuuUk5tApK077+2xfOYP+XyWEIwPcE49lvT9N y2+wU2KylGGp4yxlALcm6fSlmgk62yfSsfNunDl5d6W91MBUoZw679YAJoMMkhijuXdFOL+khaL2 s+g3zy4APQuQvSc/BNAYnkl6E8ivYtEHJXa1dihE3zgnKMdNgN8DiIwgA17NykUMvFDQ+LALvXXI BuBLAHv/DvBmc/0HzR03PqXmLcQAAAAASUVORK5CYII= In-Reply-To: (Richard Stallman's message of "Thu, 01 Jul 2004 13:14:56 -0400") User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) 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:25389 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25389 Richard Stallman writes: > In bibtex.el the declaration of bibtex-user-optional-fields as a > customizable user option variable contains the custamization type > `option'. It seems to me that this custamization type is not > documented anywhere. I can't find it in the appropriate part of the > elisp manual (nodes `Simple Types' or `Composite Types') nor can I > find it in the info file for the emacs widget library. > > The particular thing I want to know is whether (how) one can specify > the default value `unselected' for the checkbox of an option. There are a number of calls to define-widget in wid-edit that define widgets we don't talk about in the widget manual. One of them is the option widget. The reasons for omitting these widgets could be that they are only used in doc strings (function-link) by custom or similar libraries, or that they are sub-widgets of documented widgets (eg. a list widget automatically has insert and delete widgets). Nevertheless, it might be nice to document these, since the widget manual is the place where programmers go to look for information about widgets. Certainly I did... :) default function-link variable-link file-link emacs-library-link emacs-commentary-link option radio-button insert-button delete-button visibility documentation-link documentation-string other coding-system restricted-sexp float lazy my-list sexp-list plist alist radio color As for the question: The source says that an option is just an inlined checklist: (define-widget 'option 'checklist "An widget with an optional item." :inline t) Thus: "The checklist widget will match a list whose elements all match at least one of the specified TYPE arguments." It seems to me that an unselected option would therefore have an unmatched value. (defcustom bibtex-user-optional-fields '(("annote" "Personal annotation (ignored)")) "*List of optional fields the user wants to have always present. Entries should be of the same form as the OPTIONAL and CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (see documentation of this variable for details)." :group 'bibtex :type '(repeat (group (string :tag "Field") (string :tag "Comment") (option (group :inline t :extra-offset -4 (choice :tag "Init" :value "" string function)))))) Therefore: (setq bibtex-user-optional-fields '(("field" "comment" "foo"))) (customize-option 'bibtex-user-optional-fields) Make sense, "foo" matches the string choice. (setq bibtex-user-optional-fields '(("field" "comment" bar))) (customize-option 'bibtex-user-optional-fields) Here's the strange thing: this matches the function choice even though (functionp "foo") is nil In fact, 0, t, nil -- all of them are recognized as a function! When you try to set the function widget to any of these values interactively, you will get an error. I'm not sure what to do here. Maybe we can make the function widget more selective, but it might break -- eg. you might want to force users to only choose defined functions interactively, but when the customization is saved and loaded in another session, you want to be able to show the user the widget, even if the function is not defined anymore. Thus, I suggest no change. Back to the question: I found that the following does what was asked -- the option is unselected. This is not pretty. ;) (setq bibtex-user-optional-fields '(("field" "comment"))) (customize-option 'bibtex-user-optional-fields) I also wonder what would happen if the option was not the last item in the group, like this: :type '(repeat (group (string :tag "Field") (option (group :inline t :extra-offset -4 (choice :tag "Init" :value "" string function))) (string :tag "Comment")))) It seems to me that in this case, you cannot set the variable to a value so that the option widget is false -- because the function choice will match anything. You would have to rewrite it by using a choice directly: (defcustom bibtex-user-optional-fields '(("annote" "Personal annotation (ignored)")) "*List of optional fields the user wants to have always present. Entries should be of the same form as the OPTIONAL and CROSSREF-OPTIONAL lists in `bibtex-entry-field-alist' (see documentation of this variable for details)." :group 'bibtex :type '(repeat (group (string :tag "Field") (string :tag "Comment") (choice :tag "Init" :value "" (const nil) string function)))) It works for both cases: (setq bibtex-user-optional-fields '(("field" "comment"))) (customize-option 'bibtex-user-optional-fields) (setq bibtex-user-optional-fields '(("field" "comment" nil))) (customize-option 'bibtex-user-optional-fields) And I also think that in this case, it makes more sense: There is no reason to define a user optional field that is undefined. It will always have a value, even if it is nil. What do you think? Alex. -- .O. http://www.emacswiki.org/alex/ ..O Schroeder's fourth law: OOO None of your friends and coworkers share your taste in music.