From 555164a19a5f77565a3805a45981c206f2390db2 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 25 Sep 2012 09:58:26 +0200 Subject: .emacs.d/init.el --- .emacs.d/init.el | 120 +++++++++++++++++++++---------------------------------- 1 file changed, 46 insertions(+), 74 deletions(-) (limited to '.emacs.d') diff --git a/.emacs.d/init.el b/.emacs.d/init.el index ee94c39..a4c39f1 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -26,7 +26,6 @@ (autoload 'identica-mode "identica-mode" nil t) (autoload 'jabber-connect "jabber" nil t) (autoload 'mu4e "mu4e" nil t) -(autoload 'naquadah-get-colors "naquadah-theme") (autoload 'php-mode "php-mode" nil t) (autoload 'po-mode "po-mode" nil t) (autoload 'pony-mode "pony-mode" nil t) @@ -48,32 +47,6 @@ (defalias 'yes-or-no-p 'y-or-n-p) -(defconst oni:c-outline-regex - (eval-when-compile - (concat - "\\(?:static\\s +\\)?\\(?:\\sw+\\(?: \\|\t\\|\n\\)*?\\*?\\)" - "\\(?:\\s \\|\t\\|\n\\)\\(?:\\sw\\|_\\)+([^)]*)[^;\n]*$")) - "Regex for command `outline-minor-mode' for `c-mode'.") - -(defconst oni:javascript-outline-regex "function \\(\\w\\|_\\)+(" - "Regex for command `outline-minor-mode' for `js-mode'.") - -(defconst oni:php-outline-regex - (eval-when-compile - (concat - "^ *\\(\\(?:namespace\\|interface\\) [a-zA-Z0-9_]\\|\\(\\(abstract" - "\\|final\\) \\)?class [a-zA-Z0-9_]+\\( extends [\\a-zA-Z0-9_]+\\)?" - "\\|\\(abstract \\)?\\(public\\|private\\|protected\\)?" - "\\( static\\)? function [a-zA-Z0-9_]+(\\|/\\*\\*\\)")) - "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 command `outline-minor-mode' for `python-mode'.") - (defface oni:mode-line-buffer-column '((t (:inherit font-lock-type-face))) "Face for the column number in the mode-line" @@ -127,20 +100,6 @@ DOT are intentionally being skipped." (concat (symbol-name user) "@" (symbol-name host) "." (symbol-name com))) -(defmacro oni:generic-outline (regex) - "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) - (set (make-local-variable 'outline-regexp) ,regex) - (hide-body) - (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 '("top" ("menu" ("ryulash.org" . "ryuslash") @@ -174,9 +133,7 @@ Argument REGEX will be used to set `outline-regexp' for this buffer." (defun oni:c-mode-common-func () "Function for `c-mode-common-hook'." - (setq hs-adjust-block-beginning 'hs-c-like-adjust-block-beginning) - (when (buffer-file-name) - (hs-minor-mode))) + ) (defun oni:c-mode-func () "Function for `c-mode-hook'." @@ -199,9 +156,6 @@ Argument REGEX will be used to set `outline-regexp' for this buffer." (defun oni:css-mode-func () "Function for `css-mode-hook'." - (setq hs-adjust-block-beginning 'hs-c-like-adjust-block-beginning) - (when (buffer-file-name) - (hs-minor-mode)) (local-set-key "\C-j" 'oni:newline-and-indent) (rainbow-mode)) @@ -211,9 +165,7 @@ Argument REGEX will be used to set `outline-regexp' for this buffer." (defun oni:emacs-lisp-mode-func () "Function for `emacs-lisp-mode-hook'." - (eldoc-mode) - (when (buffer-file-name) - (hs-minor-mode))) + (eldoc-mode)) (defun oni:emms-toggle-playing () "Toggle between playing/paused states." @@ -244,8 +196,8 @@ Argument REGEX will be used to set `outline-regexp' for this buffer." (concat (propertize (char-to-string status) 'face `(:foreground ,(if (= status ?+) - (oni:color chameleon-1) - (oni:color scarlet-red-2)))) + "green" + "red"))) " " (propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id) " " @@ -258,7 +210,7 @@ Argument REGEX will be used to set `outline-regexp' for this buffer." 'face 'font-lock-function-name-face)) " \n" (propertize (char-to-string userstatus) - 'face `(:foreground ,(oni:color sky-blue-1))) + 'face `(:foreground "blue")) "> "))) (defun oni:flymake-mode-func () @@ -272,7 +224,7 @@ Argument REGEX will be used to set `outline-regexp' for this buffer." 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) - (list "pyflakes" (list local-file)))) + (list "pycheck.sh" (list local-file)))) (defun oni:go-mode-func () "Function for `go-mode-hook'." @@ -284,11 +236,6 @@ Argument REGEX will be used to set `outline-regexp' for this buffer." (local-set-key "\M-," 'gtags-find-tag) (local-set-key "\M-." 'gtags-find-rtag)) -(defun oni:hs-minor-mode-func () - "Function for `hs-minor-mode-hook'." - (local-set-key [C-tab] 'hs-toggle-hiding) - (hs-hide-all)) - (defun oni:html-mode-func () "Function for `html-mode-hook'." (fci-mode)) @@ -352,7 +299,6 @@ If COUNT has been specified indent by that much, otherwise look at (defun oni:js-mode-func () "Function for `js-mode-hook'." - (oni:generic-outline oni:javascript-outline-regex) (rainbow-delimiters-mode) (local-set-key "\C-j" 'oni:newline-and-indent) (pretty-symbols-mode -1)) @@ -387,8 +333,7 @@ If COUNT has been specified indent by that much, otherwise look at (defun oni:lisp-mode-func () "Function for `lisp-mode-hook'." - (when (buffer-file-name) - (hs-minor-mode))) + ) (defun oni:lua-mode-func() "Function for `lisp-mode-hook'." @@ -520,11 +465,9 @@ When dealing with braces, add another line and indent that too." (flymake-mode) (local-set-key (kbd "C->") 'python-indent-shift-right) (local-set-key (kbd "C-<") 'python-indent-shift-left) - (local-set-key [C-tab] 'outline-toggle-children) - (oni:generic-outline oni:python-outline-regex) (set (make-local-variable 'electric-indent-chars) nil) (rainbow-delimiters-mode) - (setq fci-rule-column 80 + (setq fci-rule-column 79 fill-column 72) (fci-mode)) @@ -591,8 +534,7 @@ use. If MODE is not nil, open a new buffer with the name (defun oni:scheme-mode-func () "Function for `scheme-mode-hook'." - (when (buffer-file-name) - (hs-minor-mode))) + ) (defun oni:self-insert-dwim () "Execute self insert, but when the region is active call self @@ -615,6 +557,29 @@ insert at the end of the region and at the beginning." (setq dir (replace-match "\\1/" nil nil dir))) dir) +(defun oni:split-window-interactive (dir) + "Split windows in direction DIR. + +Can also delete or switch to another window." + (interactive + (list (read-char "Direction (h,v,q,d,o): "))) + (case dir + ((?v) (split-window-vertically)) + ((?h) (split-window-horizontally)) + ((?q) (delete-other-windows)) + ((?d) (delete-window)) + ((?o) (other-window 1)))) + +(defun oni:split-window-interactively (window) + "Ask for a direction and split WINDOW that way. + +If no direction is given, don't split." + (let ((dir (read-char "Direction (h,v): "))) + (case dir + ((?v) (split-window-vertically)) + ((?h) (split-window-horizontally)) + (t window)))) + (defun oni:start-emms () "Check to see if the function `emms' exists, if not call `emms-player-mpd-connect' and assume that will have loaded it." @@ -839,6 +804,12 @@ for easy selection." (setq flymake-gui-warnings-enabled nil) (setq flymake-log-file-name (expand-file-name "~/.emacs.d/flymake.log")) (setq flymake-log-level 0) +(setq flymake-warn-line-regexp + (eval-when-compile + (regexp-opt '("warning" + "Warning" + "Missing docstring" + "String statement has no effect")))) (setq frame-title-format '(:eval (concat "emacs: " (buffer-name)))) (setq geiser-repl-history-filename "~/.emacs.d/geiser-history") (setq gtags-auto-update t) @@ -993,7 +964,6 @@ for easy selection." (add-hook 'flymake-mode-hook 'oni:flymake-mode-func) (add-hook 'go-mode-hook 'oni:go-mode-func) (add-hook 'gtags-mode-hook 'oni:gtags-mode-func) -(add-hook 'hs-minor-mode-hook 'oni:hs-minor-mode-func) (add-hook 'html-mode-hook 'oni:html-mode-func) (add-hook 'jabber-chat-mode-hook 'oni:jabber-chat-mode-func) (add-hook 'jabber-roster-mode-hook 'oni:jabber-roster-mode-func) @@ -1029,7 +999,7 @@ for easy selection." (global-set-key (kbd "") 'oni:raise-eshell) (global-set-key (kbd "C-<") 'indent-shift-left) (global-set-key (kbd "C->") 'indent-shift-right) -(global-set-key (kbd "C-@") 'er/expand-region) +(global-set-key (kbd "C-M-SPC") 'er/expand-region) (global-set-key (kbd "C-M-d") 'kill-word) (global-set-key (kbd "C-M-w") 'backward-kill-word) (global-set-key (kbd "C-S-k") 'kill-whole-line) @@ -1044,6 +1014,8 @@ for easy selection." (global-set-key (kbd "C-x C-b") 'electric-buffer-list) (global-set-key (kbd "M-n") 'idomenu) (global-set-key (kbd "\"") 'oni:self-insert-dwim) +(global-set-key (kbd "M-4") 'split-window-horizontally) +(global-set-key (kbd "C-M-4") 'split-window-vertically) (if (daemonp) (global-set-key "\C-x\C-c" 'oni:close-client-window) @@ -1062,11 +1034,10 @@ for easy selection." (add-to-list 'auto-mode-alist '("^PKGBUILD$" . shell-script-mode)) (add-to-list 'auto-mode-alist '("^\\.Xmodmap$" . xmodmap-mode)) -(add-to-list 'custom-theme-load-path - (concat custom-theme-directory "/naquadah-theme")) - (add-to-list 'debug-ignored-errors "^Can't shift all lines enough") +(add-to-list 'display-buffer-alist + '(".*" . ((bw-display-in-other-window . nil)))) (add-to-list 'display-buffer-alist '("^\\*.*\\*$" . ((bw-display-in-bottom-window . nil)))) @@ -1085,18 +1056,19 @@ for easy selection." (tool-bar-mode -1) (tooltip-mode -1) +(auto-insert-mode) +(column-number-mode) (electric-indent-mode) (electric-pair-mode) (ido-mode) (ido-ubiquitous-mode) (savehist-mode) (show-paren-mode) -(auto-insert-mode) (smex-initialize) (help-at-pt-set-timer) -(load-theme 'naquadah t) +(load-theme 'new t) (load custom-file) (load "rudel-loaddefs.el") -- cgit v1.2.3-54-g00ecf