From 6b5f3062e224b4b82ef1f316e95cc4a5ff19a9b2 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 23 Apr 2013 00:27:45 +0200 Subject: Literate init.el again --- emacs/site-lisp/oni.el | 64 +++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'emacs/site-lisp/oni.el') diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index 749ca37..544d215 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -34,6 +34,15 @@ DOT are intentionally being skipped." (concat (symbol-name user) "@" (symbol-name host) "." (symbol-name com))) +(defmacro oni:eval-after-init (&rest body) + "Defer execution of BODY until after Emacs init. + + Some functionality is dependent on code loaded by package.el. + Instead of requiring package.el to load very early on, have some + functionality deferred to a point after Emacs has initialized and + package.el is loaded anyway." + `(add-hook 'emacs-startup-hook #'(lambda () ,@body))) + (defun oni:after-save-func () "Function for `after-save-hook'." (oni:compile-el) @@ -66,6 +75,13 @@ DOT are intentionally being skipped." (local-set-key [f9] 'compile) (local-set-key "\C-j" 'oni:newline-and-indent)) +(defun oni:change-prev-case (num dir) + (let ((regfunc (if (eq dir 'up) 'upcase-region 'downcase-region)) + (wordfunc (if (eq dir 'up) 'upcase-word 'downcase-word))) + (if (> num 1) + (funcall regfunc (point) (- (point) num)) + (funcall wordfunc -1)))) + (defun oni:close-client-window () "Close a client's frames." (interactive) @@ -99,6 +115,10 @@ DOT are intentionally being skipped." "Function for `diary-display-hook'." (diary-fancy-display)) +(defun oni:downcase-prev (num) + (interactive "p") + (oni:change-prev-case num 'down)) + (defun oni:emacs-startup-func () "Function for `emacs-init-hook'." (require 'auto-complete-config) @@ -118,6 +138,10 @@ DOT are intentionally being skipped." "Function for `haskell-mode-hook'." (turn-on-haskell-indentation)) +(defun oni:hostname () + "Get the current machine's hostname." + (substring (shell-command-to-string "hostname") 0 -1)) + (defun oni:indent-shift-left (start end &optional count) "Rigidly indent region. Region is from START to END. Move @@ -208,17 +232,6 @@ If COUNT has been specified indent by that much, otherwise look at (local-unset-key (kbd "]")) (local-unset-key (kbd "}"))) -(defun oni:magit-log-edit-mode-func () - "Function for `magit-log-edit-mode-hook'." - (font-lock-add-keywords - nil - '(("\\`\\(.\\{,50\\}\\)\\(.*\\)\n?\\(.*\\)$" - (1 'git-commit-summary-face) - (2 'git-commit-overlong-summary-face) - (3 'git-commit-nonempty-second-line-face)) - ("`\\([^']+\\)'" 1 font-lock-constant-face)) - t)) - (defun oni:markdown-mode-func () "Function for `markdown-mode-hook'." (setq-local whitespace-style '(face trailing))) @@ -319,10 +332,6 @@ When dealing with braces, add another line and indent that too." fill-column 72) (setq-local whitespace-style '(tab-mark))) -(defun oni:rainbow-mode-init () - "Initialization function for rainbow-mode." - (diminish 'rainbow-mode)) - (defun oni:raise-ansi-term (arg) "Create or show an `ansi-term' buffer." (interactive "P") @@ -424,11 +433,6 @@ insert at the end of the region and at the beginning." (interactive) (find-file "~/documents/org/index.org")) -(defun oni:smex-init () - "Initialization function for smex." - (global-set-key (kbd "M-x") 'smex) - (global-set-key (kbd "C-M-x") 'smex-major-mode-commands)) - (defun oni:split-window-interactive (dir) "Split windows in direction DIR. @@ -467,6 +471,14 @@ If no direction is given, don't split." "Function for `term-mode-hook'." (setq truncate-lines nil)) +(defun oni:upcase-prev (num) + (interactive "p") + (oni:change-prev-case num 'up)) + +(defun oni:vala-mode-func () + "Function for `vala-mode-hook'." + (setq indent-tabs-mode nil)) + (defun oni:write-file-func () "Function for `write-file-hooks'." (time-stamp)) @@ -477,18 +489,6 @@ If no direction is given, don't split." (define-key yas-minor-mode-map [(tab)] nil) (define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand)) -(defun oni:yasnippet-init () - "Initialization function for yasnippet." - (diminish 'yas-minor-mode)) - -(defvar oni:auto-save-name-transforms - `((".*" ,temporary-file-directory t)) - "Place all auto-save files in `temporary-file-directory'.") - -(defvar oni:backup-directory-alist - `((".*" . ,temporary-file-directory)) - "Palce all backup files in `temporary-file-directory'.") - (defvar oni:mailbox-map '("top" ("menu" ("ryulash.org" . "ryuslash") -- cgit v1.2.3-54-g00ecf