Emacs: dotemacs

advertisement
;; rename this file to .emacs and save as ~/.emacs
;; ---------------------------------------------------------------------------;; Additonal Packages
;; ---------------------------------------------------------------------------(add-to-list 'load-path "/home/parijat/.emacs.d")
; (push "/home/parijat/lisp/clbuild/source/slime" load-path)
;; Start EmacsClient server
(server-start)
;; ---------------------------------------------------------------------------;; GUI stuff
;; ---------------------------------------------------------------------------; (tool-bar-mode 1)
;; turn it ON
(tool-bar-mode -1)
;; turn it OFF
; (scroll-bar-mode 1)
;; turn it ON
(scroll-bar-mode -1)
;; turn it OFF
(menu-bar-mode 1)
;; turn it ON
; (menu-bar-mode -1)
;; turn it OFF
; (column-number-mode -1)
;; turn it OFF
(column-number-mode 1)
;; turn it ON
; (mouse-wheel-mode -1)
;; turn it OFF
(mouse-wheel-mode 1)
;; turn it ON
; (tabbar-mode -1)
;; turn OFF tabs
(tabbar-mode 1)
;; turn on tabs
(global-font-lock-mode 1)
;; font highlighting for all buffers
;; ---------------------------------------------------------------------------;; TRAMP
;; ---------------------------------------------------------------------------(require 'tramp)
;; ---------------------------------------------------------------------------;; Colors and Fonts
;; ---------------------------------------------------------------------------(require 'color-theme)
(color-theme-euphoria)
;; International Fonts
(add-to-list 'bdf-directory-list "/usr/share/emacs/fonts/bdf")
;; ---------------------------------------------------------------------------;; Code indenting customizations
(require 'show-wspace) ;; library show-wspace for further use
(add-hook 'font-lock-mode-hook 'show-ws-highlight-tabs)
(add-hook 'font-lock-mode-hook 'show-ws-highlight-trailing-whitespace)
(add-hook 'font-lock-mode-hook 'highlight-beyond-fill-column)
(require 'pair-mode) ;; make pair-mode available for further modes
;; ---------------------------------------------------------------------------;; Common Lisp Mode
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(add-to-list 'auto-mode-alist '("\\.lisp$" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.cl$" . lisp-mode))
(add-to-list 'auto-mode-alist '("\\.asd$" . lisp-mode))
(require 'slime)
(slime-setup)
(eval-after-load "slime"
'(progn
(setq slime-complete-symbol*-fancy t
slime-complete-symbol-function 'slime-fuzzy-complete-symbol
slime-when-complete-filename-expand t
slime-truncate-lines nil
slime-autodoc-use-multiline-p t)
(slime-setup '(slime-fancy slime-asdf))
(define-key slime-repl-mode-map (kbd "C-c ;")
'slime-insert-balanced-comments)
(define-key slime-repl-mode-map (kbd "C-c M-;")
'slime-remove-balanced-comments)
(define-key slime-mode-map (kbd "C-c ;")
'slime-insert-balanced-comments)
(define-key slime-mode-map (kbd "C-c M-;")
'slime-remove-balanced-comments)
(define-key slime-mode-map (kbd "RET") 'newline-and-indent)
(define-key slime-mode-map (kbd "C-j") 'newline)))
(add-hook 'lisp-mode-hook (lambda ()
(cond ((not (featurep 'slime))
(require 'slime)
(normal-mode)))
(indent-tabs-mode nil)
(pair-mode t)))
;; ---------------------------------------------------------------------------;; Emacs Lisp Mode
(add-hook 'emacs-lisp-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)))
;; ---------------------------------------------------------------------------;; C/C++/Java
(require 'cc-mode)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
(add-hook 'c-mode-common-hook
'(lambda ()
(setq tab-width 4
c-basic-offset 4)
(setq indent-tabs-mode nil)
(pair-mode t)
(hs-minor-mode)
t))
;; ---------------------------------------------------------------------------;; PHP mode
(add-hook 'php-mode-hook
'(lambda ()
(setq tab-width 4
c-basic-offset 4
c-hanging-comment-ender-p nil)
(pair-mode t)
t))
(add-to-list 'auto-mode-alist '("/adcache/php" . php-mode))
;; ---------------------------------------------------------------------------;; Python mode
(add-hook 'python-mode-hook
'(lambda ()
(pair-mode t)
(define-key python-mode-map (kbd "RET") 'newline-and-indent)
(define-key python-mode-map (kbd "C-j") 'newline)
(hs-minor-mode)
t))
;; ---------------------------------------------------------------------------;; Mako Templates used with Pylons
(add-to-list 'auto-mode-alist '("\\.mako\\'" . nxml-mode))
(autoload 'nxml-mode "nxml-mode" "X(HT)ML editing mode")
;; ---------------------------------------------------------------------------;; Erlang mode
(require 'erlang-start)
(push "/home/parijat/.emacs.d/distel/elisp/" load-path)
(require 'distel)
(distel-setup)
;; Some customizations
(add-hook 'erlang-mode-hook
(lambda ()
;; when starting an Erlang shell in Emacs, the node name
;; by default should be "emacs"
(setq inferior-erlang-machine-options '("-sname" "emacs"))
;; add Erlang functions to an imenu menu
(imenu-add-to-menubar "imenu")))
;; ----------------------------------------------------------------------------
;; Parijat's key bindings
;; ---------------------------------------------------------------------------; Bind C-c g to goto-line
(global-set-key "\C-cg" 'goto-line)
; Prefer backward-kill-word to pressing backspace all the time
(global-set-key "\C-w" 'backward-kill-word)
; But then, I have to set some other key for kill-region
(global-set-key "\C-x\C-k" 'kill-region)
; change default expansion to hippie-expang
(global-set-key "\M-/" 'hippie-expand)
; Hide/Show minor mode keybindings
(global-set-key (kbd "C-c <left>") 'hs-hide-block)
(global-set-key (kbd "C-c <right>") 'hs-show-block)
;; ---------------------------------------------------------------------------;; Org mode, installed by hand
;; ---------------------------------------------------------------------------(add-to-list 'load-path "/home/parijat/.emacs.d/org-mode/lisp")
(add-to-list 'load-path "/home/parijat/.emacs.d/org-mode/contrib/lisp")
(require 'org-install)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(add-to-list 'auto-mode-alist '("\\.txt$" . org-mode))
;; I will incomment this if I use session.el
;; (add-to-list 'session-globals-excldue 'org-mark-ring)
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(define-key global-map "\C-cl" 'org-store-link)
(define-key mode-specific-map [?a] 'org-agenda)
(eval-after-load "org"
'(progn
(define-prefix-command 'org-todo-state-map)
(define-key org-mode-map "\C-cx" 'org-todo-state-map)
(define-key org-todo-state-map "x"
#'(lambda nil (interactive) (org-todo "CANCELLED")))
(define-key org-todo-state-map "d"
#'(lambda nil (interactive) (org-todo "DONE")))
(define-key org-todo-state-map "f"
#'(lambda nil (interactive) (org-todo "DEFERRED")))
(define-key org-todo-state-map "l"
#'(lambda nil (interactive) (org-todo "DELEGATED")))
(define-key org-todo-state-map "s"
#'(lambda nil (interactive) (org-todo "STARTED")))
(define-key org-todo-state-map "w"
#'(lambda nil (interactive) (org-todo "WAITING")))))
(eval-after-load "org-agenda"
'(progn
(define-key org-agenda-mode-map "\C-n" 'next-line)
(define-key org-agenda-mode-map "\C-p" 'previous-line)
(define-key org-agenda-keymap "\C-p" 'previous-line)))
(add-hook 'remember-mode-hook 'org-remember-apply-template)
(define-key global-map [(control meta ?r)] 'remember)
;; ---------------------------------------------------------------------------;; Emacs Customization using Custom Package
;; ---------------------------------------------------------------------------(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.
'(c-default-style (quote ((c-mode . "k&r") (c++-mode . "k&r") (objc-mode
. "k&r") (java-mode . "java") (awk-mode . "awk") (other . "gnu"))))
'(case-fold-search t)
'(color-theme-is global)
'(color-theme-is-cumulative nil)
'(column-number-mode t)
'(current-language-environment "UTF-8")
'(default-input-method "rfc1345")
'(ecb-eshell-auto-activate nil)
'(ecb-eshell-enlarge-when-eshell nil)
'(ecb-layout-name "leftright1")
'(ecb-options-version "2.32")
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--mouse-2))
'(ecb-process-non-semantic-files nil)
'(ecb-source-path (quote (("/" "/")
("/home/parijat/workspace/couffable/branches/release-3-11" "r311"))))
'(ecb-tree-buffer-style (quote ascii-guides))
'(ecb-vc-directory-exclude-regexps (quote ("vendor")))
'(ecb-vc-enable-support t)
'(ecb-windows-width 0.2)
'(fill-column 80)
'(highlight-current-line-globally t nil (highlight-current-line))
'(indent-tabs-mode nil)
'(indicate-buffer-boundaries (quote right))
'(org-agenda-compact-blocks t)
'(org-agenda-files (quote ("~/Documents/org/todo.org"
"~/Documents/org/home.org")))
'(org-agenda-ndays 7)
'(org-agenda-show-all-dates t)
'(org-agenda-skip-deadline-if-done t)
'(org-agenda-skip-scheduled-if-done t)
'(org-agenda-start-on-weekday nil)
'(org-blank-before-new-entry (quote ((heading . t) (plain-list-item))))
'(org-deadline-warning-days 14)
'(org-default-notes-file "~/Documents/org/notes.org")
'(org-fast-tag-selection-single-key (quote expert))
'(org-log-done t)
'(org-remember-store-without-prompt t)
'(org-remember-templates (quote ((116 "* TODO %?
%u" "~/Documents/org/todo.org" "Tasks") (110 "* %u %?"
"~/Documents/org/notes.org" "Notes"))))
'(org-reverse-note-order t)
'(org-todo-keywords (quote ("TODO" "DELEGATED" "STARTED" "WAITING" "|"
"CANCELLED" "DONE" "DEFERRED")))
'(pair-mode-chars (quote (40 91 123 2219 96 39 34)))
'(python-guess-indent nil)
'(python-indent 4 nil nil "Save explicitly rather than depend on the
default.")
'(remember-annotation-functions (quote (org-remember-annotation)))
'(remember-handler-functions (quote (org-remember-handler)))
'(safe-local-variable-values (quote ((py-indent-offset . 4))))
'(semanticdb-default-save-directory "/tmp" t)
'(show-paren-mode t nil (paren))
'(slime-backend "swank-loader.lisp")
'(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
'(transient-mark-mode t)
'(weblogger-config-alist (quote (("pm@wp" ("user" . "parijatmishra")
("server-url" . "http://parijatmishra.wordpress.com/xmlrpc.php")
("weblog" . "3282491")) ("pm@blogger" ("user" . "parijat.mishra")
("server-url" . "http://www.blogger.com/api") ("weblog" .
"4489744187593527994"))))))
(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.
'(ecb-tag-header-face ((((class color) (background dark)) (:background
"dark slate gray" :weight bold :height 1.2))))
'(highlight-current-line-face ((t (:background "gray10"))))
'(show-ws-tab ((t (:background "LemonChiffon"))))
'(tabbar-default ((((class color grayscale) (background dark)) (:inherit
variable-pitch :background "light gray" :foreground "gray40" :box (:linewidth 1 :color "gray90" :style released-button) :overline "gray90"
:underline "gray90" :weight bold :height 1.0))))
'(tabbar-selected ((t (:inherit tabbar-default :foreground "black" :box
(:line-width 1 :color "gray90" :style pressed-button)))))
'(tabbar-unselected ((t (:inherit tabbar-default)))))
Download