From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: how to load code conditional on uid Date: Sat, 12 Nov 2011 06:36:57 -0800 Message-ID: <09C3CFA2787F439387815B2EF709341D@us.oracle.com> References: <87obwiwzp5.fsf@newsguy.com><4C03066C51894FF99AF38EF210C163C4@us.oracle.com><87fwhuwuid.fsf@newsguy.com><25A96022A47D447E98E0AECF431157CE@us.oracle.com> <87sjltpoyv.fsf@newsguy.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1321112854 22345 80.91.229.12 (12 Nov 2011 15:47:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 12 Nov 2011 15:47:34 +0000 (UTC) To: "'Harry Putnam'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 12 16:47:29 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RPFnl-00017d-87 for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Nov 2011 16:47:29 +0100 Original-Received: from localhost ([::1]:42559 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPFnk-0006O7-FW for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Nov 2011 10:47:28 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPEhh-000822-LM for help-gnu-emacs@gnu.org; Sat, 12 Nov 2011 09:37:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RPEhf-0002Fc-9w for help-gnu-emacs@gnu.org; Sat, 12 Nov 2011 09:37:09 -0500 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:43093) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RPEhf-0002FP-49 for help-gnu-emacs@gnu.org; Sat, 12 Nov 2011 09:37:07 -0500 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id pACEb4EJ013033 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 12 Nov 2011 14:37:05 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id pACEb3kT006457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 12 Nov 2011 14:37:04 GMT Original-Received: from abhmt115.oracle.com (abhmt115.oracle.com [141.146.116.67]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id pACEawqs009202; Sat, 12 Nov 2011 08:36:58 -0600 Original-Received: from dradamslap1 (/10.159.62.157) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 12 Nov 2011 06:36:58 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87sjltpoyv.fsf@newsguy.com> Thread-Index: AcyhLSOdrhVRKT1GTxmPTf6qyRnZ/wAF+B4A X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090203.4EBE8491.0101,ss=1,re=0.000,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 141.146.126.227 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:82879 Archived-At: > C-h f member shows something that for a lightweight like me is > your basic greek. > > (member ELT LIST) > Return non-nil if ELT is an element of LIST. Comparison > done with `equal'. (member ELT LIST) shows the calling sequence of function `member'. ELT is the first parameter, LIST is the second. See (Elisp manual) `Conventions' for documentation conventions. Use `g' to go to a section of the manual such as `Conventions'. > The value is actually the tail of LIST whose car is ELT. This completes the description of the function signature: its parameters are ELT and LIST, and its return value is the (longest) tail of LIST whose first element is ELT. That is, it returns nil if element ELT is not a member of LIST, and if it is a member then it returns a sublist (a tail) whose first element is ELT. > Doing an index search in `emacs-lisp-intro' on `member' shows > no hits so apparently it is not used or explained in that document. It is an pedagogical intro, similar to a tutorial. The reference manual for Emacs Lisp is the Elisp manual. There, `i member' gives you more info about the function. > Not sure how I would find out what ELT means. Read the doc conventions section mentioned above. > Elisp manaual on ELT shows: Function: elt sequence index That's a function named `elt'. It has nothing to do with the `member' function's parameter referred to as ELT in its calling-sequence description. But if you looked up `member' in the Elisp manual you would find this: Function: member object list The function `member' tests to see whether OBJECT is a member of LIST, comparing members with OBJECT using `equal'. If OBJECT is a member, `member' returns a list starting with its first occurrence in LIST. Otherwise, it returns `nil'. ... ELT and OBJECT are just names - ways to refer to the first parameter. > But at a glance it sounds as if it could be a uid like 1000 or maybe > (user-uid). > (when (member 1000 (1000 1001 1002))... You correctly understood that the first parameter is tested to see if it is an element of the second parameter (a list). The only thing you didn't get was that `member', as an ordinary function, evaluates its arguments, so if you want to pass it the constant list (1000 1001 1002) then you need to quote that sexp: (when (member 1000 '(1000 1001 1002))... Otherwise, Lisp tries to evaluate the sexp (1000 1001 1002). In doing that, it expects the first element, 1000, to be a _function_ and tries to apply that function to the other elements - error. If you add the quote mark then the sexp to be evaluated is (quote (1000 1001 1002)), which evaluates to the list (1000 1001 1002). > or maybe (when (member (user-uid) (1000 1001 1002)) Again, correct, except for the missing quote mark. You just need to spend a little more time reading the Lisp intro and then some of the Elisp manual. IOW, do a little more homework. This too will help: http://www.emacswiki.org/emacs/LearnEmacsLisp