summaryrefslogtreecommitdiffstats
path: root/emacs/site-lisp
diff options
context:
space:
mode:
authorGravatar Tom Willemse2013-04-23 00:27:45 +0200
committerGravatar Tom Willemse2013-04-23 00:27:45 +0200
commit6b5f3062e224b4b82ef1f316e95cc4a5ff19a9b2 (patch)
tree860c3f5ae9b514b0f966ba27611af0327cf57c61 /emacs/site-lisp
parent8384ba49a074592c6ded011c76f429b8bac35715 (diff)
downloaddotfiles-6b5f3062e224b4b82ef1f316e95cc4a5ff19a9b2.tar.gz
dotfiles-6b5f3062e224b4b82ef1f316e95cc4a5ff19a9b2.zip
Literate init.el again
Diffstat (limited to 'emacs/site-lisp')
-rw-r--r--emacs/site-lisp/ext.el7
-rw-r--r--emacs/site-lisp/oni.el64
-rw-r--r--emacs/site-lisp/org-init.el4
3 files changed, 41 insertions, 34 deletions
diff --git a/emacs/site-lisp/ext.el b/emacs/site-lisp/ext.el
index eb84a3f..9bfbe34 100644
--- a/emacs/site-lisp/ext.el
+++ b/emacs/site-lisp/ext.el
@@ -38,6 +38,13 @@
buffer-file-name))))
(list "pycheck.sh" (list local-file))))
+(defun ext:indent-defun ()
+ "Indent the current defun."
+ (interactive)
+ (save-excursion
+ (mark-defun)
+ (indent-region (region-beginning) (region-end))))
+
(defun ext:reload-buffer ()
"Reload current buffer."
(interactive)
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")
diff --git a/emacs/site-lisp/org-init.el b/emacs/site-lisp/org-init.el
index 3c698d2..77a72a0 100644
--- a/emacs/site-lisp/org-init.el
+++ b/emacs/site-lisp/org-init.el
@@ -104,7 +104,7 @@
(todo user-defined-down)
(tags priority-down category-keep)
(search category-keep)))
-(setq org-agenda-tags-column -101)
+(setq org-agenda-tags-column (1+ (- (window-width))))
(setq org-directory (expand-file-name "~/documents/org"))
(setq org-default-notes-file (concat org-directory "/org"))
(setq org-capture-templates
@@ -132,7 +132,7 @@
(setq org-refile-use-outline-path 'file)
(setq org-return-follows-link t)
(setq org-src-fontify-natively t)
-(setq org-tags-column -101)
+(setq org-tags-column (- 70))
(setq org-tags-exclude-from-inheritance '("crypt"))
(setq org-todo-keyword-faces
'(("TODO" :foreground "#ff756e" :background "#171719" :box (:width 1 :color "#282830"))