# User Profiles(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## USER PROFILES

This section describes how a user profile should be incorporated into MicroEmacs 2009. A user profile defines a set of extensions to MicroEmacs which encapsulates settings which are used by an individual user.

The user profile allows:-

- Saving of the last session (history), allowing the next invocation of MicroEmacs 2009 to restore your previous session. The -c option to me(1) restores a previous sessions buffers to the same state prior to exiting the editor.
- Personalized spelling dictionaries.
- Redefinition of MicroEmacs 2009 operation, allowing the editor to be tailored to an individual's requirements. Including the re-binding of keys, modification of the screen colors. Definition of personal macros etc.

## Identification

In order to identify a user MicroEmacs 2009 uses information in the system to determine the name of the user, and in turn the configuration to use. On all systems the value of the environment variable $MENAME(5) takes priority over any other means of user identification. If this variable is not defined then the host system typically provides a mechanism to determine the current user. MS-DOS and Microsoft Windows systems present problems where a login prompt is not used.

Each of the supported platforms are now described.

UNIX

The login name is determined from the `/etc/passwd` file and defines $user-name(5). The environment variable $MENAME(5) may be defined alter the default user configuration file name.

DOS

MS-DOS typically has no concept of the user name. The user name may be defined in the `autoexec.bat` file, choose a name of 8 characters or less, i.e. to fix the user name to `fred` then add the following line:-

    SET MENAME=fred

Remember to re-boot the system before the new command takes effect. (see the next step, there is another change to `autoexec.bat`).

Microsoft Windows

Microsoft windows environments may, or may not, have login enabled. If login is enabled then $user-name(5) is set to the login user name. The login name may be overridden by setting the environment variable $MENAME(5) this may be performed in the environment or through the me32.ini(8) file.

## Shared Platforms

Platforms may share the same set of configuration files. Consider a system which may boot under MS-DOS, Windows '98, NT and Linux. Provided that the macro files are located on a file system that may be mounted by all of the other operating systems and the $MEUSERPATH(5) and $MEPATH(5) are set appropriately to point to the users private MicroEmacs and system directories, then a single set of macro files may be shared across all platforms.

## Personal MicroEmacs Directory

The private user profile is stored in a separate directory. The directory that MicroEmacs uses is typically automatically created at start up, but may be created manually by the user. If the directory is to be placed in a special location then the $MEUSERPATH(5) environment variable should be defined and set to point at this directory location.

UNIX

In the UNIX environment then the local directory is typically created in the users home directory obtained from the `/etc/passwd` file and is called `~/.jasspa`. MicroEmacs will automatically look for this directory and set the $user-path(5) variable to this value. The location may be overridden by setting the environment variable $MEUSERPATH(5) to reference a different directory location.

DOS

For MS-DOS environments, there is typically no user directory, it is suggested that the user directory is created in the MicroEmacs directory, use the `$MENAME` defined in the previous step i.e.

    mkdir c:\jasspa\fred

Change or add the environment variable $MEUSERPATH(5) in the autoexec.bat to include the new directory i.e.

    SET MEUSERPATH=c:\jasspa\fred

Windows

In Microsoft Windows environment using Explorer 4.0 or later then a user application data directory exists (`$APPDATA`) and MicroEmacs will create a directory `jasspa` in this directory location to hold private data. If there is no such data area then all user configuration is stored in the executable directory location (or a sub-directory called $user-name(5)).

The user data area $user-path(5) may be modified by creating a new directory and setting the environment variable $MEUSERPATH(5) to point to this new directory location. The location be specified by a meuserpath entry in the me32.ini(8) file rather than setting the environment variable $MEUSERPATH(5).

## Creating Your Profile

On starting MicroEmacs for the first time then the user is guided through the configuration file setup to create any local configuration files. Once set up then MicroEmacs may be configured using the user-setup(3) dialog:-

    Tools -> User Setup

## The User Profile

Files created in the user directory include:-

- Setup registry and previous session history $user-name.erf (see erf(8)). This stores the user-setup settings and the context from previous edit sessions.
- Users start-up file $user-name.emf (see emf(8)). This is typically referred to as "user.emf" in the documentation and means the users private MicroEmacs macro file. The user may make local changes to MicroEmacs in this file, this may include definition of new key bindings, defining new hook functions etc. You should override the standard MicroEmacs settings from your start-up file rather than modifying the standard MicroEmacs files.
- Personal spelling dictionary lsdp lang.edf (see edf(8)). Multiple spelling dictionaries may be created, one for each language. Any words that are added to the spelling dictionary are stored in these files.

In addition to the above, if new private macro files are constructed then they should be added to this directory (if they are not global to the company).

## EXAMPLE

The following are examples of some individuals start-up files:-

    ; Jon's special settings
    ;
    ; Last Modified <190698.2226>
    ;
    ; Macro to delete the whitespace, or if an a word all of the
    ; word until the next word is reached.
    define-macro super-delete
        set-variable #l0 0
        !while &not &sin @wc " \t\n"
            forward-char
            set-variable #l0 &add #l0 1
        !done
        !repeat
            !force forward-char
            !if $status
                set-variable #l0 &add #l0 1
            !endif
        !until &or &seq @wc "" &not &sin @wc " \t\n"
        #l0 backward-delete-char
        !return
    !emacro
    ; Make a previous-buffer command.
    define-macro previous-buffer
        &neg @# next-buffer
    !emacro
    ; spotless; Perform a clean and remove any multi-blank lines.
    define-macro spotless
        -1 clean
    !emacro
    ; comment-adjust; Used for comments in electric-c mode (and the other
    ; electic modes. Moves to the comment fill position, saves having to mess
    ; around with comments at the end of the line.
    0 define-macro comment-adjust
        ; delete all spaces up until the next character
        !while &sin @wc " \t"
            forward-delete-char
        !done
        ; Fill the line to the current $c-margin. We use this as
        ; this is the only variable that tells us where the margin
        ; should be.
        !if &gre $window-acol 0
            backward-char
            !if &sin @wc " \t"
    	    forward-delete-char
                !jump -4
            !else
                forward-char
            !endif
        !endif
        ; Now fill to the $c-margin
        &sub $c-margin $window-acol insert-string " "
    !emacro
    ; Macro to force buffer to compile buffer for C-x '
    define-macro compile-error-buffer
        !force delete-buffer *compile*
        change-buffer-name "*compile*"
    !emacro
    ;
    ; Set up the bindings.
    ;
    global-bind-key super-delete            "C-delete"
    global-bind-key beginning-of-line       "home"
    global-bind-key end-of-line             "end"
    global-bind-key undo                    "f4"
    !if &seq %emulate "ERROR"
        global-bind-key comment-adjust      "esc tab"
        global-bind-key comment-adjust      "C-insert"
        ; Like a korn shell please.
        ml-bind-key tab "esc esc"
    !endif
    ;
    ; Setup for windows and UNIX.
    ;
    ; Define my hilighting colour for Windows and UNIX.
    !if &equ &band $system 0x001 0
        !if &not &seq $platform "win32"
            ; Small bold font is better for me.
            change-font "-*-clean-medium-r-*-*-*-130-*-*-*-*-*-*"
        !endif
    !endif
    ; Change the default diff command-line for GNU diff utility all platforms
    set-variable %diff-com "diff --context --minimal --ignore-space-change --report-identical-files --recursive"
    set-variable %gdiff-com "diff --context --ignore-space-change -w"
    ; Setup for cygwin
    !if &seq $platform "win32"
        set-variable %cygwin-path "c:/cygwin"
        set-variable %cygwin-hilight 1
    !endif
    ; Set up the ftp flags. The letters have the following meaning:
    ; c   - Create a console (*ftp-console* for ftp, *http-console* for http)
    ; s   - Show the console
    ; p   - Show download progress ('#' every 2Kb downloaded)
    set-variable %ftp-flags "csp"
    ; Info files
    ;To hilight the .info and also the dir file
    add-file-hook ".info dir"                                   fhook-info   ; Info-files
    ;To hilight all info files without the extension .info
    ;but starting with the text "This is info file..
    -2 add-file-hook "This is Info file"                        fhook-info

    ; Finished
    ml-write "Configured to Jon's requirements"

## SEE ALSO

user-setup(3), $search-path(5), $user-name(5), $user-path(5), $MEINSTALLPATH(5), $MENAME(5), $MEPATH(5), $MEUSERPATH(5), me32.ini(8), Company Profiles, File Hooks, File Language Templates, Installation.

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>