A bunch of changes...

This commit is contained in:
Tom Willemse 2013-06-29 21:18:31 +02:00
parent eb06ac12c4
commit 5d72a0905e

View file

@ -5,22 +5,24 @@
(require 'uniquify) (require 'uniquify)
(eval-when-compile (eval-when-compile
(package-initialize)
(require 'cl) (require 'cl)
(require 'esh-io) (require 'esh-io)
(require 'esh-proc) (require 'esh-proc)
(require 'dash)) (require 'dash))
(autoload 'define-slime-contrib "slime")
(autoload 'gtags-mode "gtags" nil t) (autoload 'gtags-mode "gtags" nil t)
(autoload 'jabber-connect "jabber" nil t) (autoload 'jabber-connect "jabber" nil t)
(autoload 'jabber-message-libnotify "jabber-libnotify") (autoload 'jabber-message-libnotify "jabber-libnotify")
(autoload 'jabber-muc-libnotify "jabber-libnotify") (autoload 'jabber-muc-libnotify "jabber-libnotify")
(autoload 'jabber-send-message "jabber-chat")
(autoload 'notifications-notify "notifications")
(autoload 'php-mode "php-mode" nil t) (autoload 'php-mode "php-mode" nil t)
(autoload 'po-mode "po-mode" nil t) (autoload 'po-mode "po-mode" nil t)
(autoload 'pony-mode "pony-mode" nil t) (autoload 'pony-mode "pony-mode" nil t)
(autoload 'sawfish-mode "sawfish" nil t) (autoload 'sawfish-mode "sawfish" nil t)
(autoload 'server-running-p "server") (autoload 'server-running-p "server")
(autoload 'slime-js-minor-mode "slime-js" nil t)
(autoload 'tagedit-mode "tagedit" nil t) (autoload 'tagedit-mode "tagedit" nil t)
(autoload 'w3m-bookmark-view "w3m" nil t) (autoload 'w3m-bookmark-view "w3m" nil t)
(autoload 'w3m-goto-url "w3m" nil t) (autoload 'w3m-goto-url "w3m" nil t)
@ -95,7 +97,7 @@ FEATURE may be an unquoted feature symbol or a file name, see
(mark-defun) (mark-defun)
(indent-region (region-beginning) (region-end)))) (indent-region (region-beginning) (region-end))))
(eval-when-compile (eval-and-compile
(defun level (lst) (defun level (lst)
(let ((lsts (mapcar (lambda (l) (if (listp l) l (list l))) lst))) (let ((lsts (mapcar (lambda (l) (if (listp l) l (list l))) lst)))
(apply #'append lsts)))) (apply #'append lsts))))
@ -175,6 +177,9 @@ Also change directories to current working directory."
(interactive) (interactive)
(revert-buffer nil t nil)) (revert-buffer nil t nil))
(defun set-emacs-lisp-keys ()
(local-set-key (kbd "C-.") 'find-function))
(defun set-smartparens-keys () (defun set-smartparens-keys ()
(local-set-key [remap backward-delete-char] 'sp-backward-delete-char) (local-set-key [remap backward-delete-char] 'sp-backward-delete-char)
(local-set-key [remap delete-char] 'sp-delete-char) (local-set-key [remap delete-char] 'sp-delete-char)
@ -211,6 +216,20 @@ Also change directories to current working directory."
(stante-after "bindings" (stante-after "bindings"
(setq mode-line-default-help-echo "")) (setq mode-line-default-help-echo ""))
(stante-after auto-complete
(add-to-list 'ac-modes 'slime-repl-mode)
(setq-default ac-sources '(ac-source-imenu
ac-source-gtags
ac-source-abbrev
ac-source-yasnippet
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers
ac-source-dictionary
ac-source-functions
ac-source-symbols
ac-source-variables
ac-source-features)))
(stante-after browse-url (stante-after browse-url
(setq browse-url-browser-function 'browse-url-generic) (setq browse-url-browser-function 'browse-url-generic)
(setq browse-url-generic-program (getenv "BROWSER"))) (setq browse-url-generic-program (getenv "BROWSER")))
@ -246,7 +265,8 @@ Also change directories to current working directory."
"dailies" "work" "tasks" "dailies" "work" "tasks"
(or "bookmarks.org" (or "bookmarks.org"
"contacts.org")) eol)) "contacts.org")) eol))
(rx (or "*ielm*" "*-jabber-roster-*" "*eshell*")) (rx (or "*ielm*" "*-jabber-roster-*" "*eshell*"
"*ansi-term*"))
(rx (and "*" (or "magit" "scratch-") (1+ anything) (rx (and "*" (or "magit" "scratch-") (1+ anything)
"*"))) "*")))
desktop-clear-preserve-buffers)) desktop-clear-preserve-buffers))
@ -259,6 +279,12 @@ Also change directories to current working directory."
(setq eap-music-library "/mnt/music") (setq eap-music-library "/mnt/music")
(setq eap-playlist-library "~/music/playlists")) (setq eap-playlist-library "~/music/playlists"))
(stante-after ediff-wind
(setq ediff-window-setup-function 'ediff-setup-windows-plain))
(stante-after eltuki
(setq eltuki-blog-dir "~/documents/blog"))
(stante-after em-prompt (stante-after em-prompt
(setq eshell-highlight-prompt nil) (setq eshell-highlight-prompt nil)
(setq eshell-prompt-function 'oni-eshell-prompt) (setq eshell-prompt-function 'oni-eshell-prompt)
@ -348,11 +374,15 @@ Also change directories to current working directory."
(setq ido-ubiquitous-command-exceptions (setq ido-ubiquitous-command-exceptions
'(org-refile org-capture-refile))) '(org-refile org-capture-refile)))
(stante-after imenu
(setq imenu-auto-rescan t))
(stante-after jabber (stante-after jabber
(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo) (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)
(setq jabber-account-list (setq jabber-account-list
`((,(concat "tom@ryuslash.org/" (hostname)) `((,(concat "tom@ryuslash.org/" (hostname))
(:connection-type . ssl))))) (:connection-type . ssl))
(,(concat "ryuslash@ninthfloor.org/" (hostname))))))
(stante-after jabber-avatar (stante-after jabber-avatar
(setq jabber-avatar-cache-directory "~/.emacs.d/jabber-avatars/")) (setq jabber-avatar-cache-directory "~/.emacs.d/jabber-avatars/"))
@ -363,7 +393,7 @@ Also change directories to current working directory."
(setq jabber-chat-local-prompt-format "%t %u/%r >\n") (setq jabber-chat-local-prompt-format "%t %u/%r >\n")
(setq jabber-chat-buffer-show-avatar nil)) (setq jabber-chat-buffer-show-avatar nil))
(stante-after jabber-chat-states (stante-after jabber-chatstates
(setq jabber-chatstates-confirm nil)) (setq jabber-chatstates-confirm nil))
(stante-after jabber-history (stante-after jabber-history
@ -392,7 +422,10 @@ Also change directories to current working directory."
(setq jit-lock-defer-time 0.2)) (setq jit-lock-defer-time 0.2))
(stante-after magit (stante-after magit
(setq magit-repo-dirs '("~/projects/"))) (setq magit-repo-dirs '("~/projects/"))
(setq magit-default-tracking-name-function
'magit-default-tracking-name-branch-only)
(setq magit-diff-refine-hunk 'all))
(stante-after message (stante-after message
(setq message-send-mail-function 'message-send-mail-with-sendmail) (setq message-send-mail-function 'message-send-mail-with-sendmail)
@ -401,6 +434,9 @@ Also change directories to current working directory."
(stante-after minibuf-eldef (stante-after minibuf-eldef
(setq minibuffer-eldef-shorten-default t)) (setq minibuffer-eldef-shorten-default t))
(stante-after mouse
(setq mouse-yank-at-point t))
(stante-after org (stante-after org
(setq org-special-ctrl-a/e t)) (setq org-special-ctrl-a/e t))
@ -433,6 +469,9 @@ Also change directories to current working directory."
(stante-after slime (stante-after slime
(setq inferior-lisp-program "sbcl --noinform --no-linedit")) (setq inferior-lisp-program "sbcl --noinform --no-linedit"))
(stante-after smartparens
(setq sp-cancel-autoskip-on-backward-movement nil))
(stante-after smex (stante-after smex
(setq smex-key-advice-ignore-menu-bar t) (setq smex-key-advice-ignore-menu-bar t)
(setq smex-save-file "~/.emacs.d/smex-items")) (setq smex-save-file "~/.emacs.d/smex-items"))
@ -482,22 +521,26 @@ Also change directories to current working directory."
((css) rainbow-mode) ((css) rainbow-mode)
((emacs-lisp go html lua php python rst ruby rust sh) flycheck-mode) ((emacs-lisp go html lua php python rst ruby rust sh) flycheck-mode)
((emacs-lisp ielm) eldoc-mode) ((emacs-lisp ielm) eldoc-mode)
((emacs-lisp ielm) set-emacs-lisp-keys)
((eshell) buffer-disable-undo) ((eshell) buffer-disable-undo)
((html org prog) yas-minor-mode) ((html org prog) yas-minor-mode)
((html prog) fci-mode) ((html prog) fci-mode)
((python) smartparens-mode)
((html) tagedit-mode) ((html) tagedit-mode)
((js2) slime-js-minor-mode) ((jabber-chat) visual-line-mode)
((js2 python) smartparens-mode)
((markdown python) whitespace-mode) ((markdown python) whitespace-mode)
((prog text) auto-fill-mode) ((prog text) auto-fill-mode)
((prog) rainbow-delimiters-mode) ((prog) rainbow-delimiters-mode)
((python) jedi:setup) ((python) jedi:setup)
((slime slime-repl) set-up-slime-ac)
((smartparens) set-smartparens-keys) ((smartparens) set-smartparens-keys)
((tagedit) tagedit-add-experimental-features) ((tagedit) tagedit-add-experimental-features)
((tagedit) tagedit-add-paredit-like-keybindings) ((tagedit) tagedit-add-paredit-like-keybindings)
((text) flyspell-mode) ((text) flyspell-mode)
((vala) oni:vala-mode-func)) ((vala) oni:vala-mode-func))
(add-hook 'emacs-startup-hook 'pretty-control-l-mode) (add-hook 'emacs-startup-hook 'pretty-control-l-mode)
(add-hook 'after-make-frame-functions (add-hook 'after-make-frame-functions
'(lambda (arg) (pretty-control-l-mode))) '(lambda (arg) (pretty-control-l-mode)))
@ -515,7 +558,7 @@ Also change directories to current working directory."
(vertical-scroll-bars . nil) (vertical-scroll-bars . nil)
(menu-bar-lines . nil) (menu-bar-lines . nil)
(tool-bar-lines . nil) (tool-bar-lines . nil)
(font . "Envy Code R:pixelsize=16"))) (font . "Liberation Mono:pixelsize=16")))
(setq frame-title-format '(:eval (concat "emacs: " (buffer-name)))) (setq frame-title-format '(:eval (concat "emacs: " (buffer-name))))
(setq inhibit-local-menu-bar-menus t) (setq inhibit-local-menu-bar-menus t)
(setq message-log-max 1000) (setq message-log-max 1000)
@ -523,6 +566,7 @@ Also change directories to current working directory."
(setq use-dialog-box nil) (setq use-dialog-box nil)
(setq user-full-name "Tom Willemse") (setq user-full-name "Tom Willemse")
(setq window-combination-resize t) (setq window-combination-resize t)
(setq scroll-preserve-screen-position t)
(add-to-list 'debug-ignored-errors "^Can't shift all lines enough") (add-to-list 'debug-ignored-errors "^Can't shift all lines enough")
;; Can't be put in an eval-after-load or such because by then it will ;; Can't be put in an eval-after-load or such because by then it will
;; be too late. ;; be too late.
@ -596,7 +640,7 @@ Also change directories to current working directory."
(global-set-key (kbd "C-c c") 'org-capture) (global-set-key (kbd "C-c c") 'org-capture)
(global-set-key (kbd "C-c d c") 'desktop-clear) (global-set-key (kbd "C-c d c") 'desktop-clear)
(global-set-key (kbd "C-c d d") 'desktop-registry-change-desktop) (global-set-key (kbd "C-c d d") 'desktop-registry-change-desktop)
(global-set-key (kbd "C-c d s") 'desktop-save) (global-set-key (kbd "C-c d s") 'desktop-save-in-desktop-dir)
(global-set-key (kbd "C-c i p") 'identica-update-status-interactive) (global-set-key (kbd "C-c i p") 'identica-update-status-interactive)
(global-set-key (kbd "C-c p") 'oni:show-buffer-position) (global-set-key (kbd "C-c p") 'oni:show-buffer-position)
(global-set-key (kbd "C-c t") 'oni:raise-ansi-term) (global-set-key (kbd "C-c t") 'oni:raise-ansi-term)
@ -608,9 +652,9 @@ Also change directories to current working directory."
(global-set-key (kbd "M-2") 'split-window-below) (global-set-key (kbd "M-2") 'split-window-below)
(global-set-key (kbd "M-3") 'split-window-right) (global-set-key (kbd "M-3") 'split-window-right)
(global-set-key (kbd "M-4") 'split-window-horizontally) (global-set-key (kbd "M-4") 'split-window-horizontally)
(global-set-key (kbd "M-n") 'helm-imenu) (global-set-key (kbd "M-n") 'idomenu)
(global-set-key (kbd "M-o") 'other-window) (global-set-key (kbd "M-o") 'other-window)
(global-set-key (kbd "M-x") 'smex) (global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "\"") 'oni:self-insert-dwim) (global-set-key (kbd "\"") 'oni:self-insert-dwim)
(global-set-key [remap move-beginning-of-line] 'move-beginning-of-dwim) (global-set-key [remap move-beginning-of-line] 'move-beginning-of-dwim)
@ -630,29 +674,6 @@ Also change directories to current working directory."
(help-at-pt-set-timer) (help-at-pt-set-timer)
(windmove-default-keybindings) (windmove-default-keybindings)
;;; Popping up multiple frames out of the blue does not usually play
;;; well with (manual) tiling window managers.
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
;;; Not being able to find newly written functions in imenu is a pain.
(setq imenu-auto-rescan t)
;;; Yanking at click makes not sense to me. I normally have my cursor
;;; where it needs to point and if I *have* to use the mouse I prefer
;;; just clicking it wherever it lands, without having to drag it all
;;; the way to the proper place.
(setq mouse-yank-at-point t)
;;; Always having to move the cursor around so much after scrolling
;;; gets annoying.
(setq scroll-preserve-screen-position t)
;;; I store my blog posts in `~/documents/blog', not the default
;;; `~/Blog'.
(setq eltuki-blog-dir "~/documents/blog")
(setq sp-cancel-autoskip-on-backward-movement nil)
(defun oni:scroll-down-or-prev-page (arg) (defun oni:scroll-down-or-prev-page (arg)
"Either scroll down or go to the previous page. "Either scroll down or go to the previous page.
@ -684,31 +705,9 @@ Depending on the value of `buffer-narrowed-p'."
(global-set-key (kbd "<prior>") 'oni:scroll-down-or-prev-page) (global-set-key (kbd "<prior>") 'oni:scroll-down-or-prev-page)
(global-set-key (kbd "<next>") 'oni:scroll-up-or-next-page) (global-set-key (kbd "<next>") 'oni:scroll-up-or-next-page)
;;;; Auto-complete
(setq-default ac-sources '(ac-source-imenu
ac-source-gtags
ac-source-abbrev
ac-source-yasnippet
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers
ac-source-dictionary
ac-source-functions
ac-source-symbols
ac-source-variables
ac-source-features))
;;;; Magit
(setq magit-default-tracking-name-function
'magit-default-tracking-name-branch-only)
(setq magit-diff-refine-hunk 'all)
;;; Finally, load any `customize' settings. ;;; Finally, load any `customize' settings.
(load custom-file) (load custom-file)
(autoload 'notifications-notify "notifications")
(autoload 'jabber-send-message "jabber-chat")
(defmacro oni:email (user at host dot com) (defmacro oni:email (user at host dot com)
"Turn arguments into an email address. "Turn arguments into an email address.
@ -719,7 +718,6 @@ DOT are intentionally being skipped."
(defun oni:after-save-func () (defun oni:after-save-func ()
"Function for `after-save-hook'." "Function for `after-save-hook'."
(oni:compile-el)
(executable-make-buffer-file-executable-if-script-p) (executable-make-buffer-file-executable-if-script-p)
(let* ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile")) (let* ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile"))
(TAGSp (not (string= "" (shell-command-to-string (TAGSp (not (string= "" (shell-command-to-string
@ -765,15 +763,6 @@ DOT are intentionally being skipped."
"Generate a hex color by taking the first 6 characters of OBJECT's MD5 sum." "Generate a hex color by taking the first 6 characters of OBJECT's MD5 sum."
(format "#%s" (substring (md5 object) 0 6))) (format "#%s" (substring (md5 object) 0 6)))
(defun oni:compile-el ()
"Compile the current buffer file if it is an .el file."
(let* ((full-file-name (buffer-file-name))
(file-name (file-name-nondirectory full-file-name))
(suffix (file-name-extension file-name)))
(if (and (not (string-equal file-name ".dir-locals.el"))
(string-equal suffix "el"))
(byte-compile-file full-file-name))))
(defun oni:css-mode-func () (defun oni:css-mode-func ()
"Function for `css-mode-hook'." "Function for `css-mode-hook'."
(local-set-key "\C-j" 'oni:newline-and-indent)) (local-set-key "\C-j" 'oni:newline-and-indent))
@ -867,8 +856,7 @@ If COUNT has been specified indent by that much, otherwise look at
(defun oni:js2-mode-func () (defun oni:js2-mode-func ()
"Function for `js2-mode-hook'." "Function for `js2-mode-hook'."
(oni:js-mode-func) (oni:js-mode-func))
(local-set-key (kbd "<f5>") #'slime-js-reload))
(defun oni:lua-mode-func() (defun oni:lua-mode-func()
"Function for `lua-mode-hook'." "Function for `lua-mode-hook'."
@ -1146,11 +1134,3 @@ If no direction is given, don't split."
(define-key yas-minor-mode-map (kbd "TAB") nil) (define-key yas-minor-mode-map (kbd "TAB") nil)
(define-key yas-minor-mode-map [(tab)] nil) (define-key yas-minor-mode-map [(tab)] nil)
(define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand)) (define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand))
(defvar oni:mailbox-map
'("top" ("menu"
("ryulash.org" . "ryuslash")
("ninthfloor" . "ninthfloor")
("gmail" . "gmail")
("aethon" . "aethon")))
"A mailbox map for use with `tmm-prompt'.")