emacs/init.el
This commit is contained in:
parent
e81cc4865d
commit
6bc9482e0b
1 changed files with 66 additions and 84 deletions
148
emacs/init.el
148
emacs/init.el
|
@ -1,9 +1,16 @@
|
|||
;;; init.el --- ryuslash's emacs init
|
||||
|
||||
;;; Commentary:
|
||||
;; Does so much and changes so often
|
||||
|
||||
(require 'geiser-install)
|
||||
(require 'iso-transl)
|
||||
(require 'newcomment)
|
||||
(require 'uniquify)
|
||||
(require 'w3m-load)
|
||||
|
||||
;;; Code:
|
||||
|
||||
(eval-and-compile
|
||||
(package-initialize)
|
||||
|
||||
|
@ -14,34 +21,6 @@
|
|||
'("/usr/share/emacs/site-lisp" "~/.emacs.d/site-lisp"))
|
||||
(add-to-list 'load-path "~/.emacs.d/"))
|
||||
|
||||
(eval-when-compile
|
||||
(require 'appt)
|
||||
(require 'browse-url)
|
||||
(require 'em-dirs)
|
||||
(require 'em-prompt)
|
||||
(require 'emms-source-file)
|
||||
(require 'erc-join)
|
||||
(require 'erc-stamp)
|
||||
(require 'fill-column-indicator)
|
||||
(require 'geiser-repl)
|
||||
(require 'gtags)
|
||||
(require 'hideshow)
|
||||
(require 'jabber)
|
||||
(require 'message)
|
||||
(require 'mu4e)
|
||||
(require 'org-capture)
|
||||
(require 'org-contacts)
|
||||
(require 'org-feed)
|
||||
(require 'org-html)
|
||||
(require 'php-mode)
|
||||
(require 'rainbow-delimiters)
|
||||
(require 'sauron)
|
||||
(require 'sendmail)
|
||||
(require 'smex)
|
||||
(require 'time-stamp)
|
||||
(require 'whitespace)
|
||||
(require 'yasnippet))
|
||||
|
||||
(autoload 'gtags-mode "gtags" nil t)
|
||||
(autoload 'identica-mode "identica-mode" nil t)
|
||||
(autoload 'mu4e "mu4e" nil t)
|
||||
|
@ -71,10 +50,10 @@
|
|||
(concat
|
||||
"\\(?:static\\s +\\)?\\(?:\\sw+\\(?: \\|\t\\|\n\\)*?\\*?\\)"
|
||||
"\\(?:\\s \\|\t\\|\n\\)\\(?:\\sw\\|_\\)+([^)]*)[^;\n]*$"))
|
||||
"Regex for `outline-minor-mode' for `c-mode'.")
|
||||
"Regex for command `outline-minor-mode' for `c-mode'.")
|
||||
|
||||
(defconst oni:javascript-outline-regex "function \\(\\w\\|_\\)+("
|
||||
"Regex for `outline-minor-mode' for `js-mode'.")
|
||||
"Regex for command `outline-minor-mode' for `js-mode'.")
|
||||
|
||||
(defconst oni:php-outline-regex
|
||||
(eval-when-compile
|
||||
|
@ -83,14 +62,14 @@
|
|||
"\\|final\\) \\)?class [a-zA-Z0-9_]+\\( extends [\\a-zA-Z0-9_]+\\)?"
|
||||
"\\|\\(abstract \\)?\\(public\\|private\\|protected\\)?"
|
||||
"\\( static\\)? function [a-zA-Z0-9_]+(\\|/\\*\\*\\)"))
|
||||
"Regex for `outline-minor-mode' for `php-mode'.")
|
||||
"Regex for command `outline-minor-mode' for `php-mode'.")
|
||||
|
||||
(defconst oni:python-outline-regex
|
||||
(eval-when-compile
|
||||
(concat "^[ \t]*\\(?:@[a-zA-Z0-9_]+\\(?:([a-zA-Z0-9_=, ]*)\\)?"
|
||||
"\n\\)*[ \t]*\\(?:\\(class\\|def\\)[ \t]+\\(\\sw\\|\\s_\\)+"
|
||||
"\\(([^)]*):\\)?\\|\\#[ a-zA-Z0-9]*\\#\\)"))
|
||||
"Regex for `outline-minor-mode' for `python-mode'.")
|
||||
"Regex for command `outline-minor-mode' for `python-mode'.")
|
||||
|
||||
(defface oni:mode-line-buffer-column
|
||||
'((t (:inherit font-lock-type-face)))
|
||||
|
@ -123,7 +102,9 @@
|
|||
:group 'local)
|
||||
|
||||
(defmacro oni:define-mailbox (name email &optional signature longname)
|
||||
"Define a mailbox function."
|
||||
"Define a mailbox function for mailbox NAME with address EMAIL.
|
||||
Optionally set signature to SIGNATURE and use LONGNAME as the
|
||||
actual account name."
|
||||
`(defun ,(make-symbol (concat "oni:" name "-mailbox")) ()
|
||||
,(concat "Settings for " name " mailbox")
|
||||
(setq mu4e-mu-home ,(expand-file-name (concat "~/.mu/" name))
|
||||
|
@ -137,12 +118,15 @@
|
|||
message-signature-file ,signature)))
|
||||
|
||||
(defmacro oni:email (user at host dot com)
|
||||
"Turn arguments into an email address."
|
||||
"Turn arguments into an email address.
|
||||
The resulting email address will look like: USER@HOST.COM, AT and DOT are
|
||||
intentionally being skipped."
|
||||
(concat (symbol-name user) "@" (symbol-name host) "."
|
||||
(symbol-name com)))
|
||||
|
||||
(defmacro oni:generic-outline (regex)
|
||||
"Prepare for enabling `outline-minor-mode'."
|
||||
"Prepare for enabling command `outline-minor-mode'.
|
||||
Argument REGEX will be used to set `outline-regexp' for this buffer."
|
||||
`(progn
|
||||
(when (buffer-file-name)
|
||||
(outline-minor-mode)
|
||||
|
@ -151,6 +135,7 @@
|
|||
(local-set-key [C-tab] 'outline-toggle-children))))
|
||||
|
||||
(defmacro oni:color (name)
|
||||
"Fetch color NAME from the naquadah color theme."
|
||||
`(naquadah-get-colors (quote ,name)))
|
||||
|
||||
(defvar oni:mailbox-map
|
||||
|
@ -167,7 +152,7 @@
|
|||
flymake-cursor pony-mode sauron dispass
|
||||
expand-region fill-column-indicator
|
||||
git-auto-commit-mode idomenu magit smex)
|
||||
"List of all the packages I have (want) installed")
|
||||
"List of all the packages I have (want) installed.")
|
||||
|
||||
(defun oni:after-save-func ()
|
||||
"Function for `after-save-hook'."
|
||||
|
@ -175,7 +160,7 @@
|
|||
(executable-make-buffer-file-executable-if-script-p)
|
||||
(let ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile")))
|
||||
(when dom-dir
|
||||
(shell-command (concat "make -C " dom-dir " TAGS 2>&1 >/dev/null")))))
|
||||
(shell-command (concat "make -C " dom-dir " TAGS >/dev/null 2>&1")))))
|
||||
|
||||
(defun oni:before-save-func ()
|
||||
"Function for `before-save-hook'."
|
||||
|
@ -245,6 +230,7 @@
|
|||
(setq truncate-lines nil))
|
||||
|
||||
(defun oni:eshell-prompt-function ()
|
||||
"Show a pretty shell prompt."
|
||||
(let ((status (if (zerop eshell-last-command-status) ?+ ?-))
|
||||
(hostname (shell-command-to-string "hostname"))
|
||||
(dir (abbreviate-file-name (eshell/pwd)))
|
||||
|
@ -305,6 +291,10 @@
|
|||
(fci-mode))
|
||||
|
||||
(defun oni:indent-shift-left (start end &optional count)
|
||||
"Rigidly indent region.
|
||||
Region is from START to END. Move
|
||||
COUNT number of spaces if it is non-nil otherwise use
|
||||
`tab-width'."
|
||||
(interactive
|
||||
(if mark-active
|
||||
(list (region-beginning) (region-end) current-prefix-arg)
|
||||
|
@ -326,6 +316,9 @@
|
|||
(indent-rigidly start end (- count))))))
|
||||
|
||||
(defun oni:indent-shift-right (start end &optional count)
|
||||
"Indent region between START and END rigidly to the right.
|
||||
If COUNT has been specified indent by that much, otherwise look at
|
||||
`tab-width'."
|
||||
(interactive
|
||||
(if mark-active
|
||||
(list (region-beginning) (region-end) current-prefix-arg)
|
||||
|
@ -350,27 +343,25 @@
|
|||
"Function for `js-mode-hook'."
|
||||
(oni:generic-outline oni:javascript-outline-regex)
|
||||
(rainbow-delimiters-mode)
|
||||
(local-set-key "\C-j" 'oni:newline-and-indent))
|
||||
(local-set-key "\C-j" 'oni:newline-and-indent)
|
||||
(pretty-symbols-mode -1))
|
||||
|
||||
(defun oni:kill-region-or-backward-char ()
|
||||
"Kill either the active region, or delete the character left of
|
||||
the cursor"
|
||||
"Either `kill-region' or `backward-delete-char-untabify'."
|
||||
(interactive)
|
||||
(if (region-active-p)
|
||||
(kill-region (region-beginning) (region-end))
|
||||
(backward-delete-char-untabify 1)))
|
||||
|
||||
(defun oni:kill-region-or-forward-char ()
|
||||
"Kill either the active region, or delete the character right
|
||||
of the cursor"
|
||||
"Either `kill-region' or `delete-forward-char'."
|
||||
(interactive)
|
||||
(if (region-active-p)
|
||||
(kill-region (region-beginning) (region-end))
|
||||
(delete-forward-char 1)))
|
||||
|
||||
(defun oni:kill-region-or-line ()
|
||||
"Kill either the active region, or the rest of the line,
|
||||
depending on whether or not `region-active-p' is t"
|
||||
"Either `kill-region' or `kill-line'."
|
||||
(interactive)
|
||||
(if (region-active-p)
|
||||
(kill-region (region-beginning) (region-end))
|
||||
|
@ -405,8 +396,9 @@
|
|||
(ispell-change-dictionary (read-string "New dictionary: ")))
|
||||
|
||||
(defun oni:mini-fix-timestamp-string (date-string)
|
||||
"A minimal version of Xah Lee's `fix-timestamp-string'
|
||||
function, found at http://xahlee.org/emacs/elisp_parse_time.html"
|
||||
"A minimal version of Xah Lee's `fix-timestamp-string'.
|
||||
Turn DATE-STRING into something else that can be worked with in
|
||||
code. Found at http://xahlee.org/emacs/elisp_parse_time.html"
|
||||
(setq date-string (replace-regexp-in-string "Jan" "01" date-string)
|
||||
date-string (replace-regexp-in-string "Feb" "02" date-string)
|
||||
date-string (replace-regexp-in-string "Mar" "03" date-string)
|
||||
|
@ -428,8 +420,7 @@
|
|||
(match-string 1 date-string)))
|
||||
|
||||
(defun oni:move-beginning-of-dwim ()
|
||||
"Move to the beginning of line, either after the indentatoin of
|
||||
before."
|
||||
"Move to beginning of line either after indentation or before."
|
||||
(interactive)
|
||||
(let ((start (point)))
|
||||
(back-to-indentation)
|
||||
|
@ -437,8 +428,7 @@
|
|||
(beginning-of-line))))
|
||||
|
||||
(defun oni:move-end-of-dwim ()
|
||||
"Move to the end of line, either before any comments or after
|
||||
them."
|
||||
"Move to end of line, either before any comments or after."
|
||||
(interactive)
|
||||
(let ((start (point))
|
||||
(eolpos (line-end-position)))
|
||||
|
@ -455,7 +445,8 @@
|
|||
(end-of-line))))
|
||||
|
||||
(defun oni:myepisodes-formatter (plist)
|
||||
"Format RSS items from MyEpisodes as org tasks."
|
||||
"Format RSS items from MyEpisodes as org tasks.
|
||||
PLIST contains all the pertinent information."
|
||||
(let ((str (plist-get plist :title)))
|
||||
(string-match
|
||||
"^\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]$"
|
||||
|
@ -467,6 +458,8 @@
|
|||
(format "* ACQUIRE %s %s - %s <%s>" title episode name date))))
|
||||
|
||||
(defun oni:newline-and-indent ()
|
||||
"`newline-and-indent', but with a twist.
|
||||
When dealing with braces, add another line and indent that too."
|
||||
(interactive)
|
||||
(if (and (not (or (= (point) (point-max))
|
||||
(= (point) (point-min))))
|
||||
|
@ -477,19 +470,6 @@
|
|||
(save-excursion (newline-and-indent)))
|
||||
(newline-and-indent))
|
||||
|
||||
(defun oni:org-capture-before-finalize-func ()
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "<<FIRSTLINE>>" nil t)
|
||||
(let (beg end)
|
||||
(save-match-data
|
||||
(search-forward "\n\n")
|
||||
(skip-syntax-forward " ")
|
||||
(setq beg (point))
|
||||
(search-forward "\n")
|
||||
(setq end (1- (point))))
|
||||
(replace-match (buffer-substring beg end) t t)))))
|
||||
|
||||
(defun oni:org-mode-func ()
|
||||
"Function for `org-mode-hook'."
|
||||
(flyspell-mode)
|
||||
|
@ -520,11 +500,13 @@
|
|||
(oni:generic-outline oni:python-outline-regex)
|
||||
(set (make-local-variable 'electric-indent-chars) nil)
|
||||
(rainbow-delimiters-mode)
|
||||
(setq fci-rule-column 80
|
||||
fill-column 72)
|
||||
(fci-mode))
|
||||
|
||||
(defun oni:raise-eshell ()
|
||||
"Start or switch back to `eshell'. Also change directories to
|
||||
current working directory."
|
||||
"Start or switch back to `eshell'.
|
||||
Also change directories to current working directory."
|
||||
(interactive)
|
||||
(let ((dir (file-name-directory
|
||||
(or (buffer-file-name) "~/")))
|
||||
|
@ -536,10 +518,10 @@
|
|||
(eshell-reset)))))
|
||||
|
||||
(defun oni:raise-scratch (&optional mode)
|
||||
"Show the *scratch* buffer. If called with a universal
|
||||
argument, ask the user which mode to use. If MODE is not nil,
|
||||
open a new buffer with the name *MODE-scratch* and load MODE as
|
||||
its major mode."
|
||||
"Show the *scratch* buffer.
|
||||
If called with a universal argument, ask the user which mode to
|
||||
use. If MODE is not nil, open a new buffer with the name
|
||||
*MODE-scratch* and load MODE as its major mode."
|
||||
(interactive (list (if current-prefix-arg
|
||||
(read-string "Mode: ")
|
||||
nil)))
|
||||
|
@ -563,6 +545,7 @@ its major mode."
|
|||
(revert-buffer nil t nil))
|
||||
|
||||
(defun oni:replace-html-special-chars ()
|
||||
"Replace special characters with HTML escaped entities."
|
||||
(oni:replace-occurrences "é" "é"))
|
||||
|
||||
(defun oni:replace-occurrences (from to)
|
||||
|
@ -806,7 +789,7 @@ for easy selection."
|
|||
(vertical-scroll-bars . nil)
|
||||
(menu-bar-lines . nil)
|
||||
(tool-bar-lines . nil)
|
||||
(font . "DejaVu Sans Mono:pixelsize=18")
|
||||
(font . "LiberationMono:pixelsize=16")
|
||||
(left-fringe . 0)))
|
||||
(setq emms-source-file-default-directory "/mnt/music/")
|
||||
(setq erc-autojoin-channels-alist
|
||||
|
@ -825,12 +808,13 @@ for easy selection."
|
|||
(setq flymake-log-file-name (expand-file-name "~/.emacs.d/flymake.log"))
|
||||
(setq flymake-log-level 0)
|
||||
(setq frame-title-format '(:eval (concat "emacs: " (buffer-name))))
|
||||
(setq geiser-active-implementations '(guile))
|
||||
(setq geiser-repl-history-filename "~/.emacs.d/geiser-history")
|
||||
(setq gtags-auto-update t)
|
||||
(setq help-at-pt-display-when-idle t)
|
||||
(setq ido-auto-merge-delay-time 1000000)
|
||||
(setq ido-max-window-height 1)
|
||||
(setq ido-save-directory-list-file nil)
|
||||
(setq ido-ubiquitous-exceptions '(tmm-prompt))
|
||||
(setq inferior-lisp-program "sbcl")
|
||||
(setq inhibit-default-init t)
|
||||
(setq inhibit-local-menu-bar-menus t)
|
||||
|
@ -875,15 +859,8 @@ for easy selection."
|
|||
(tags priority-down category-keep)
|
||||
(search category-keep)))
|
||||
(setq org-capture-templates
|
||||
'(("t" "Task" entry (file "")
|
||||
"* TODO <<FIRSTLINE>>
|
||||
:PROPERTIES:
|
||||
:DIRECTORY: %(directory-file-name (or (org-capture-get :original-file) org-default-notes-file))
|
||||
:FILE: %f
|
||||
:END:
|
||||
%u
|
||||
|
||||
%?%a")
|
||||
'(("t" "Task" entry (file "~/documents/org/tasks")
|
||||
"* TODO %?")
|
||||
("h" "Habit" entry (file "")
|
||||
(concat "* TODO %^{Description}\n"
|
||||
" SCHEDULED: %^T\n"
|
||||
|
@ -958,12 +935,14 @@ for easy selection."
|
|||
(setq special-display-buffer-names '("*Sauron*"))
|
||||
(setq special-display-frame-alist '((minibuffer . nil)
|
||||
(right-fringe . 0)))
|
||||
(setq split-height-threshold 40)
|
||||
(setq time-stamp-active t)
|
||||
(setq time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)")
|
||||
(setq uniquify-buffer-name-style 'post-forward)
|
||||
(setq use-dialog-box nil)
|
||||
(setq user-full-name "Tom Willemsen")
|
||||
(setq whitespace-style '(face trailing))
|
||||
(setq window-combination-resize t)
|
||||
(setq yas-prompt-functions '(yas-ido-prompt))
|
||||
|
||||
(add-hook 'after-save-hook 'oni:after-save-func t)
|
||||
|
@ -987,8 +966,6 @@ for easy selection."
|
|||
(add-hook 'magit-log-edit-mode-hook 'oni:magit-log-edit-mode-func)
|
||||
(add-hook 'markdown-mode-hook 'oni:markdown-mode-func)
|
||||
(add-hook 'message-mode-hook 'oni:message-mode-func)
|
||||
(add-hook 'org-capture-before-finalize-hook
|
||||
'oni:org-capture-before-finalize-func)
|
||||
(add-hook 'org-mode-hook 'oni:org-mode-func)
|
||||
(add-hook 'php-mode-hook 'oni:php-mode-func)
|
||||
(add-hook 'prog-mode-hook 'oni:prog-mode-func)
|
||||
|
@ -1069,6 +1046,7 @@ for easy selection."
|
|||
(ido-mode)
|
||||
(savehist-mode)
|
||||
(show-paren-mode)
|
||||
(auto-insert-mode)
|
||||
|
||||
(smex-initialize)
|
||||
(help-at-pt-set-timer)
|
||||
|
@ -1078,3 +1056,7 @@ for easy selection."
|
|||
(load custom-file)
|
||||
(load "rudel-loaddefs.el")
|
||||
(load (expand-file-name "~/quicklisp/slime-helper.el"))
|
||||
|
||||
(provide 'init)
|
||||
|
||||
;;; init.el ends here
|
||||
|
|
Loading…
Reference in a new issue