8.4 Installation

8.4.1 Directory Structure

Create the following directory structure in your home directory:

/home/<username>/.emacs 
/home/<username>/.emacs.d/elegant/

The files required are:

~/.emacs 
~/.emacs.d/elegant/elegant-mode.el 
~/.emacs.d/elegant/elegant-namelists.el

8.4.2 Step 1: Generate Namelist Tables

This part is usually done by the elegant developers. If you install elegant from source, you may also wish to do this step. Use the provided Python script (in elegantTools):

cat *.nl > elegant-namelists.txt 
python3 gen_elegant_elisp.py elegant-namelists.txt \ 
 > ~/.emacs.d/elegant/elegant-namelists.el

This creates:

These are required for completion.

8.4.3 Step 2: Install elegant-mode.el

Copy the provided elegant-mode.el file into:

~/.emacs.d/elegant/

8.4.4 Step 3: Configure Emacs

Edit or create:

/home/<username>/.emacs

Add:
(add-to-list load-path " /.emacs.d/elegant")
(load "elegant-namelists.el" nil t)
(load "elegant-mode.el" nil t)
(add-to-list auto-mode-alist ("\\.ele\\" . elegant-mode))
(setq completion-cycle-threshold 1)
(setq tab-always-indent complete)
(define-key global-map (kbd "TAB") #completion-at-point)

8.4.5 Step 4: Restart Emacs

Start Emacs normally:

emacs run.ele

The mode line should display elegant. To confirm correct installation:

1.
Open a .ele file.
2.
Type &run_setup and press RET.
3.
Confirm that &end is inserted automatically.
4.
Type part of a qualifier and press TAB.
5.
Confirm completion suggestions appear.