Nov 15 2006

Emacs Configuration

Published by at 12:00 am under Misc

Emacs is a very powerful editor available on all UNIX plate-formes and even Windows but it usually needs a bit of tweaking to get some features activated. Check the manual to get a complete list of options. Here’s a small .emacs file that you can place in your home root directory to activate colors for example when opening perl or C files. Emacs detects the extension of the file and switch to the appropriate mode.

        ;; Syntax hilighting!!
        (global-font-lock-mode t)

        ;; Hilight matching parenthesis
        (show-paren-mode 1)

        ;; fix missing INSERT key to toggle overwrite-mode on the console
        (global-set-key [insertchar] 'overwrite-mode)

        ;; Perl
        ;; Enable colors and "cperl" mode
        (add-to-list 'auto-mode-alist '("\\.pl$" . cperl-mode))
        (add-to-list 'auto-mode-alist '("\\.pm$" . cperl-mode))
        (add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))

        ;; This requires special setup by calling loadkeys(1) from .profile!
        (global-set-key (kbd "ESC [ M") 'dabbrev-expand)

        ;; remove underscore for whitespace
        ;; This is annoying as Perl contains a lot of underscores
        (setq cperl-invalid-face nil)

There is much more you can add into this file but this answers most of my needs.

No responses yet

Comments RSS

Leave a Reply