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 16:46:37 -0600
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)

"Drew Adams" <address@hidden> 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.

First, its a single user machine but I invent users from time to time
to test various things.

Over the years, being a single user all along... I've developed the
bad habit of misusing site-start.el and putting quite a lot of stuff
in there that really should be in users' ~/.emacs or the like.

So to do some testing, kind of suddenly, rather than go thru and really
clean up site-start.el from top to bottom, which would take me a while
I thought I might just put conditionals where I didn't want a newly
invented user to evaluate stuff and thereby still be able to test
whatever right now.  (Putting off the inevitable clean up of
site-start.el till later)

The general aim was to have a conditional ahead of some elisp code so
that only 1 user's (me) emacs instance would evaluate it.  And in fact
that is about all I really needed to do, so, I started out just
wanting to test for a number like your first example does.

After posting about that and seeing your nifty answer, it occurred to
me that there may be occasion where I'd want several, but not all,
newly invented users to be allowed to eval stuff.

My programming background is so thin that I did not recognize what
should have been obvious (given the equals (=) sign) and got the
foolish notion I might be able to pass several uid to that same kind
of conditional.

I'm very delighted with your detailed explanations, you've made a
number of things clear[er] and provided a nice jumpstart for my weak
adventures with elisp.

Consequently, I've already learned how to allow one user to eval
something, and now how to allow a list of users to do the same thing.

Clearly I have a lot to catch up on and will have to take a lot more
baby steps with close attention to the lisp-intro as I go.

Thanks again for your patient hand holding.




reply via email to

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