elisp: User Identification
38.4 User Identification
========================
-- Variable: init-file-user
This variable says which user’s init files should be used by
Emacs—or ‘nil’ if none. ‘""’ stands for the user who originally
logged in. The value reflects command-line options such as ‘-q’ or
‘-u USER’.
Lisp packages that load files of customizations, or any other sort
of user profile, should obey this variable in deciding where to
find it. They should load the profile of the user name found in
this variable. If ‘init-file-user’ is ‘nil’, meaning that the
‘-q’, ‘-Q’, or ‘-batch’ option was used, then Lisp packages should
not load any customization files or user profile.
-- User Option: user-mail-address
This holds the nominal email address of the user who is using
Emacs. Emacs normally sets this variable to a default value after
reading your init files, but not if you have already set it. So
you can set the variable to some other value in your init file if
you do not want to use the default value.
-- Function: user-login-name &optional uid
This function returns the name under which the user is logged in.
It uses the environment variables ‘LOGNAME’ or ‘USER’ if either is
set. Otherwise, the value is based on the effective UID, not the
real UID.
If you specify UID (a number), the result is the user name that
corresponds to UID, or ‘nil’ if there is no such user.
-- Function: user-real-login-name
This function returns the user name corresponding to Emacs’s real
UID. This ignores the effective UID, and the environment variables
‘LOGNAME’ and ‘USER’.
-- Function: user-full-name &optional uid
This function returns the full name of the logged-in user—or the
value of the environment variable ‘NAME’, if that is set.
If the Emacs process’s user-id does not correspond to any known
user (and provided ‘NAME’ is not set), the result is ‘"unknown"’.
If UID is non-‘nil’, then it should be a number (a user-id) or a
string (a login name). Then ‘user-full-name’ returns the full name
corresponding to that user-id or login name. If you specify a
user-id or login name that isn’t defined, it returns ‘nil’.
The symbols ‘user-login-name’, ‘user-real-login-name’ and
‘user-full-name’ are variables as well as functions. The functions
return the same values that the variables hold. These variables allow
you to fake out Emacs by telling the functions what to return. The
variables are also useful for constructing frame titles (Frame
Titles).
-- Function: user-real-uid
This function returns the real UID of the user. The value may be
floating point, in the (unlikely) event that the UID is too large
to fit in a Lisp integer.
-- Function: user-uid
This function returns the effective UID of the user. The value may
be floating point.
-- Function: group-gid
This function returns the effective GID of the Emacs process. The
value may be floating point.
-- Function: group-real-gid
This function returns the real GID of the Emacs process. The value
may be floating point.
-- Function: system-users
This function returns a list of strings, listing the user names on
the system. If Emacs cannot retrieve this information, the return
value is a list containing just the value of
‘user-real-login-name’.
-- Function: system-groups
This function returns a list of strings, listing the names of user
groups on the system. If Emacs cannot retrieve this information,
the return value is ‘nil’.