Setup Editor

See also SetupVim.


(setq user-full-name "Stefan van der Walt")
(setq user-mail-address "")
(setq display-time-24hr-format t)

(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(mouse-avoidance-mode 'jump)
(setq fill-column 79)
(setq visible-bell t)
(setq indent-tabs-mode nil)
(column-number-mode t)
(mouse-wheel-mode t)
(tool-bar-mode nil)
;(menu-bar-mode nil)

(add-hook 'text-mode-hook 'turn-on-auto-fill)


(when (memq system-type '(windows-nt))
  (setq ispell-program-name "c://progra~1//aspell//bin//aspell"))
(when (memq system-type '(gnu/linux))
  (setq ispell-program-name "/usr/bin/aspell"))

(setq ispell-dictionary "british")
(setq ispell-local-dictionary "british")

(setq auto-mode-alist
      (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
      (cons '("python" . python-mode)

(autoload 'python-mode "python-mode" "Python editing mode." t)
(require 'rst)
(add-hook 'text-mode-hook 'rst-text-mode-bindings)

(add-hook 'c++-mode-hook
          (lambda ()
            (setq c-basic-offset 4)))

(add-hook 'c-mode-hook
          (lambda ()
            (setq c-basic-offset 4)))

;(set-default-font "-adobe-courier-medium-r-normal-*-14-*-*-*-*-*-*-*")

(require 'python-mode)
(setq ipython-command "/home/stefan/bin/ipython")
(require 'ansi-color)
(require 'ipython)

;; remember recently edited files
(require 'recentf)
(recentf-mode 1)



Emacs font issues

After upgrading to Edgy, emacs displayed little boxes instead of letters. While I am all for creative usage of new fonts, this wasn't very productive. Strangely, the problem was with the font directories in /etc/X11/xorg.conf, where I had to change all paths with symbolic links to their real locations, i.e.

FontPath "/usr/share/X11/fonts/misc"


FontPath "/usr/share/fonts/X11/misc"

(swap fonts and X11). Run

xset fp rehash

or restart the X-server.

Emacs and XFT


Feisty+1 should contain correctly functioning emacs. Nope, looks like Gutsy+1.


Download from

(autoload 'javascript-mode "javascript" nil t)
(add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))

Opening externally handled files

(defun define-trivial-mode(mode-prefix file-regexp &optional command)
  (or command (setq command mode-prefix))
  (let ((mode-command (intern (concat mode-prefix "-mode"))))
    (fset mode-command
          `(lambda ()
             (toggle-read-only t)
             (start-process ,mode-prefix nil
                            ,command (buffer-file-name))
             (kill-buffer (current-buffer))))
    (add-to-list 'auto-mode-alist (cons file-regexp mode-command)))

(define-trivial-mode "gv" "\\.ps$")
(define-trivial-mode "evince" "\\.pdf$")

Run the emacs server


IanKnot rainbow -->