help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to load code conditional on uid


From: Harry Putnam
Subject: Re: how to load code conditional on uid
Date: Sat, 12 Nov 2011 05:19:52 -0600
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)

"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 ...))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]