PREV UP NEXT GNU Emacs Lisp Reference Manual

34.4: User Identification

Variable: user-mail-address
This holds the nominal email address of the user who is using Emacs. When Emacs starts up, it computes a default value that is usually right, but users often set this themselves when the default value is not right.
Function: user-login-name &optional uid
If you don't specify uid, this function returns the name under which the user is logged in. If the environment variable LOGNAME is set, that value is used. Otherwise, if the environment variable USER is set, that value is used. Otherwise, the value is based on the effective uid, not the real uid.

If you specify uid, the value is the user name that corresponds to uid (which should be an integer).

(user-login-name)
     => "lewis"
Function: user-real-login-name
This function returns the user name corresponding to Emacs's real uid. This ignores the effective uid and ignores the environment variables LOGNAME and USER.
Function: user-full-name
This function returns the full name of the user.
(user-full-name)
     => "Bil Lewis"

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 (see Frame Titles).

Function: user-real-uid
This function returns the real uid of the user.
(user-real-uid)
     => 19
Function: user-uid
This function returns the effective uid of the user.