Skip to content

Instantly share code, notes, and snippets.

@death
Created December 16, 2010 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save death/743704 to your computer and use it in GitHub Desktop.
Save death/743704 to your computer and use it in GitHub Desktop.
my leim dotemacs (w/ minor changes to protect the innocent)
;;;; General
(menu-bar-mode 0)
(scroll-bar-mode -1)
(set-default-font "-xos4-terminus-medium-r-normal--16-160-72-72-c-80-iso10646-1")
(tool-bar-mode 0)
(setq inhibit-splash-screen t)
(setq initial-scratch-message nil)
(add-to-list 'load-path "~/emacs/")
(column-number-mode 1)
(display-time-mode 1)
(setq display-time-24hr-format t)
(require 'iswitchb)
(iswitchb-mode 1)
(setq-default indent-tabs-mode nil)
(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)
(setq-default auto-fill-function nil)
(show-paren-mode t)
(transient-mark-mode t)
(setq scroll-conservatively 1000)
(setq enable-local-variables :safe)
(setq Info-directory-list
'("~/emacs/info"
"/usr/local/share/info"
"/usr/share/info"))
(put 'narrow-to-page 'disabled nil)
(setq ring-bell-function (lambda ()))
;;; We don't need no stinkin' customization
(setq custom-file "~/.emacs-custom.el")
(setq recenter-positions '(middle))
;;; Don't use any pager to filter git output
(setenv "PAGER" "")
(defvar non-chance-buffers
'("*slime-repl sbcl*" "*slime-scratch*" "*slime-events*" "*inferior-lisp*"
"*scratch*" "*Messages*" "*w3m*" "*Mingus*"))
(defun kill-chance-buffers ()
(interactive)
(dolist (buffer (buffer-list))
(let ((name (buffer-name buffer)))
(when (and name
(not (string-equal name ""))
(/= (aref name 0) ? )
(not (member name non-chance-buffers)))
(kill-buffer buffer)))))
(defun kill-all-dired-buffers ()
(interactive)
(dolist (buffer dired-buffers)
(kill-buffer (cdr buffer))))
(setq dired-listing-switches "--group-directories-first --time-style=long-iso -alD")
(defun delete-indentation-forward ()
(interactive)
(delete-indentation t))
(global-set-key [(meta ?j)] 'delete-indentation-forward)
(load "auto-tags")
(autoload 'lisppaste "lisppaste" "Interact with the lisppaste pastebot via XML-RPC." t)
(autoload 'lisppaste-region "lisppaste" "Paste a region using lisppaste." t)
(autoload 'siyobik "siyobik" "Paste using siyobik." t)
(setq kill-buffer-query-functions
(remove 'process-kill-buffer-query-function
kill-buffer-query-functions))
(add-hook 'shell-mode-hook
(lambda ()
(local-set-key "\C-\M-f" 'find-file-at-point)))
;;;; Common Lisp
(add-to-list 'load-path "~/lisp/slime/contrib/")
(add-to-list 'load-path "~/lisp/slime/")
(require 'slime)
(setq lisp-simple-loop-indentation 1)
(setq lisp-loop-forms-indentation 6)
(setq lisp-loop-keyword-indentation 6)
(load "cl-indent")
(slime-setup '(slime-asdf
slime-autodoc
slime-banner
slime-clipboard
slime-c-p-c
slime-editing-commands
slime-fancy-inspector
slime-fontifying-fu
slime-package-fu
slime-parse
slime-presentations
slime-references
slime-scratch
slime-repl
))
(setq slime-fortune-pathname "lambda")
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
(setq inferior-lisp-program "sbcl")
(setq slime-net-coding-system 'utf-8-unix)
(setq slime-complete-symbol-function 'slime-complete-symbol*)
(setq slime-enable-evaluate-in-emacs t)
(setq slime-ed-use-dedicated-frame nil)
(add-hook 'hack-local-variables-hook (lambda () (kill-local-variable 'package)))
(global-set-key "\C-cs" 'slime-selector)
(push '("\\.cl\\'" . lisp-mode) auto-mode-alist)
(setq common-lisp-hyperspec-root "file:/home/death/lisp/HyperSpec/")
(require 'parenface)
(require 'pretty-lambdas)
(autoload 'paredit-mode "paredit"
"Minor mode for pseudo-structurally editing Lisp code."
t)
(autoload 'redshank-mode "redshank"
"Minor mode for editing and refactoring (Common) Lisp code."
t)
(autoload 'turn-on-redshank-mode "redshank"
"Turn on Redshank mode. Please see function `redshank-mode'."
t)
(add-hook 'slime-repl-mode-hook
(lambda ()
(local-set-key "\C-c\C-t" 'slime-repl-clear-buffer)))
(fset 'compile-slime
[?\C-x ?\C-f ?~ ?/ ?l ?i ?s ?p ?/ ?s ?l ?i ?m ?e return ?% ?m
?\\ ?. ?e ?l ?$ return ?B ?y C-home ?\C-s ?c ?o ?n ?t
?r ?i ?b ?\C-m return ?% ?m ?\\ ?. ?e ?l ?$ return ?B ?y])
;; The same as the original one, except for the fact that it doesn't
;; recenter.
(defun slime-repl-show-maximum-output ()
"Put the end of the buffer at the bottom of the window."
(when (eobp)
(let ((win (if (eq (window-buffer) (current-buffer))
(selected-window)
(get-buffer-window (current-buffer) t))))
(when win
(with-selected-window win
(set-window-point win (point-max)))))))
;;;; w3m
(add-to-list 'load-path "/usr/share/emacs/site-lisp/w3m/")
(require 'w3m-load)
(setq browse-url-browser-function 'w3m-browse-url)
(setq w3m-enable-google-feeling-lucky nil)
(setq w3m-key-binding nil)
;;;; Browse-file support for Dired
(add-hook 'dired-mode-hook (lambda () (local-set-key "b" 'browse-dired-file)))
(autoload 'chm-view-internal "chm-view")
(defun browse-dired-file ()
(interactive)
(let* ((file (dired-get-filename))
(ext (file-name-extension file)))
(if (string= ext "chm")
(chm-view-internal file)
(browse-url-of-file file))))
;;;; Gnus
(setq mail-user-agent 'gnus-user-agent)
(setq gnus-select-method '(nnml "private"))
(setq user-full-name "death")
(setq user-mail-address "death@death.org")
(setq gnus-secondary-select-methods
'((nntp "news.gmane.org")
(nntp "news.eternal-september.org")))
(setq gnus-treat-display-smileys nil)
(setq gnus-read-active-file nil)
(setq gnus-message-archive-group "sent")
(setq gnus-logo-color-style 'pine)
;;;; Chrome browse-url function
(defun browse-url-chrome (url &rest args)
(interactive (browse-url-interactive-arg "URL: "))
(let ((browse-url-browser-function 'browse-url-generic)
(browse-url-generic-program "chromium")
(browse-url-generic-args '("--enable-user-stylesheet")))
(apply #'browse-url url args)))
;;;; ERC
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/erc/")
(require 'erc)
(require 'tls)
(defun start-irc ()
(interactive)
(erc-tls :server "xxxxxxxxxxxx" :port 62117
:nick "_death" :password "xxxx")
(erc-tls :server "xxxxxxxxxxxx" :port 62117
:nick "adeht" :password "xxxx"))
(setq erc-user-full-name "death")
(setq erc-email-userid "death")
(setq erc-auto-query 'buffer)
(setq erc-log-channels-directory "~/.erc/logs")
(setq erc-save-buffer-on-part t)
(setq erc-save-buffer-in-logs t)
(setq erc-log-write-after-send t)
(setq erc-save-queries-on-quit t)
(setq erc-track-exclude-types '("NICK" "JOIN" "PART" "QUIT" "MODE"))
(setq erc-track-use-faces nil)
(setq erc-log-channels t)
(setq erc-log-insert-log-on-open nil)
(setq erc-generate-log-file-name-function 'erc-generate-log-file-name-short)
(pushnew 'log erc-modules)
(setq erc-modules (remove 'autojoin erc-modules))
(erc-update-modules)
(setq erc-timestamp-only-if-changed-flag nil)
(setq erc-insert-timestamp-function 'erc-insert-timestamp-left)
(setq erc-timestamp-format "[%H:%M] ")
(setq erc-fill-column 98)
(setq erc-button-alist (subst 'browse-url-chrome 'browse-url erc-button-alist))
(defadvice pcomplete-erc-nicks (after remove-fn-prefix activate)
"Remove the bouncer's freenode prefix for nicks."
(setq ad-return-value
(mapcar (lambda (nick)
(if (eq (compare-strings "fn'" 0 3 nick 0 3) 't)
(substring nick 3)
nick))
ad-return-value)))
(defadvice erc-get-channel-user-list (after remove-nils activate)
"Ensure that there are no nils in the channel user list."
(setq ad-return-value (remove nil ad-return-value)))
(defun erc-cmd-NP ()
(erc-cmd-ME
(concat " is now playing: "
(let* ((string (shell-command-to-string "mpc")))
(string-match "[^/]*$" string)
(match-string 0 string)))))
(defun icq ()
(interactive)
(erc :server "localhost" :port 6667 :nick "death"))
;;;; Other programming languages
(autoload 'javascript-mode "javascript" nil t)
(push '("\\.js\\'" . javascript-mode) auto-mode-alist)
(autoload 'ruby-mode "ruby-mode" nil t)
(push '("\\.rb\\'" . ruby-mode) auto-mode-alist)
(autoload 'php-mode "php-mode" nil t)
(push '("\\.php\\'" . php-mode) auto-mode-alist)
(push '("\\.jad\\'" . java-mode) auto-mode-alist)
(push '("\\.arc\\'" . scheme-mode) auto-mode-alist)
(push '("\\.cs\\'" . java-mode) auto-mode-alist)
(load "~/emacs/haskell-mode/haskell-site-file")
;;;; Mingus
(add-to-list 'load-path "~/emacs/mingus/")
(require 'mingus-stays-home)
(defun mingus-switch-or-start ()
"Switch to mingus buffer if it exists, and start mingus
otherwise."
(interactive)
(let ((mingus-buffer (get-buffer "*Mingus*")))
(if mingus-buffer
(switch-to-buffer mingus-buffer)
(mingus)))
(mingus-goto-current-song))
(global-set-key [f2] 'mingus-switch-or-start)
(defun mingus-next-and-show ()
"Move to the next song and show its name in the echo buffer."
(interactive)
(mingus-next)
(let* ((song (mpd-get-current-song mpd-inter-conn))
(artist (getf song 'Artist))
(title (getf song 'Title))
(file (getf song 'file)))
(message "Song: %s"
(cond ((and artist title) (format "%s - %s" artist title))
(title title)
(t file))))
(when (string= "*Mingus*" (buffer-name))
(mingus-goto-current-song)))
(global-set-key [f4] 'mingus-next-and-show)
;;;; Org
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-ca" 'org-agenda)
(setq org-hide-leading-stars t)
(setq org-agenda-skip-scheduled-if-done t)
(setq org-agenda-start-on-weekday 0)
(setq org-agenda-weekend-days '(5 6))
(setq org-agenda-files '("~/doc/my/reading.org" "~/doc/my/events.org"))
;;;; Dictionary
(defun dictionary (word)
"Browse a dictionary entry for WORD."
(interactive "sWord: ")
(w3m-browse-url
(concat "http://dictionary.reference.com/search?q="
word)))
;;;; Buffer-moving
(require 'buffer-move)
(global-set-key (kbd "<C-S-up>") 'buf-move-up)
(global-set-key (kbd "<C-S-down>") 'buf-move-down)
(global-set-key (kbd "<C-S-left>") 'buf-move-left)
(global-set-key (kbd "<C-S-right>") 'buf-move-right)
;;;; Reddit
(add-to-list 'load-path "~/lisp/reddit/")
(autoload 'reddit "reddit" "What's new on Reddit" t)
(setq reddit-user "death")
(defadvice url-cookie-host-can-set-p (after reddit-cookie-fix activate)
(when (and (string= (ad-get-arg 0) "www.reddit.com")
(string= (ad-get-arg 1) "reddit.com"))
(setq ad-return-value t)))
;;;; Color themes
(add-to-list 'load-path "~/emacs/color-theme/")
(require 'color-theme)
(require 'color-theme-celebration)
(when (and (boundp 'x-initialized) x-initialized)
(color-theme-celebration))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment