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: Fri, 11 Nov 2011 09:26:02 -0600
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)

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

>> Can anyone shoe an example making the loading of specific code,
>> conditional on the users ID?
>> 
>> if you are specific uid; then ## load theses paths
>>   (add-to-list 'load-path  "/usr/local/src/vcs/cvs/bbdb") 
>>   (add-to-list 'load-path  "/usr/local/src/vcs/cvs/bbdb/lisp") 
>
> (when (= me (user-uid)) ; ME = your UID
>   (add-to-list 'load-path ...)
>   (add-to-list 'load-path ...))
>
> See (elisp) `User Identification'.

Thank you.  Yes I see the User Identification section and read it from
your pointer... thanks for that too.

To add a further complication... If you wanted to pass a list of uids.

I get thoroughly confused where the parens go.

I tried a few possibilities.

  (when (= 1000 1001 (user-uid)) 
  (when (= (1000 1001) (user-uid)) 
  (when ((= 1000 1001) (user-uid))

As you can see, I'm just kind of shotgunning in the dark.

Looking at the section on lists in emacs-elisp-intro... doesn't really
help.  Seems to get quite complicated right away and if I use the
first basic example:

     '(rose
       violet
       daisy
       buttercup)

Like this:

  (when (= '(1000 1001) (user-uid)) 

or even another example from emacs-lisp-intro

 `'(this list has (a list inside of it))'

  (when (= '(1000 (1001)) (user-uid)) 

Well, those are wrong too.




reply via email to

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