GNU Emacs Notes

[Updated Monday, September 29, 2008 1230 IST]

color and theme

;; settings
(setq line-number-mode t)
(setq column-number-mode t)
(global-font-lock-mode t)
(setq-default transient-mark-mode t)

;; set colors
(set-background-color "Black")
(set-foreground-color "White")

;; set font for X
(set-default-font "8x13")

;; color theme
(require 'color-theme)
(setq color-theme-is-global t)

don't echo passwords

;; Don't echo passwords
(add-hook 'comint-output-filter-functions


erc setup in ~/.emacs. Using GNU Emacs 22 on Debian Lenny.

;; erc
(defun erc-start ()
(setq erc-echo-notices-in-minibuffer-flag t)
(require 'erc)

;; require erc-match
(require 'erc-match)
(setq erc-keywords '("resolve" "mbuf"))
(setq erc-current-nick-highlight-type 'nick)
(setq erc-track-exclude-types '("JOIN" "PART" "QUIT" "NICK" "MODE"))
(setq erc-track-use-faces t)
(setq erc-track-faces-priority-list
     '(erc-current-nick-face erc-keyword-face)) (setq erc-track-priority-faces-only 'all)

;; erc scroll to bottom
(setq erc-input-line-position -2)
(setq erc-echo-notices-in-minibuffer-flag t)

;; Connect (setq erc-autojoin-channels-alist
     '(("" "##linux-india" "#dgplug" "#gnu" "#gnu-india"
     "" "#p52" "#hurd" "#openmoko" "#maemo" "#linuxtag" "#edev"
     "#poky" "#indlinux" "#qtopia" "#git" "#sjce" "#openmoko-cdevel")))
(erc :server "" :port 6667 :full-name "Shakthi Kannan"
     :nick "mbuf"))

To identify use:

M-x erc-nickserv-identify

To list channel names:

M-x erc-channel-names

To quit the server connection, use:

M-x erc-quit-server



Download and extract git-emacs from emacs-git.

Add the following to ~/.emacs

(add-to-list 'load-path "~/installs/emacs/elisp/git-emacs-1.1" t)
(require 'git-emacs)

no toolbar

;; No toolbar
(tool-bar-mode -1)

python mode

Download python-mode from

Patch with:

patch -p0 < python-mode.el.diff

Add the following to ~/.emacs:

;; Python mode support
(add-to-list 'load-path "~/installs/emacs/elisp/python-mode-1.0" t)
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

To enter Python mode, use:

M-x python-mode


sudo within emacs

(require 'tramp)
(setq tramp-default-method "scp")

To access file that requires sudo permission, use:

C-x C-f /sudo::/etc/resolv.conf

X11 pasting

;; X11 paste key-binding
(setq x-select-enable-clipboard t)
(global-set-key "\C-y" 'clipboard-yank)