Please bear with us as we work to restore functionality to dotfiles.org.
My GNU Emacs configuration. I use Emacs, mainly, to program in Python. I use emacs-snapshot.
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(column-number-mode t)
'(current-language-envinronment "UTF-8")
'(current-language-environment "UTF-8")
'(display-time-mode t)
'(save-place t nil (saveplace))
'(scroll-bar-mode (quote right))
'(show-paren-mode t)
'(size-indication-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; Common Lisp
(require 'cl)
(defvar devdir "~/dev/")
(defvar svndir (concat devdir "svn/"))
(defvar gitdir (concat devdir "git/"))
(defvar eldir (concat devdir "emacs/"))
(defvar ctdir (concat eldir "color-theme/"))
(labels ((add-path (p)
(add-to-list 'load-path p)))
(add-path devdir)
(add-path (concat svndir "python2.6/Misc/"))
(add-path (concat gitdir "Io/extras/SyntaxHighlighters/Emacs/"))
(add-path eldir)
(add-path ctdir))
(defun safe-load (library)
(condition-case err
(load-library library)
(error
(progn
(message "Failed to load %s: %s" library err)
(sleep-for 6)))))
(mapcar
'safe-load
'("python-mode"
"color-theme"
;"django-html-mode"
"io-mode"
"rst"
))
;; ident io code with 4 spaces
(setq io-mode-indent-offset 4)
(setq auto-mode-alist
(append '(("\\.rst$" . rst-mode)
("\\.rest$" . rst-mode)
("\\.txt$" . rst-mode)) auto-mode-alist))
;; kill messages buffer
;; comment to debug
(setq message-log-max nil)
(kill-buffer "*Messages*")
;; Fullscreen editing
(defun fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen
(if (frame-parameter nil 'fullscreen) nil 'fullboth)))
(global-set-key [f11] 'fullscreen)
;; My simple color theme
(defun my-color-theme ()
(interactive)
(color-theme-install
'(my-color-theme
((background-color . "black")
(foreground-color . "white")
(cursor-color . "green")
(mouse-color . "green")
(background-mode . dark)))))
(my-color-theme)
;;; Python
;; Pymacs and autocomplete
;(require 'pycomplete)
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
;(autoload 'pymacs-load "pymacs" nil t)
;(autoload 'pymacs-eval "pymacs" nil t)
;(autoload 'pymacs-apply "pymacs")
;(autoload 'pymacs-call "pymacs")
(setq interpreter-mode-alist(cons '("python" . python-mode)
interpreter-mode-alist))
(setq python-mode-hook
'(lambda () (progn
(set-variable 'py-python-command "/usr/bin/python2.5")
(set-variable 'py-indent-offset 4)
(set-variable 'py-smart-indentation nil)
(set-variable 'indent-tabs-mode nil))))
;; Highlight long lines on python mode
(font-lock-add-keywords
'python-mode
'(("^[^\n]\\{80\\}\\(.*\\)$"
1 font-lock-warning-face prepend)))
;; XFont config
(set-default-font "Bitstream Vera Sans Mono-12")
(set-fontset-font (frame-parameter nil 'font)
'han '("cwTeXHeiBold" . "unicode-bmp"))
;;; Other little options
(column-number-mode t)
(setq inhibit-startup-message t)
(setq font-lock-maximum-decoration t)
;; Scroll 1 line
(progn (setq scroll-step 1)
(setq scroll-preserve-screen-position t)
(setq scroll-conservatively 9999))
;; Screw up memory usage
(setq gc-cons-threshold 4000000)
;; No new lines at the end
(setq next-line-add-newlines nil)
;; Do not use tabs!
(setq-default indent-tabs-mode nil)
;; TAB => 4*'\b'
(setq default-tab-width 4)
;; delete \b at line ends before saving a file
(add-hook 'write-file-hooks 'delete-trailing-whitespace)
;; Set [FLAG]-X as M-X
(global-set-key (quote [8388728]) (quote execute-extended-command))
;; Shhhh!
(setq visible-bell t)
;; answer with y or n instead of yes or no
(fset 'yes-or-no-p 'y-or-n-p)
;; keep backups at ~/.backups/
(defun make-backup-file-name (file-name)
"Create the non-numeric backup file name for `file-name'."
(require 'dired)
(if (file-exists-p "~/.backups")
(concat (expand-file-name "~/.backups/")
(dired-replace-in-string "/" "|" file-name))
(concat file-name "~")))
;; case insensitive searches
(set-default 'case-fold-search t)
;; TRAMP for SSH
(setq tramp-default-method "ssh")
;; date and time
(setq display-time-day-and-date t)
(display-time)
;; reconizes Camelcase on python-mode
(add-hook 'python-mode-hook
(lambda () (c-subword-mode 1)))
;; "C-x r j e" (jump to register "e") to open this file
(set-register ?e '(file . "~/.emacs"))
;; highlight current line
(global-hl-line-mode)
;; "C-x C-l" & "C-x C-u"
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
;; "C-x n n" & "C-x n w"
(put 'narrow-to-region 'disabled nil)
;; Typed text replaces the selection if the selection is active
(delete-selection-mode 1)
;; delete old backups
(setq delete-old-versions t)
;; bind C-x b to iswitchb-mode
(iswitchb-mode)
;; reST as default mode
;(setq default-major-mode 'rst-mode)
;(setq initial-major-mode 'rst-mode)
(defun scroll-up-in-place (n)
(interactive "p")
(scroll-up n))
(defun scroll-down-in-place (n)
(interactive "p")
(scroll-down n))
(define-key global-map [(shift next)] 'scroll-up-in-place)
(define-key global-map [(shift prior)] 'scroll-down-in-place)
;; Save the mnibuffer history
(savehist-mode 1)
;; To use emacs client
(server-start)