all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Harry Putnam <reader@newsguy.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to load code conditional on uid
Date: Sat, 12 Nov 2011 05:19:52 -0600	[thread overview]
Message-ID: <87sjltpoyv.fsf@newsguy.com> (raw)
In-Reply-To: 25A96022A47D447E98E0AECF431157CE@us.oracle.com

"Drew Adams" <drew.adams@oracle.com> writes:

> What do you want to test?  Whether the current `user-uid' is a
> member of that list?  If so, use function `member' - do not use
> function `=' which tests whether two numbers are equal.

C-h f member <RET> shows something that for a lightweight like me is
your basic greek.

,----
| member is a built-in function in `C source code'.
| 
| (member ELT LIST)
| 
| Return non-nil if ELT is an element of LIST.  Comparison done with `equal'.
| The value is actually the tail of LIST whose car 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.

Not sure how I would find out what ELT means.  A quick index search in
Elisp manaual on ELT shows:

,----
| -- Function: elt sequence index
|      This function returns the element of SEQUENCE indexed by INDEX.
|      Legitimate values of INDEX are integers ranging from 0 up to one
|      less than the length of SEQUENCE.  If SEQUENCE is a list,
|      out-of-range values behave as for `nth'.  *Note Definition of
|      nth::.  Otherwise, out-of-range values trigger an
|      `args-out-of-range' error.
|       [...]
`----

Well, that didn't help (me) much.  Other than to indicate ELT is short
for element.

But at a glance it sounds as if it could be a uid like 1000 or maybe
(user-uid).

So a couple of clumsy experiments show I've got it all wrong.

(when (member 1000 (1000 1001 1002))
 (add-to-list 'load-path ...)
  (add-to-list 'load-path ...))

or maybe

(when (member (user-uid) (1000 1001 1002)) 
  (add-to-list 'load-path ...)
  (add-to-list 'load-path ...))




  parent reply	other threads:[~2011-11-12 11:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-11 13:33 how to load code conditional on uid Harry Putnam
2011-11-11 14:44 ` Drew Adams
2011-11-11 15:26   ` Harry Putnam
2011-11-11 15:45     ` Drew Adams
2011-11-11 22:46       ` Harry Putnam
2011-11-12 11:19       ` Harry Putnam [this message]
2011-11-12 14:36         ` Drew Adams
2011-11-13 23:14           ` Harry Putnam
     [not found] <mailman.258.1321018489.798.help-gnu-emacs@gnu.org>
2011-11-12  2:40 ` Jason Rumney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sjltpoyv.fsf@newsguy.com \
    --to=reader@newsguy.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.