Customizing EMACS

Emacs can we programmed in Lisp (actually, Elisp, a version of Lisp tailored for Emacs). All the lines below are in this language.
Here is a link describing Elisp.
You can find Elisp discussed in the Info pages under Emacs: check Emacs Lisp (if the documentation was installed), or Customization for a few examples etc.

You may want to have some features as the default when you start Emacs. This can be achieved by requesting them in the file  ~/.emacs , which is read each time Emacs starts.
Changes to this file made after Emacs started can be activated by loading the file again; use the command load-file (you can invoke it with M-x).

This is a Lisp file. The last line should end with a RETURN.
Comments begin with ;.

On newer versions of Emacs one can customize most features through a dialog-box. Try the command customize, or customize-browse. The latter will allow you to browse through the available features (e.g., TeX is under Wp, word processing).
You can also find these commands in the Help menu of Emacs.

To change colors/fonts etc. for the current session, you can access a few menus using CONTROL or SHIFT and a mouse button.


Below are a few basic features that you might find useful.
Create the file  ~/.emacs  (if it does not exist already) and add at the end the following lines:


(setq tex-dvi-view-command "xdvi")
		; define the command to view DVI-files

(setq tex-dvi-print-command "dvips")
		; define the command to print DVI-files

(add-hook 'text-mode-hook 'turn-on-auto-fill)
		; break lines at space when they are too long

(transient-mark-mode 1)
		; highlight the region whenever it is active

(add-hook 'comint-output-filter-functions 'comint-watch-for-password-prompt)
		; notice password prompts and turn off echoing for them

(auto-compression-mode t)
		; uncompress files before displaying them

(global-font-lock-mode t)
		; use colors to highlight commands, etc.

(set-variable 'font-lock-maximum-decoration nil)
		; maximum-decoration set to nil to use the default
		;	decoration (typically the minimum available)
		; you can comment out this command with a semicolon
		; see mode-specific variations in the description of
		;	font-lock-maximum-decoration by typing
		;	C-h v font-lock-maximum-decoration RETURN






If you want to use the AUCTeX package, which offers help writing LaTeX and many other TeX-related commands, you can add the line


(require 'tex-site)
		; invoke the AUCTeX package (LaTeX support)

See more about AUCTeX in the AUCTeX section of this chapter, and in the Fancy Stuff section of the LaTeX chapter.

NOTE HOWEVER:


You can set colors, fonts etc. (these are just examples, choose your own preferences).
Note that you can change the font for the current session by pressing SHIFT and the LEFT-MOUSE-BUTTON.
Various other choices can be made by pressing CONTROL and one of the MOUSE-BUTTONS.
To see what fonts are available, you can use the Linux command xfontsel.

You can also customize colors/faces via the customization commands mentioned at the beginning, or the Help menu of Emacs.

(set-background-color "black")
(set-foreground-color "yellow")
(set-cursor-color "blue")
(set-default-font "lucidasanstypewriter-14")
REMARK: on the version of KDE used currently in the department, you might not obtain the desired colors, because KDE interferes with the highlighting.
To change this, open the Control Center, choose "Look & Feel", then "Style" and uncheck "Apply fonts and colors to non-KDE apps".

You can also change the meaning of various keys.
For example, this will make the DELETE key erase the characted on which the cursor is (instead of the one on its left; the default binding is delete-backward-char).


(global-set-key [delete] 'delete-char)


If you invoke  tex  (or  latex)  from the TeX menu of Emacs and prefer that they stop at each error, you can add the next line:


(add-hook 'tex-mode-hook '(lambda () (setq tex-start-options-string nil)))
		; stop at each tex (or latex) error

Note that the default value - if defined at all - of tex-start-options-string is "\\nonstopmode\\input", which - as it says - makes the compilation run "nonstopmode".