From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: Documentation not clear for the Lisp function set-variable Date: Mon, 27 Jun 2005 23:38:52 +0200 Message-ID: References: <87slz6nr3h.fsf@jurta.org> Reply-To: Juanma Barranquero NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1119909575 1674 80.91.229.2 (27 Jun 2005 21:59:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 27 Jun 2005 21:59:35 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 27 23:59:29 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dn1dU-0004IR-Ie for ged-emacs-devel@m.gmane.org; Mon, 27 Jun 2005 23:59:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dn1lC-0001Qp-U8 for ged-emacs-devel@m.gmane.org; Mon, 27 Jun 2005 18:07:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dn1fM-00065s-IK for emacs-devel@gnu.org; Mon, 27 Jun 2005 18:01:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dn1ed-0005p7-CF for emacs-devel@gnu.org; Mon, 27 Jun 2005 18:00:47 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dn1eZ-0005hX-Te for emacs-devel@gnu.org; Mon, 27 Jun 2005 18:00:31 -0400 Original-Received: from [64.233.182.192] (helo=nproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dn1Nv-0002fx-BR for emacs-devel@gnu.org; Mon, 27 Jun 2005 17:43:19 -0400 Original-Received: by nproxy.gmail.com with SMTP id i2so189852nfe for ; Mon, 27 Jun 2005 14:38:52 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EPPJ2CwNQzO6drV/7DQCGQy+lYUXlo6Y/AKi44HPZwNiBN8ExhWG1W3pIrCghtxxlCgHoUxkjJ6rlPfgx4goeg3f4VL4/RZUuzhlLQwl7TJn8wTAImgQ/l37AISypqc4EWT4gY8pFviC2I4daGnrUmlPuR7J1j7Z8A0Zk7eMPgM= Original-Received: by 10.48.240.16 with SMTP id n16mr106190nfh; Mon, 27 Jun 2005 14:38:52 -0700 (PDT) Original-Received: by 10.48.250.5 with HTTP; Mon, 27 Jun 2005 14:38:52 -0700 (PDT) Original-To: Eli Zaretskii In-Reply-To: Content-Disposition: inline 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: news.gmane.org gmane.emacs.devel:39697 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39697 > This patch produces the following text: >=20 > Determined by whether the first character of the documentation > for the variable is `*', the variable is customizable (has a non-nil > value of `standard-value' or of `custom-autoload' on its property list)= , > or it is a non-obsolete alias for another user variable. >=20 > Does anyone else think that this sentence is so confusing in its > structure as to be almost unparsable? (The old sentence was even less > clear.) Unparsable I wouldn't say, but certainly not very good. But anyway, Richard just said that obsolete aliases should be set-variable too. > I think this sentence sorely needs rephrasing. For starters, it > should not use passive tense. What about this patch? Do you like it a bit more? --=20 /L/e/k/t/u Index: src/eval.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/src/eval.c,v retrieving revision 1.245 diff -u -2 -r1.245 eval.c --- src/eval.c=0927 Jun 2005 05:59:23 -0000=091.245 +++ src/eval.c=0927 Jun 2005 21:32:36 -0000 @@ -890,10 +890,22 @@ } =20 +/* Error handler used in Fuser_variable_p. */ +static Lisp_Object +user_variable_p_eh (ignore) + Lisp_Object ignore; +{ + return Qnil; +} + DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0, - doc: /* Returns t if VARIABLE is intended to be set and modified by users. + doc: /* Return t if VARIABLE is intended to be set and modified by users. \(The alternative is a variable used internally in a Lisp program.) -Determined by whether the first character of the documentation -for the variable is `*' or if the variable is customizable (has a non-nil -value of `standard-value' or of `custom-autoload' on its property list). = */) +VARIABLE is considered to be a `user variable' if +\(1) the first character of its documentation is `*', or +\(2) it is customizable (its property list contains a non-nil value + of `standard-value' or `custom-autoload'), or +\(3) it is an alias for another user variable. +Return nil if VARIABLE is an alias and there is a loop in the +chain of symbols. */) (variable) Lisp_Object variable; @@ -904,21 +916,35 @@ return Qnil; =20 - documentation =3D Fget (variable, Qvariable_documentation); - if (INTEGERP (documentation) && XINT (documentation) < 0) - return Qt; - if (STRINGP (documentation) - && ((unsigned char) SREF (documentation, 0) =3D=3D '*')) - return Qt; - /* If it is (STRING . INTEGER), a negative integer means a user variable= . */ - if (CONSP (documentation) - && STRINGP (XCAR (documentation)) - && INTEGERP (XCDR (documentation)) - && XINT (XCDR (documentation)) < 0) - return Qt; - /* Customizable? See `custom-variable-p'. */ - if ((!NILP (Fget (variable, intern ("standard-value")))) - || (!NILP (Fget (variable, intern ("custom-autoload"))))) - return Qt; - return Qnil; + /* If indirect and there's an alias loop, don't check anything else. */ + if (XSYMBOL (variable)->indirect_variable + && NILP (internal_condition_case_1 (indirect_variable, variable, + Qt, user_variable_p_eh))) + return Qnil; + + while (1) + { + documentation =3D Fget (variable, Qvariable_documentation); + if (INTEGERP (documentation) && XINT (documentation) < 0) + return Qt; + if (STRINGP (documentation) + && ((unsigned char) SREF (documentation, 0) =3D=3D '*')) + return Qt; + /* If it is (STRING . INTEGER), a negative integer means a user variable. */ + if (CONSP (documentation) + && STRINGP (XCAR (documentation)) + && INTEGERP (XCDR (documentation)) + && XINT (XCDR (documentation)) < 0) + return Qt; + /* Customizable? See `custom-variable-p'. */ + if ((!NILP (Fget (variable, intern ("standard-value")))) + || (!NILP (Fget (variable, intern ("custom-autoload"))))) + return Qt; + + if (!XSYMBOL (variable)->indirect_variable) + return Qnil; + + /* An indirect variable? Let's follow the chain. */ + variable =3D XSYMBOL (variable)->value; + } } =0C