From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Robert Thorpe Newsgroups: gmane.emacs.help Subject: Re: Whats wrong with this defcustom? Date: Tue, 29 Jul 2014 01:46:10 +0100 Message-ID: <87d2cprnzh.fsf@robertthorpeconsulting.com> References: <87vbqhull4.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1406594810 14191 80.91.229.3 (29 Jul 2014 00:46:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Jul 2014 00:46:50 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Thorsten Jolitz Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 29 02:46:41 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XBvYr-0003IW-GT for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Jul 2014 02:46:37 +0200 Original-Received: from localhost ([::1]:43020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBvYq-0007SF-Ve for geh-help-gnu-emacs@m.gmane.org; Mon, 28 Jul 2014 20:46:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBvYa-0007RJ-7r for help-gnu-emacs@gnu.org; Mon, 28 Jul 2014 20:46:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XBvYT-0005xB-IO for help-gnu-emacs@gnu.org; Mon, 28 Jul 2014 20:46:20 -0400 Original-Received: from outbound-smtp04.blacknight.com ([81.17.249.35]:43052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBvYT-0005wt-9t for help-gnu-emacs@gnu.org; Mon, 28 Jul 2014 20:46:13 -0400 Original-Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp04.blacknight.com (Postfix) with ESMTP id AB85699712 for ; Tue, 29 Jul 2014 00:45:43 +0000 (UTC) Original-Received: (qmail 24118 invoked from network); 29 Jul 2014 00:46:11 -0000 Original-Received: from unknown (HELO RTLaptop) (rt@robertthorpeconsulting.com@[109.78.45.39]) by 81.17.254.9 with ESMTPSA (DHE-RSA-AES128-SHA encrypted, authenticated); 29 Jul 2014 00:46:11 -0000 In-Reply-To: <87vbqhull4.fsf@gmail.com> (message from Thorsten Jolitz on Tue, 29 Jul 2014 01:09:43 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 81.17.249.35 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:98971 Archived-At: Thorsten Jolitz writes: > Stefan Monnier writes: ... > > Ok, precision matters, so a quoted symbol is at the same time an > unquoted *expression* that returns the symbol itself ... while an unquoted symbol > in an unquoted *expression* that tries to return the symbols value (as a > variable) ... (?) Apologies if I explain things you already know. See below: *** Welcome to IELM *** Type (describe-mode) for help. ELISP> (setq bar 4) 4 ELISP> (setq foo bar) 4 ELISP> foo 4 ELISP> bar 4 ELISP> (setq foo 'bar) bar ELISP> foo bar ELISP> bar 4 Think about setq.... If you want to set foo to the symbol bar then you have to quote it. Similarly, in defcustom if you want the STANDARD to be a symbol then you have to quote it, so quoting "notes" is right. On the other hand the whole "'choice ..." expression is quoted. It's a data structure, a little list/tree made up of strings and symbols. The bit in the docstring is telling you not to quote anything except symbols. This may help... Last week I replied to a question about symbols and explained what they are. Sometimes the lisp interpreter evaluates and sometimes it doesn't, that confuses things. I wrote: "If we have a function call: (foo bar 'baz) then lisp treats each of these symbols differently. It finds the function slot for foo because that's the first symbol, it finds the variable slot for bar because it's not first. Finally, 'baz returns the symbol itself. To be more careful: (quote baz) returns a list containing the symbol, which evaluates to the symbol". That applies to functions, other things can be different. Imagine we have a lisp interpreter that works on lisp lists. It takes a tree (a lisp list) and evaluates it (the "eval" function) by looking at the first argument and figuring out what to do. Some "special forms" are dealt with directly. For other things the interpreter finds the corresponding function. If you think about this it needs to decide how to deal with arguments. They can be "unevalled", the relevant fragment of the list can be used as-is. Or it can be "evalled" in which case a recursive call to the eval function is needed. In that case a list would be interpreted as a function call and a sole symbol as a variable reference. Does the lisp programmer need to deal with both unevalled and evalled type arguments? Not really, a special-form can be provided to switch between the two. The special-form "Quote" takes its arguments unevalled and simply returns them; '(something) is just an abbreviation for (quote something). As well as quote, there are a few built-in special forms that work that way. There are also macros which operate directly on lists. They get lists from the reader before evaluation begins, then they transform them. For example, "eval-when-compile" is a macro. It takes an argument BODY which is unquoted. On the other hand, "eval-after-load" is a function it takes two arguments FILE and FORM. Since it's a function FORM must be quoted. Because eval-after-load is a function it must call eval explicitly to deal with FORM. The line in defcustom's documentation about not quoting is there to say that defcustom behaves like "eval-when-compile" not like "eval-after-load". BR, Robert Thorpe