From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Matt Hodges Newsgroups: gmane.emacs.devel Subject: Re: lispref/customize.texi checked. Date: Tue, 23 Nov 2004 09:34:24 +0000 Message-ID: <87fz30oqn3.fsf@molpro.net> References: <87hdniorvc.fsf@molpro.net> <87pt25ozjv.fsf@jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1101204551 32637 80.91.229.6 (23 Nov 2004 10:09:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 23 Nov 2004 10:09:11 +0000 (UTC) Cc: Matt Hodges , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 23 11:08:58 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CWXbW-0005re-00 for ; Tue, 23 Nov 2004 11:08:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CWXkX-0002vB-Iq for ged-emacs-devel@m.gmane.org; Tue, 23 Nov 2004 05:18:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CWXDV-0004aI-HV for emacs-devel@gnu.org; Tue, 23 Nov 2004 04:44:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CWXDT-0004Zc-Go for emacs-devel@gnu.org; Tue, 23 Nov 2004 04:44:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CWXDT-0004ZL-8v for emacs-devel@gnu.org; Tue, 23 Nov 2004 04:44:07 -0500 Original-Received: from [137.205.128.9] (helo=mail-relay-3.warwick.ac.uk) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CWX4J-00073A-Hn for emacs-devel@gnu.org; Tue, 23 Nov 2004 04:34:39 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail-relay-3.csv.warwick.ac.uk (8.12.11/8.12.9) with ESMTP id iAN9YcQU018238; Tue, 23 Nov 2004 09:34:38 GMT Original-Received: from mail-relay-3.csv.warwick.ac.uk ([127.0.0.1]) by localhost (harebell [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 00288-191; Tue, 23 Nov 2004 09:34:35 +0000 (GMT) Original-Received: from dugong (host-10-4-4-149.in-addr.warwickpiazza.net [10.4.4.149]) by mail-relay-3.csv.warwick.ac.uk (8.12.11/8.12.9) with ESMTP id iAN9YVWv018185; Tue, 23 Nov 2004 09:34:31 GMT Original-Received: from matt by dugong with local (Exim 4.34) id 1CWX44-000304-Un; Tue, 23 Nov 2004 09:34:25 +0000 Original-To: Juri Linkov In-Reply-To: <87pt25ozjv.fsf@jurta.org> (Juri Linkov's message of "Tue, 23 Nov 2004 08:22:55 +0200") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3.50 (gnu/linux) X-Virus-Scanned: amavisd-new at warwick.ac.uk X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30276 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30276 --=-=-= >>>>> Juri Linkov writes: > I think show-paren-mode should be replaced with something else. The > line before this example in the manual says: > Here is an example, from the library `paren.el': > This is not true. defcustom of show-paren-mode was changed to > define-minor-mode long ago. There are other real examples with > similar defcustom that could be used instead of show-paren-mode, > e.g. tooltip-mode from tooltip.el. I've updated the patch to include this -- I suggest changing the first line of the tooltip-mode variable documentation from "Toggle tooltip-mode." to "Non-nil if Tooltip mode is enabled.". I've also added a few other minor fixes relative to the previous patch. Thanks, Matt --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=customize.texi.diff Content-Description: customize.texi patch. Index: customize.texi =================================================================== RCS file: /cvsroot/emacs/emacs/lispref/customize.texi,v retrieving revision 1.39 diff -c -r1.39 customize.texi *** customize.texi 24 Jun 2004 20:17:34 -0000 1.39 --- customize.texi 23 Nov 2004 09:27:14 -0000 *************** *** 300,316 **** operation of a certain feature. Assuming that the package is coded to check the value of the option, you still need to arrange for the package to be loaded. You can do that with @code{:require}. @xref{Common ! Keywords}. Here is an example, from the library @file{paren.el}: @example ! (defcustom show-paren-mode nil ! "Toggle Show Paren mode..." :set (lambda (symbol value) ! (show-paren-mode (or value 0))) :initialize 'custom-initialize-default :type 'boolean ! :group 'paren-showing ! :require 'paren) @end example If a customization item has a type such as @code{hook} or @code{alist}, --- 300,316 ---- operation of a certain feature. Assuming that the package is coded to check the value of the option, you still need to arrange for the package to be loaded. You can do that with @code{:require}. @xref{Common ! Keywords}. Here is an example, from the library @file{tooltip.el}: @example ! (defcustom tooltip-mode nil ! "Non-nil if Tooltip mode is enabled..." :set (lambda (symbol value) ! (tooltip-mode (or value 0))) :initialize 'custom-initialize-default :type 'boolean ! :require 'tooltip ! :group 'tooltip) @end example If a customization item has a type such as @code{hook} or @code{alist}, *************** *** 529,535 **** The @code{group} widget is used here instead of @code{list} only because the formatting is better suited for the purpose. ! Similarily, you can have alists with more values associated with each key, using variations of this trick: @smallexample --- 529,535 ---- The @code{group} widget is used here instead of @code{list} only because the formatting is better suited for the purpose. ! Similarly, you can have alists with more values associated with each key, using variations of this trick: @smallexample *************** *** 538,544 **** ("ken" 52 t)) "Alist of basic info about people. Each element has the form (NAME AGE MALE-FLAG)." ! :type '(alist :value-type (group age boolean))) (defcustom pets '(("brian") ("dorith" "dog" "guppy") --- 538,544 ---- ("ken" 52 t)) "Alist of basic info about people. Each element has the form (NAME AGE MALE-FLAG)." ! :type '(alist :value-type (group integer boolean))) (defcustom pets '(("brian") ("dorith" "dog" "guppy") *************** *** 665,671 **** @end example @noindent ! so that the menu offers @samp{Number of spaces} and @samp{Literal Text}. In any alternative for which @code{nil} is not a valid value, other than a @code{const}, you should specify a valid default for that alternative --- 665,671 ---- @end example @noindent ! so that the menu offers @samp{Number of spaces} and @samp{Literal text}. In any alternative for which @code{nil} is not a valid value, other than a @code{const}, you should specify a valid default for that alternative *************** *** 824,831 **** Use @var{criteria} to match possible values. This is used only in @code{restricted-sexp}. ! @item :args @var{argumentlist} ! Use the elements of @var{argumentlist} as the arguments of the type construct. For instance, @code{(const :args (foo))} is equivalent to @code{(const foo)}. You rarely need to write @code{:args} explicitly, because normally the arguments are recognized automatically as --- 824,831 ---- Use @var{criteria} to match possible values. This is used only in @code{restricted-sexp}. ! @item :args @var{argument-list} ! Use the elements of @var{argument-list} as the arguments of the type construct. For instance, @code{(const :args (foo))} is equivalent to @code{(const foo)}. You rarely need to write @code{:args} explicitly, because normally the arguments are recognized automatically as *************** *** 1071,1078 **** using the same type for many user options, rather than repeat the specification for each option, you can give the type specification a name once, and use that name each @code{defcustom}. The other case is ! when a user option accept a recursive datastructure. To make it ! possible for a datatype to refer to itself, it needs to have a name. Since custom types are implemented as widgets, the way to define a new customize type is to define a new widget. We are not going to describe --- 1071,1078 ---- using the same type for many user options, rather than repeat the specification for each option, you can give the type specification a name once, and use that name each @code{defcustom}. The other case is ! when a user option accepts a recursive data structure. To make it ! possible for a data type to refer to itself, it needs to have a name. Since custom types are implemented as widgets, the way to define a new customize type is to define a new widget. We are not going to describe *************** *** 1097,1136 **** :type 'binary-tree-of-string) @end example ! The function to define a new widget is name @code{define-widget}. The first argument is the symbol we want to make a new widget type. The second argument is a symbol representing an existing widget, the new widget is going to be defined in terms of difference from the existing widget. For the purpose of defining new customization types, the ! @code{lazy} widget is perfect, because it accept a @code{:type} keyword argument with the same syntax as the keyword argument to @code{defcustom} with the same name. The third argument is a documentation string for the new widget. You will be able to see that string with the @kbd{M-x widget-browse @key{ret} binary-tree-of-string @key{ret}} command. ! After these mandatory arguments follows the keyword arguments. The most ! important is @code{:type}, which describes the datatype we want to match with this widget. Here a @code{binary-tree-of-string} is described as being either a string, or a cons-cell whose car and cdr are themselves both @code{binary-tree-of-string}. Note the reference to the widget type we are currently in the process of defining. The @code{:tag} attribute is a string to name the widget in the user interface, and the ! @code{:offset} argument are there to ensure that child nodes are ! indented four spaces relatively to the parent node, making the tree structure apparent in the customization buffer. The @code{defcustom} shows how the new widget can be used as an ordinary customization type. ! If you wonder about the name @code{lazy}, know that the other composite ! widgets convert their inferior widgets to internal form when the widget ! is instantiated in a buffer. This conversion is recursive, so the ! inferior widgets will convert @emph{their} inferior widgets. If the ! datastructure is itself recursive, this conversion will go on forever, ! or at least until Emacs run out of stack space. The @code{lazy} widget ! stop this recursion, it will only convert its @code{:type} argument when ! needed. @ignore arch-tag: d1b8fad3-f48c-4ce4-a402-f73b5ef19bd2 --- 1097,1136 ---- :type 'binary-tree-of-string) @end example ! The function to define a new widget is called @code{define-widget}. The first argument is the symbol we want to make a new widget type. The second argument is a symbol representing an existing widget, the new widget is going to be defined in terms of difference from the existing widget. For the purpose of defining new customization types, the ! @code{lazy} widget is perfect, because it accepts a @code{:type} keyword argument with the same syntax as the keyword argument to @code{defcustom} with the same name. The third argument is a documentation string for the new widget. You will be able to see that string with the @kbd{M-x widget-browse @key{ret} binary-tree-of-string @key{ret}} command. ! After these mandatory arguments follow the keyword arguments. The most ! important is @code{:type}, which describes the data type we want to match with this widget. Here a @code{binary-tree-of-string} is described as being either a string, or a cons-cell whose car and cdr are themselves both @code{binary-tree-of-string}. Note the reference to the widget type we are currently in the process of defining. The @code{:tag} attribute is a string to name the widget in the user interface, and the ! @code{:offset} argument is there to ensure that child nodes are ! indented four spaces relative to the parent node, making the tree structure apparent in the customization buffer. The @code{defcustom} shows how the new widget can be used as an ordinary customization type. ! If you are curious about the name @code{lazy}, you need to understand ! that the other composite widgets convert their inferior widgets to an ! internal form when the widget is instantiated in a buffer. This ! conversion is recursive, so the inferior widgets will convert ! @emph{their} inferior widgets. If the data structure is itself ! recursive, this conversion will go on forever, or at least until Emacs ! run out of stack space. The @code{lazy} widget stop this recursion, it ! will only convert its @code{:type} argument when needed. @ignore arch-tag: d1b8fad3-f48c-4ce4-a402-f73b5ef19bd2 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: tooltip.el patch. *** tooltip.el 12 Nov 2004 13:47:23 +0000 1.37 --- tooltip.el 23 Nov 2004 09:28:48 +0000 *************** *** 508,514 **** ;;;###autoload (defcustom tooltip-mode nil ! "Toggle tooltip-mode. Setting this variable directly does not take effect; use either \\[customize] or the function `tooltip-mode'." :set (lambda (symbol value) --- 508,514 ---- ;;;###autoload (defcustom tooltip-mode nil ! "Non-nil if Tooltip mode is enabled. Setting this variable directly does not take effect; use either \\[customize] or the function `tooltip-mode'." :set (lambda (symbol value) --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--