Emacs can be configured to add a trailing newline by updating ~/.emacs as follows:
(setq require-final-newline t)
dot-emacseditorselispemacsnewline
To change the color of a particular face (e.g. font-lock-comment-face), use this elisp (editing where necessary):
(custom-set-faces '(font-lock-comment-face ((t (:foreground "lightblue" (background light)))) ) )
lightblue and other color names are defined in rgb.txt, included with your emacs and X installations.
colorsconfigurationeditorselispemacsx11
To set your own global keybinding to a function, use global-set-key in your ~/.emacs as follows:
(global-set-key "C-cl" 'enlarge-window-horizontally)
configurationdot-emacseditorselispemacskeystrokes
Use this in your ~/.emacs to bind a key to goto-line:
(global-set-key "C-cl" 'goto-line)
configurationdot-emacseditorselispemacskeystrokes
Emacs features a minor mode, mouse-avoidance-mode, which causes the mouse to move away from the Emacs point when the point gets too close. This can be really helpful if you're used to moving your mouse away from the cursor to avoid typing "underneath" the mouse. In your custom-set-variables section in ~/.emacs, add the appropriate elisp:
(custom-set-variables . . '(mouse-avoidance-mode (quote animate) nil (avoid)) . .
The animation parameters of mouse-avoidance-mode can be customized with M-x customize.
configurationeditorselispemacsmouseneat
If you use middle-clicking to paste into Emacs windows but don't like how the paste occurs at the click location and would rather paste at point, use this in your ~/.emacs:
(setq mouse-yank-at-point t)
Thanks to Kevin Turner for pointing this out.
configurationdot-emacseditorselispemacsmousepointyank
If you wish for a particular file to be handled with a mode that isn't already associated with its extension, you may put a header like this anywhere in the file:
-*- mode: outline; mode: auto-fill -*-
Alternatively, you can update your ~/.emacs to use modes based on file extension or filename. For example, to use html-mode for files ending in .tpl:
(setq auto-mode-alist
(cons '("\\.tpl$" . html-mode) auto-mode-alist))
You can also configure Emacs to use a specific major and minor mode together for a given file extension. This example defines my-mode to load outline-mode (a major mode) and auto-fill-mode (a minor mode) for files ending in .foo:
(defun my-mode ()
(outline-mode)
(auto-fill-mode))
(setq auto-mode-alist
(append '(("\\.foo$" . my-mode))
auto-mode-alist))
configurationdot-emacseditorselispemacs
Use this elisp snippet (in your ~/.emacs) to instruct your Emacs python-mode to use the proper python executable on a system with multiple pythons installed:
(setq py-python-command "/usr/bin/python2.3")
dotemacselispemacsinterpreterinvocationlanguagesprogrammingpython