From a281f040cd35dffe171d5b7d6b00fe03163be6a0 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 17 Feb 2013 23:09:24 +0100 Subject: Move .emacs.d to emacs Since it's no longer placed directly in the home directory it doesn't need to be named exacly the same. --- emacs/site-lisp/Makefile | 7 + emacs/site-lisp/dzen.el | 86 ++++++ emacs/site-lisp/eltuki.el | 232 +++++++++++++++ emacs/site-lisp/ext.el | 56 ++++ emacs/site-lisp/metalexpress.el | 80 ++++++ emacs/site-lisp/mu4e-init.el | 54 ++++ emacs/site-lisp/newsticker-init.el | 6 + emacs/site-lisp/oni.el | 574 +++++++++++++++++++++++++++++++++++++ emacs/site-lisp/org-init.el | 164 +++++++++++ emacs/site-lisp/quick-edit-mode.el | 74 +++++ emacs/site-lisp/wm-init.el | 3 + 11 files changed, 1336 insertions(+) create mode 100644 emacs/site-lisp/Makefile create mode 100644 emacs/site-lisp/dzen.el create mode 100644 emacs/site-lisp/eltuki.el create mode 100644 emacs/site-lisp/ext.el create mode 100644 emacs/site-lisp/metalexpress.el create mode 100644 emacs/site-lisp/mu4e-init.el create mode 100644 emacs/site-lisp/newsticker-init.el create mode 100644 emacs/site-lisp/oni.el create mode 100644 emacs/site-lisp/org-init.el create mode 100644 emacs/site-lisp/quick-edit-mode.el create mode 100644 emacs/site-lisp/wm-init.el (limited to 'emacs/site-lisp') diff --git a/emacs/site-lisp/Makefile b/emacs/site-lisp/Makefile new file mode 100644 index 0000000..bbccbb7 --- /dev/null +++ b/emacs/site-lisp/Makefile @@ -0,0 +1,7 @@ +DESTDIR:=$(DESTDIR)/site-lisp +objects=dzen.elc dzen.el eltuki.elc eltuki.el ext.elc ext.el \ + metalexpress.elc metalexpress.el mu4e-init.elc mu4e-init.el \ + newsticker-init.elc newsticker-init.el oni.elc oni.el org-init.elc \ + org-init.el quick-edit-mode.elc quick-edit-mode.el + +include ../../dotfiles.mk diff --git a/emacs/site-lisp/dzen.el b/emacs/site-lisp/dzen.el new file mode 100644 index 0000000..6cc3eae --- /dev/null +++ b/emacs/site-lisp/dzen.el @@ -0,0 +1,86 @@ +;;; dzen.el --- Control DZEN2 from emacs + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen +;; Keywords: convenience + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(require 'newst-backend) +(require 'sawfish) + +(defvar dzen-process nil + "Dzen2's process.") + +(defvar dzen-timer nil + "Timer used to update the dzen line.") + +(defun get-mail-count (account) + (length (directory-files (concat "/home/slash/documents/mail/" + account "/inbox/new") nil "^[^.]"))) + +(defun dzen-update () + (let ((strl "") + (strc (if (boundp 'metal-express-radio-currently-playing) + metal-express-radio-currently-playing + "")) + (strr (format + "jabber: %s ryu: %d gm: %d aet: %d 9n: %d rss: %d\n" + (oni:current-jabber-status) + (get-mail-count "ryuslash.org") + (get-mail-count "gmail") + (get-mail-count "aethon") + (get-mail-count "ninthfloor") + (newsticker--stat-num-items-total 'new)))) + (process-send-string + "dzen2" (format "%s^p(_CENTER)^p(-%d)%s^p(_RIGHT)^p(-%d)%s" + strl + (* (floor (/ (length strc) 2)) 8) strc + (+ 8 (* 8 (length strr))) strr)))) + +(defun dzen-start () + (interactive) + (if (or (null dzen-process) (not (process-live-p dzen-process))) + (progn + (setq dzen-process + (start-process "dzen2" "*dzen2*" "dzen2" + "-w" "1920" + "-fn" "Monaco-10" + "-bg" "#222224" + "-fg" "#eeeeec" + "-y" "1060")) + (dzen-update) + (setq dzen-timer (run-with-timer 1 1 #'dzen-update))) + (message "Dzen2 already running"))) + +(defun dzen-stop () + (interactive) + (if (and dzen-process (process-live-p dzen-process)) + (progn + (when dzen-timer + (cancel-timer dzen-timer)) + (kill-process "dzen2")) + (message "Dzen2 is not running")) + (setq dzen-process nil + dzen-timer nil)) + +(provide 'dzen) +;;; dzen.el ends here diff --git a/emacs/site-lisp/eltuki.el b/emacs/site-lisp/eltuki.el new file mode 100644 index 0000000..224e9ab --- /dev/null +++ b/emacs/site-lisp/eltuki.el @@ -0,0 +1,232 @@ +;;; eltuki.el --- Tekuti functions + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen +;; Keywords: convenience + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Tekuti functions. + +;;; Code: + +(require 'org) + +(defgroup eltuki + nil + "tekuti functions in Emacs." + :group 'external) + +(defcustom eltuki-blog-dir "~/blog" + "Plain blog post directory, not the git repository." + :group 'eltuki + :type 'string) + +(defcustom eltuki-default-status "publish" + "Default status to use when status is unknown." + :group 'eltuki + :type 'string) + +(defcustom eltuki-default-comment-status "open" + "Default status for comments." + :group 'eltuki + :type 'string) + +(define-skeleton eltuki-post + "Create a post template for eltuki." + "" + "#+TITLE: " (skeleton-read "Title: ") "\n" + "#+TIMESTAMP: \n" + "#+TAGS: " (skeleton-read "Tags (comma separated): ") "\n" + "\n" + _) + +(defun eltuki-new-post () + (interactive) + (switch-to-buffer (get-buffer-create "*eltuki*")) + (org-mode) + (eltuki-post)) + +(defun eltuki-get-title () + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+TITLE: \\(.*\\)$" nil t) + (buffer-substring-no-properties + (match-beginning 1) (match-end 1)) + (error "Post has no title.")))) + +(defun eltuki-set-title (title) + (interactive "MTitle: ") + (setq title (concat " " title)) + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+TITLE:\\(.*\\)$" nil t) + (replace-match title t t nil 1) + (insert "#+TITLE:" title "\n") + (unless (= (char-after) ?\n) + (insert-char ?\n))))) + +(defun eltuki-get-timestamp () + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+TIMESTAMP: \\([[:digit:]]+\\)$" nil t) + (match-string 1) + (format-time-string "%s")))) + +(defun eltuki-set-timestamp () + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((newtime (format-time-string " %s"))) + (if (re-search-forward "^#\\+TIMESTAMP:\\(.*\\)$" nil t) + (replace-match newtime nil t nil 1) + (when (search-forward "\n\n" nil t) + (backward-char)) + (insert "#+TIMESTAMP:" newtime "\n"))))) + +(defun eltuki-get-tags () + (save-excursion + (goto-char (point-min)) + (when (re-search-forward "^#\\+TAGS: \\(.*\\)$" nil t) + (buffer-substring-no-properties + (match-beginning 1) (match-end 1))))) + +(defun eltuki-set-tags (tags) + (interactive "MTags: ") + (setq tags (concat " " tags)) + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+TAGS:\\(.*\\)$" nil t) + (replace-match tags t t nil 1) + (when (search-forward "\n\n" nil t) + (backward-char)) + (insert "#+TAGS:" tags "\n")))) + +(defun eltuki-get-status () + (save-excursion + (goto-char (point-min)) + (if (re-search-forward "^#\\+STATUS: \\(draft\\|publish\\)$" nil t) + (buffer-substring-no-properties + (match-beginning 1) (match-end 1)) + eltuki-default-status))) + +(defun eltuki-toggle-status () + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((newstatus (if (string= (eltuki-get-status) "draft") + " publish" + " draft"))) + (if (re-search-forward "^#\\+STATUS:\\(.*\\)$" nil t) + (replace-match newstatus t t nil 1) + (when (search-forward "\n\n" nil t) + (backward-char)) + (insert "#+STATUS:" newstatus "\n"))))) + +(defun eltuki-get-comment-status () + (save-excursion + (goto-char (point-min)) + (if (re-search-forward + "^#\\+COMMENTSTATUS: \\(open\\|closed\\)$" nil t) + (buffer-substring-no-properties + (match-beginning 1) (match-end 1)) + eltuki-default-comment-status))) + +(defun eltuki-toggle-comment-status () + (interactive) + (save-excursion + (goto-char (point-min)) + (let ((newstatus (if (string= (eltuki-get-comment-status) "closed") + " open" + " closed"))) + (if (re-search-forward "^#\\+COMMENTSTATUS:\\(.*\\)$" nil t) + (replace-match newstatus t t nil 1) + (when (search-forward "\n\n" nil t) + (backward-char)) + (insert "#+COMMENTSTATUS:" newstatus "\n"))))) + +(defun eltuki-slugify-string (str) + (while (string-match "[^a-zA-Z0-9 ]+" str) + (setq str (replace-match "" nil t str))) + (while (string-match " +" str) + (setq str (replace-match "-" nil t str))) + (downcase str)) + +(defun eltuki-get-directory () + (concat + eltuki-blog-dir "/" + (format-time-string "%Y%%2f%m%%2f%d%%2f") + (eltuki-slugify-string (eltuki-get-title)))) + +(defun eltuki-write-content (dir) + (let ((org-export-with-toc nil) + (filename (concat dir "/content"))) + (with-current-buffer (org-export-region-as-html + (point-min) (point-max) t "*eltuki-html*") + (write-region (point-min) (point-max) filename) + (kill-buffer)) + filename)) + +(defun eltuki-write-metadata (dir) + (let ((timestamp (eltuki-get-timestamp)) + (tags (eltuki-get-tags)) + (status (eltuki-get-status)) + (title (eltuki-get-title)) + (name (eltuki-slugify-string (eltuki-get-title))) + (commentstatus (eltuki-get-comment-status)) + (filename (concat dir "/metadata"))) + (with-temp-buffer + (insert "timestamp: " timestamp "\n" + "tags: " tags "\n" + "status: " status "\n" + "title: " title "\n" + "name: " name "\n" + "comment_status: " commentstatus) + (write-region (point-min) (point-max) filename)) + filename)) + +(defun eltuki-save-org (buffer dir) + (let ((filename (concat dir "/post.org"))) + (with-current-buffer buffer + (write-file filename)) + filename)) + +(defun eltuki-git-add (file) + (shell-command (concat "cd " eltuki-blog-dir "; git add '" (expand-file-name file) "'"))) + +(defun eltuki-commit () + (shell-command (concat "cd " eltuki-blog-dir "; git commit -m \"new post: \\\"" (eltuki-get-title) + "\\\"\""))) + +(defun eltuki-finish () + (interactive) + (let ((buffer (or (get-buffer "*eltuki*") + (current-buffer))) + (dest (eltuki-get-directory))) + (unless (file-exists-p dest) + (mkdir dest)) + + (mapc #'eltuki-git-add + (list (eltuki-write-content dest) + (eltuki-write-metadata dest) + (eltuki-save-org buffer dest))) + + (eltuki-commit) + (kill-buffer buffer))) + +(provide 'eltuki) +;;; eltuki.el ends here diff --git a/emacs/site-lisp/ext.el b/emacs/site-lisp/ext.el new file mode 100644 index 0000000..d6abaa6 --- /dev/null +++ b/emacs/site-lisp/ext.el @@ -0,0 +1,56 @@ +;;; ext.el --- More emacs functions + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen +;; Keywords: local + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(defadvice org-agenda-redo (after ext:org-agenda-redo-add-appts) + "Pressing `r' on the agenda will also add appointments." + (progn + (setq appt-time-msg-list nil) + (org-agenda-to-appt))) + +(defun ext:flymake-pyflakes-init () + "Initialize function for flymake with pyflakes." + (let* ((temp-file (flymake-init-create-temp-buffer-copy + 'flymake-create-temp-inplace)) + (local-file (file-relative-name temp-file (file-name-directory + buffer-file-name)))) + (list "pycheck.sh" (list local-file)))) + +(defun ext:comp-finish-function (buf str) + "Don't show compilation window if everything went ok" + (if (string-match "exited abnormally" str) + ;; there were errors + (message "compilation errors, press C-x ` to visit") + ;; no errors, make the compilation window go away in 0.5 seconds + (run-at-time 0.5 nil 'delete-windows-on buf) + (message "No compilation errors!"))) + +(defun ext:reload-buffer () + "Reload current buffer." + (interactive) + (revert-buffer nil t nil)) + +(provide 'ext) +;;; ext.el ends here diff --git a/emacs/site-lisp/metalexpress.el b/emacs/site-lisp/metalexpress.el new file mode 100644 index 0000000..0c4539a --- /dev/null +++ b/emacs/site-lisp/metalexpress.el @@ -0,0 +1,80 @@ +;;; metalexpress.el --- Listen to Metal Express Radio + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen +;; Keywords: multimedia + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Functions for easily listening to Metal Express Radio. + +;;; Code: + +(defgroup metal-express-radio nil + "Group for the Metal Express Radio listening functions." + :group 'multimedia) + +(defcustom metal-express-radio-playlist-url + "http://usa7-vn.mixstream.net/listen/8248.m3u" + "The URL of the Metal Express Radio stream." + :group 'metal-express-radio + :type 'string) + +(defcustom metal-express-radio-song-changed-hook nil + "Hook run when the currently playing song changes." + :type 'hook + :group 'metal-express-radio) + +(defvar metal-express-radio-currently-playing nil + "The currently playing song.") + +(defun mer-proc-filter (proc string) + (when (string-match "^ICY Info: StreamTitle='\\(.*\\)';StreamUrl='';" + string) + (setq metal-express-radio-currently-playing (match-string 1 string)) + (apply 'run-hooks metal-express-radio-song-changed-hook))) + +(defun metal-express-radio-echo-currently-playing () + (interactive) + (message metal-express-radio-currently-playing)) + +(defun metal-express-radio-notify () + (interactive) + (notifications-notify :title "Now playing:" + :body metal-express-radio-currently-playing)) + +;;;###autoload +(defun metal-express-radio-start () + "Start listening to Metal Express Radio." + (interactive) + (let ((proc (start-process "metalexpress" "*Metal Express Radio*" + "mplayer" metal-express-radio-playlist-url))) + (set-process-filter proc #'mer-proc-filter))) + +(defun metal-express-radio-stop () + "Stop listening to Metal Express Radio." + (interactive) + (kill-process (get-buffer-process "*Metal Express Radio*")) + (setq metal-express-radio-currently-playing nil)) + +(add-hook 'metal-express-radio-song-changed-hook + 'metal-express-radio-echo-currently-playing) +(add-hook 'metal-express-radio-song-changed-hook + 'metal-express-radio-notify) + +(provide 'metalexpress) +;;; metalexpress.el ends here diff --git a/emacs/site-lisp/mu4e-init.el b/emacs/site-lisp/mu4e-init.el new file mode 100644 index 0000000..258a6ef --- /dev/null +++ b/emacs/site-lisp/mu4e-init.el @@ -0,0 +1,54 @@ +;;; mu4e-init.el --- mu4e initialization + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(require 'oni) + +(oni:define-mailbox "aethon" + (oni:email thomas at aethon dot nl) + (expand-file-name "~/documents/work/aethon/signature.txt")) +(oni:define-mailbox "gmail" (oni:email ryuslash at gmail dot com)) +(oni:define-mailbox "ninthfloor" + (oni:email ryuslash at ninthfloor dot org)) +(oni:define-mailbox "ryuslash" (oni:email tom at ryuslash dot org) + nil "ryuslash.org") + +(setq mu4e-headers-date-format "%d-%m %H:%M") +(setq mu4e-headers-fields '((:date . 11) + (:flags . 6) + (:to . 22) + (:from . 22) + (:subject))) +(setq mu4e-headers-show-threads nil) +(setq mu4e-headers-sort-revert nil) +(setq mu4e-html2text-command "w3m -dump -T text/HTML -cols 72") +(setq mu4e-my-email-addresses (list + (oni:email tom at ryuslash dot org) + (oni:email ryuslash at gmail dot com) + (oni:email ryuslash at ninthfloor dot org) + (oni:email thomas at aethon dot nl))) + +(provide 'mu4e-init) +;;; mu4e-init.el ends here diff --git a/emacs/site-lisp/newsticker-init.el b/emacs/site-lisp/newsticker-init.el new file mode 100644 index 0000000..c393df1 --- /dev/null +++ b/emacs/site-lisp/newsticker-init.el @@ -0,0 +1,6 @@ +(setq newsticker-automatically-mark-items-as-old nil) +(setq newsticker-html-renderer 'w3m-region) +(setq newsticker-obsolete-item-max-age 604800) +(setq newsticker-use-full-width nil) + +(provide 'newsticker-init) diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el new file mode 100644 index 0000000..80d1b01 --- /dev/null +++ b/emacs/site-lisp/oni.el @@ -0,0 +1,574 @@ +;;; oni.el --- Functions for emacs + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen +;; Keywords: local + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(autoload 'notifications-notify "notifications") +(autoload 'jabber-send-message "jabber-chat") + +(defmacro oni:email (user at host dot com) + "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))) + +(defun oni:after-save-func () + "Function for `after-save-hook'." + (oni:compile-el) + (executable-make-buffer-file-executable-if-script-p) + (let* ((dom-dir (locate-dominating-file (buffer-file-name) "Makefile")) + (TAGSp (not (string= "" (shell-command-to-string + (concat "grep \"^TAGS:\" " dom-dir "Makefile")))))) + (when (and dom-dir TAGSp) + (shell-command + (concat "make -C " dom-dir " TAGS >/dev/null 2>&1"))))) + +(defun oni:appt-display-window-and-jabber (min-to-app new-time appt-msg) + "Send a message to my phone jabber account." + (jabber-send-message (car jabber-connections) "phone@ryuslash.org" + nil (format "%s%s (in %s minutes)" + new-time appt-msg min-to-app) nil) + (appt-disp-window min-to-app new-time appt-msg)) +;; (jabber-send-message (car jabber-connections) +;; "aethon@muc.ryuslash.org" nil "Hi, I'm a programmatic message; this +;; upens up possibilities :)" "groupchat") +(defun oni:before-save-func () + "Function for `before-save-hook'." + (if (eq major-mode 'html-mode) + (oni:replace-html-special-chars)) + (if (not (eq major-mode 'markdown-mode)) + (delete-trailing-whitespace))) + +(defun oni:c-mode-func () + "Function for `c-mode-hook'." + (local-set-key [f9] 'compile) + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(defun oni:close-client-window () + "Close a client's frames." + (interactive) + (server-save-buffers-kill-terminal nil)) + +(defun oni:color-for (object) + "Generate a hex color by taking the first 6 characters of OBJECT's MD5 sum." + (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 () + "Function for `css-mode-hook'." + (local-set-key "\C-j" 'oni:newline-and-indent) + (rainbow-mode)) + +(defun oni:current-jabber-status () + "Return a string representing the current jabber status." + (or (and (not *jabber-connected*) "Offline") + (and (not (string= *jabber-current-status* "")) + *jabber-current-status*) + "Online")) + +(defun oni:diary-display-func () + "Function for `diary-display-hook'." + (diary-fancy-display)) + +(defun oni:emacs-lisp-mode-func () + "Function for `emacs-lisp-mode-hook'." + (eldoc-mode)) + +(defun oni:emacs-startup-func () + "Function for `emacs-init-hook'." + (require 'auto-complete-config) + (ac-config-default)) + +(defun oni:go-mode-func () + "Function for `go-mode-hook'." + (setq indent-tabs-mode nil) + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(defun oni:gtags-mode-func () + "Function for `gtags-mode-hook'." + (local-set-key "\M-," 'gtags-find-tag) + (local-set-key "\M-." 'gtags-find-rtag)) + +(defun oni:haskell-mode-func () + "Function for `haskell-mode-hook'." + (turn-on-haskell-indentation)) + +(defun oni:html-mode-func () + "Function for `html-mode-hook'." + (yas-minor-mode) + (fci-mode) + (flycheck-mode)) + +(defun oni:ido-init () + "Initialization functionn for ido." + (setq ido-ignore-buffers + (list "^\\` " "^irc\\." "^\\#" "^\\*Customize Option:" + (eval-when-compile + (regexp-opt + '("*-jabber-roster-*" + "*Messages*" + "*fsm-debug*" + "*magit-process*" + "*magit-edit-log*" + "*Backtrace*")))))) + +(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) + (list (line-beginning-position) + (line-end-position) + current-prefix-arg))) + (if count + (setq count (prefix-numeric-value count)) + (setq count tab-width)) + (when (> count 0) + (let ((deactivate-mark nil)) + (save-excursion + (goto-char start) + (while (< (point) end) + (if (and (< (current-indentation) count) + (not (looking-at "[ \t]*$"))) + (error "Can't shift all lines enough")) + (forward-line)) + (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) + (list (line-beginning-position) + (line-end-position) + current-prefix-arg))) + (let ((deactivate-mark nil)) + (if count + (setq count (prefix-numeric-value count)) + (setq count tab-width)) + (indent-rigidly start end count))) + +(defun oni:jabber-alert-message-func (from buffer text title) + (notifications-notify :title title + :body text)) + +(defun oni:jabber-chat-mode-func () + "Function for `jabber-chat-mode-hook'." + (visual-line-mode) + (setq mode-line-format (append (cddr jabber-chat-header-line-format) + '(global-mode-string)) + header-line-format nil)) + +(defun oni:jabber-init () + "Initialization function for jabber." + (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)) + +(defun oni:jabber-roster-mode-func () + "Function for `jabber-roster-mode-hook'." + (setq mode-line-format + (list (propertize " %m" 'face 'mode-line-buffer-id)))) + +(defun oni:java-mode-func () + "Function for `java-mode-hook'." + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(defun oni:js-mode-func () + "Function for `js-mode-hook'." + (rainbow-delimiters-mode) + (local-set-key "\C-j" 'oni:newline-and-indent)) + +(defun oni:js2-mode-func () + "Function for `js2-mode-hook'." + (oni:prog-mode-func) + (oni:js-mode-func) + (local-set-key (kbd "") #'slime-js-reload) + (slime-js-minor-mode)) + +(defun oni:kill-region-or-backward-char () + "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 () + "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 () + "Either `kill-region' or `kill-line'." + (interactive) + (if (region-active-p) + (kill-region (region-beginning) (region-end)) + (kill-line))) + +(defun oni:lua-mode-func() + "Function for `lua-mode-hook'." + (local-unset-key (kbd ")")) + (local-unset-key (kbd "]")) + (local-unset-key (kbd "}")) + (flycheck-mode)) + +(defun oni:magit-log-edit-mode-func () + "Function for `magit-log-edit-mode-hook'." + (auto-fill-mode) + (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 comment-auto-fill-only-comments nil) + (setq-local whitespace-style '(face trailing)) + (auto-fill-mode) + (whitespace-mode)) + +(defun oni:message-mode-func () + "Function for `message-mode-hook'." + (setq-local comment-auto-fill-only-comments nil) + (auto-fill-mode) + (flyspell-mode)) + +(defun oni:mini-fix-timestamp-string (date-string) + "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) + date-string (replace-regexp-in-string "Apr" "04" date-string) + date-string (replace-regexp-in-string "May" "05" date-string) + date-string (replace-regexp-in-string "Jun" "06" date-string) + date-string (replace-regexp-in-string "Jul" "07" date-string) + date-string (replace-regexp-in-string "Aug" "08" date-string) + date-string (replace-regexp-in-string "Sep" "09" date-string) + date-string (replace-regexp-in-string "Oct" "10" date-string) + date-string (replace-regexp-in-string "Nov" "11" date-string) + date-string (replace-regexp-in-string "Dec" "12" date-string)) + (string-match + "^\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{4\\}\\)$" + date-string) + (format "%s-%s-%s" + (match-string 3 date-string) + (match-string 2 date-string) + (match-string 1 date-string))) + +(defun oni:move-beginning-of-dwim () + "Move to beginning of line either after indentation or before." + (interactive) + (let ((start (point))) + (back-to-indentation) + (if (= start (point)) + (beginning-of-line)))) + +(defun oni:move-end-of-dwim () + "Move to end of line, either before any comments or after." + (interactive) + (let ((start (point)) + (eolpos (line-end-position))) + (beginning-of-line) + (if (and comment-start + (comment-search-forward eolpos t)) + (progn + (search-backward-regexp (concat "[^ \t" comment-start "]")) + (forward-char) + + (when (or (bolp) + (= start (point))) + (end-of-line))) + (end-of-line)))) + +(defun oni:myepisodes-formatter (plist) + "Format RSS items from MyEpisodes as org tasks. +PLIST contains all the pertinent information." + (let ((str (plist-get plist :title))) + (string-match + "^\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]\\[ \\([^\]]+\\) \\]$" + str) + (let* ((title (match-string 1 str)) + (episode (match-string 2 str)) + (name (match-string 3 str)) + (date (oni:mini-fix-timestamp-string (match-string 4 str)))) + (format "* ACQUIRE %s %s - %s \n SCHEDULED: <%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)))) + (or (and (char-equal (char-before) ?{) + (char-equal (char-after) ?})) + (and (char-equal (char-before) ?\() + (char-equal (char-after) ?\))))) + (save-excursion (newline-and-indent))) + (newline-and-indent)) + +(defun oni:org-mode-func () + "Function for `org-mode-hook'." + (auto-fill-mode) + (yas-minor-mode) + (setq-local comment-auto-fill-only-comments nil)) + +(defun oni:php-mode-func () + "Function for `php-mode-hook'." + (local-set-key "\C-j" 'oni:newline-and-indent) + (c-set-offset 'arglist-intro '+) + (c-set-offset 'arglist-close '0) + (rainbow-delimiters-mode) + (setq-local fci-rule-column 80) + (flycheck-mode)) + +(defun oni:prog-mode-func () + "Function for `prog-mode-hook'." + (rainbow-delimiters-mode) + (fci-mode) + (yas-minor-mode) + (auto-fill-mode)) + +(defun oni:python-mode-func () + "Function for `python-mode-hook'." + (flycheck-mode) + (local-set-key (kbd "C->") 'python-indent-shift-right) + (local-set-key (kbd "C-<") 'python-indent-shift-left) + (set (make-local-variable 'electric-indent-chars) nil) + (rainbow-delimiters-mode) + (setq fci-rule-column 79 + fill-column 72) + (setq-local whitespace-style '(tab-mark)) + (fci-mode) + (whitespace-mode)) + +(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") + (let ((buffer (get-buffer "*ansi-term*"))) + (if (and buffer (not arg)) + (switch-to-buffer buffer) + (call-interactively 'ansi-term)))) + +(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." + (interactive (list (if current-prefix-arg + (read-string "Mode: ") + nil))) + (let* ((bname (if mode + (concat "*" mode "-scratch*") + "*scratch*")) + (buffer (get-buffer bname)) + (mode-sym (intern (concat mode "-mode")))) + + (unless buffer + (setq buffer (generate-new-buffer bname)) + (with-current-buffer buffer + (when (fboundp mode-sym) + (funcall mode-sym)))) + + (select-window (display-buffer buffer)))) + +(defun oni:replace-html-special-chars () + "Replace special characters with HTML escaped entities." + (oni:replace-occurrences "é" "é")) + +(defun oni:replace-occurrences (from to) + "Replace all occurrences of FROM with TO in the current buffer." + (save-excursion + (goto-char (point-min)) + (while (search-forward from nil t) + (replace-match to)))) + +(defun oni:request-pull () + "Start a mail to request pulling from a git repository." + (interactive) + (let* ((default-directory + (expand-file-name + (or (locate-dominating-file default-directory ".git") + (magit-read-top-dir nil)))) + (refs (magit-list-interesting-refs magit-uninteresting-refs)) + (from (cdr (assoc (completing-read "From: " refs) refs))) + (url (read-from-minibuffer "Pull URL: ")) + (to (symbol-name (read-from-minibuffer "Up to (HEAD): " + nil nil t nil "HEAD"))) + (patchp (and current-prefix-arg (listp current-prefix-arg)))) + (message "Requesting pull for %s from %s to %s at %s with%s patch" + default-directory from to url (if patchp "" "out")) + + (compose-mail + nil (concat + "Requesting pull for " + (file-name-base (directory-file-name default-directory)))) + + (save-excursion + (goto-char (point-max)) + (insert + (shell-command-to-string + (concat "git --git-dir='" default-directory ".git' --work-tree='" + default-directory "' request-pull " (when patchp "-p ") + from " " url " " to)))))) + +(defun oni:rst-mode-func () + "Function for `rst-mode-hook'." + (auto-fill-mode)) + +(defun oni:self-insert-dwim () + "Execute self insert, but when the region is active call self +insert at the end of the region and at the beginning." + (interactive) + (if (region-active-p) + (let ((electric-pair-mode nil) + (beginning (region-beginning)) + (end (region-end))) + (goto-char end) + (self-insert-command 1) + (save-excursion + (goto-char beginning) + (self-insert-command 1))) + (self-insert-command 1))) + +(defun oni:shorten-dir (dir) + "Shorten a directory, (almost) like fish does it." + (while (string-match "\\(/\\.?[^./]\\)[^/]+/" dir) + (setq dir (replace-match "\\1/" nil nil dir))) + dir) + +(defun oni:show-buffer-position () + "Show the position in the current buffer." + (interactive) + (message (format "%d:%d" (line-number-at-pos) (current-column)))) + +(defun oni:show-org-index () + "Show the index of my org files." + (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. + +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-python-test-mail-server () + "Run the python test mailserver." + (interactive) + (start-process "python-test-mail-server" "*py-mail-server*" "python" "-m" + "smtpd" "-n" "-c" "DebuggingServer" "localhost:1025")) + +(defun oni:stop-python-test-mail-server () + "Stop the python test mailserver." + (interactive) + (kill-process "python-test-mail-server")) + +(defun oni:term-mode-func () + "Function for `term-mode-hook'." + (setq truncate-lines nil)) + +(defun oni:texinfo-mode-func () + "Function for `texinfo-mode-hook'." + (setq-local comment-auto-fill-only-comments nil) + (auto-fill-mode)) + +(defun oni:write-file-func () + "Function for `write-file-hooks'." + (time-stamp)) + +(defun oni:yas-minor-mode-func () + "Function for `yas-minor-mode-hook'." + (define-key yas-minor-mode-map (kbd "TAB") nil) + (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") + ("ninthfloor" . "ninthfloor") + ("gmail" . "gmail") + ("aethon" . "aethon"))) + "A mailbox map for use with `tmm-prompt'.") + +(provide 'oni) +;;; oni.el ends here diff --git a/emacs/site-lisp/org-init.el b/emacs/site-lisp/org-init.el new file mode 100644 index 0000000..4033c30 --- /dev/null +++ b/emacs/site-lisp/org-init.el @@ -0,0 +1,164 @@ +;;; org-init.el --- Org initialization + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen +;; Keywords: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; + +;;; Code: + +(require 'appt) +(require 'oni) +(require 'org-contacts) +(require 'org-habit) +(require 'org-protocol) + +(autoload 'org-clocking-p "org-clock") + +(eval-after-load "org-crypt" + '(org-crypt-use-before-save-magic)) + +(defun oni:note-template () + (concat + "* %<%c>\n" + " :DIRECTORY: =" default-directory "=\n" + (when (buffer-file-name) " :FILE: [[file:%F][%F]]\n") + (when (org-clocking-p) " :TASK: %K\n") + "\n %?")) + +(defun oni:org-maybe-outline-path () + (let ((outline-path (org-format-outline-path (org-get-outline-path)))) + (unless (string= outline-path "") + (setq outline-path (concat "[ " outline-path " ] "))) + outline-path)) + +(defun oni:set-org-agenda-files () + "Set `org-agenda-files` according to the current time." + (interactive) + (let* ((current-time (decode-time)) + (current-hour (nth 2 current-time)) + (current-dow (nth 6 current-time))) + (if (or (= current-dow 6) (= current-dow 0) ; Saturday or Sunday + (< current-hour 9) (>= current-hour 17)) + (setq org-agenda-files + (append oni:personal-agenda-files oni:common-agenda-files)) + (setq org-agenda-files + (append oni:work-agenda-files oni:common-agenda-files))))) + +(defvar oni:personal-agenda-files + (list (expand-file-name "~/documents/org/tasks")) + "My personal agenda, should only show up at times I don't have + to work.") + +(defvar oni:work-agenda-files + (list (expand-file-name "~/documents/org/work")) + "My work agenda, should only show up at times I work.") + +(defvar oni:common-agenda-files + (list (expand-file-name "~/documents/org/dailies") + (expand-file-name "~/documents/org/misc/contacts.org") + (expand-file-name "~/documents/org/misc/bookmarks.org")) + "Agenda files that are work-agnostic, should always show up.") + +(setq org-agenda-custom-commands + '(("P" . "Personal only") + ("Pa" "Personal agenda" agenda "" + ((org-agenda-files (append oni:personal-agenda-files + oni:common-agenda-files)))) + ("Pt" "Personal todo" todo "" + ((org-agenda-files (append oni:personal-agenda-files + oni:common-agenda-files)))) + ("W" . "Work only") + ("Wa" "Work agenda" agenda "" + ((org-agenda-files (append oni:work-agenda-files + oni:common-agenda-files)))) + ("Wt" "Work todo" todo "" + ((org-agenda-files (append oni:work-agenda-files + oni:common-agenda-files)))))) +(setq org-agenda-prefix-format + '((agenda . " %i %-12:c%?-12t% s") + (timeline . " % s") + (todo . " %i %-12:c %(oni:org-maybe-outline-path)") + (tags . " %i %-12:c %(oni:org-maybe-outline-path)") + (search . " %i %-12:c"))) +(setq org-agenda-sorting-strategy + '((agenda habit-down time-up priority-down category-keep) + (todo priority-down category-keep) + (tags priority-down category-keep) + (search category-keep))) +(setq org-agenda-tags-column -101) +(setq org-directory (expand-file-name "~/documents/org")) +(setq org-default-notes-file (concat org-directory "/org")) +(setq org-capture-templates + `(("t" "Task" entry (file "~/documents/org/tasks") + "* TODO %?") + ("T" "Linked task" entry (file "~/documents/org/tasks") + "* TODO %?\n\n %a") + ("n" "General note" entry (file ,org-default-notes-file) + (function oni:note-template)))) +(setq org-contacts-files '("~/documents/org/misc/contacts.org")) +(setq org-agenda-show-outline-path nil) +(setq org-agenda-todo-ignore-deadlines 'far) +(setq org-agenda-todo-ignore-scheduled t) +(setq org-export-htmlize-output-type 'css) +(setq org-feed-alist + '(("MyEpisodes" + "http://www.myepisodes.com/rss.php?feed=mylist&uid=Slash&pwdmd5=04028968e1f0b7ee678b748a4320ac17" + "~/documents/org/tasks" "MyEpisodes" + :formatter oni:myepisodes-formatter))) +(setq org-fontify-done-headline t) +(setq org-hide-emphasis-markers t) +(setq org-outline-path-complete-in-steps t) +(setq org-refile-allow-creating-parent-nodes t) +(setq org-refile-targets '((nil . (:maxlevel . 6)))) +(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-exclude-from-inheritance '("crypt")) +(setq org-todo-keyword-faces + '(("TODO" :foreground "#ff756e" :background "#171719" :box (:width 1 :color "#282830")) + ("DONE" :foreground "#9ad870" :background "#222224" :box (:width 1 :color "#333335")) + ("SUCCEEDED" :foreground "#9ad870" :background "#222224" :box (:width 1 :color "#333335")) + ("WAITING" :foreground "#ffbb56" :background "#171719" :box (:width 1 :color "#282830")) + ("CANCELLED" :foreground "#93d8d8" :background "#222224" :box (:width 1 :color "#333335")) + ("FAILED" :foreground "#93d8d8" :background "#222224" :box (:width 1 :color "#333335")) + ("WIP" :foreground "#ff756e" :background "#171719" :box (:width 1 :color "#282830")) + ("HOLD" :foreground "#ffbb56" :background "#171719" :box (:width 1 :color "#282830")) + ("ACQUIRE" :foreground "#ff756e" :background "#171719" :box (:width 1 :color "#282830")) + ("IGNORED" :foreground "#999999" :background "#222224" :box (:width 1 :color "#333335")))) +(setq org-use-fast-todo-selection t) +(setq org-use-property-inheritance '("slug")) + +(add-hook 'org-agenda-mode-hook 'org-agenda-to-appt) + +(add-to-list 'org-modules 'habit) + +(org-indent-mode t) + +(org-agenda-to-appt) +(ad-activate 'org-agenda-redo) + +(oni:set-org-agenda-files) +(run-at-time "09:01" (* 60 60 24) 'oni:set-org-agenda-files) +(run-at-time "17:01" (* 60 60 24) 'oni:set-org-agenda-files) + +(provide 'org-init) +;;; org-init.el ends here diff --git a/emacs/site-lisp/quick-edit-mode.el b/emacs/site-lisp/quick-edit-mode.el new file mode 100644 index 0000000..821c738 --- /dev/null +++ b/emacs/site-lisp/quick-edit-mode.el @@ -0,0 +1,74 @@ +;;; quick-edit-mode.el --- Quickly edit stuff + +;; Copyright (C) 2012 Tom Willemsen + +;; Author: Tom Willemsen +;; Keywords: convenience + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; Quickly edit stuff + +;;; Code: + +(defvar quick-edit-map + (let ((map (make-sparse-keymap))) + (define-key map "/" 'undo) + (define-key map "0" 'delete-window) + (define-key map "1" 'delete-other-windows) + (define-key map "2" 'split-window-below) + (define-key map "3" 'split-window-right) + (define-key map "K" 'kill-whole-line) + (define-key map "V" 'scroll-down-command) + (define-key map "a" 'oni:move-beginning-of-dwim) + (define-key map "b" 'backward-char) + (define-key map "d" 'oni:kill-region-or-forward-char) + (define-key map "e" 'oni:move-end-of-dwim) + (define-key map "f" 'forward-char) + (define-key map "j" 'newline-and-indent) + (define-key map "k" 'oni:kill-region-or-line) + (define-key map "n" 'next-line) + (define-key map "o" 'other-window) + (define-key map "p" 'previous-line) + (define-key map "v" 'scroll-up-command) + (define-key map "w" 'oni:kill-region-or-backward-char) + (define-key map (kbd "C-b") 'electric-buffer-list) + (define-key map (kbd "C-g") 'quick-edit-mode) + (define-key map (kbd "RET") 'quick-edit-mode) + map) + "Keymap for quick-edit-mode.") + +(defun qe-locally-disable () + "Disable quick-edit mode in the minibuffer" + (when (eq overriding-local-map quick-edit-map) + (setq-local overriding-local-map nil))) + +;;;###autoload +(define-minor-mode quick-edit-mode + "Quickly edit stuff." + :lighter " qe" + :global t + (if quick-edit-mode + (progn + (setq overriding-local-map quick-edit-map) + (add-hook 'minibuffer-setup-hook 'qe-locally-disable) + (add-hook 'special-mode-hook 'qe-locally-disable)) + (setq overriding-local-map nil) + (remove-hook 'minibuffer-setup-hook 'qe-locally-disable) + (remove-hook 'special-mode-hook 'qe-locally-disable))) + +(provide 'quick-edit-mode) +;;; quick-edit-mode.el ends here diff --git a/emacs/site-lisp/wm-init.el b/emacs/site-lisp/wm-init.el new file mode 100644 index 0000000..694acab --- /dev/null +++ b/emacs/site-lisp/wm-init.el @@ -0,0 +1,3 @@ +(async-shell-command "herbstluftwm" " herbstluftwm") +(async-shell-command "dunst" " dunst") +(async-shell-command "xbindkeys" " xbindkeys") -- cgit v1.3-2-g0d8e From 0fb047ba987a259a2cbb0bd327cea0c9b7cab63e Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 19 Feb 2013 23:43:39 +0100 Subject: emacs: Don't use avatars with jabber --- emacs/init.el | 3 +++ emacs/site-lisp/oni.el | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'emacs/site-lisp') diff --git a/emacs/init.el b/emacs/init.el index 816c03d..a3eff7b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -119,6 +119,7 @@ (setq jabber-account-list '(("ryuslash@jabber.org") ("tom@ryuslash.org/Emacs" (:connection-type . ssl)))) +(setq jabber-avatar-cache-directory "~/.emacs.d/jabber-avatars/") (setq jabber-chat-buffer-format "*jab:%n*") (setq jabber-chat-buffer-show-avatar nil) (setq jabber-chat-fill-long-lines nil) @@ -128,6 +129,8 @@ (setq jabber-history-dir "~/.emacs.d/jabber") (setq jabber-muc-autojoin '("aethon@muc.ryuslash.org")) (setq jabber-roster-show-bindings nil) +(setq jabber-vcard-avatars-publish nil) +(setq jabber-vcard-avatars-retrieve nil) (setq jit-lock-defer-time 0.2) (setq magit-repo-dirs '("~/projects/" "~/var/src/")) (setq message-log-max 1000) diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index 80d1b01..9b2df64 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -189,10 +189,7 @@ If COUNT has been specified indent by that much, otherwise look at (defun oni:jabber-chat-mode-func () "Function for `jabber-chat-mode-hook'." - (visual-line-mode) - (setq mode-line-format (append (cddr jabber-chat-header-line-format) - '(global-mode-string)) - header-line-format nil)) + (visual-line-mode)) (defun oni:jabber-init () "Initialization function for jabber." -- cgit v1.3-2-g0d8e From ed9106f857e974b970adf0340c93c89278c153f8 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 10 Mar 2013 13:36:55 +0100 Subject: Emacs: Reverse-sort org tasks --- emacs/site-lisp/org-init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'emacs/site-lisp') diff --git a/emacs/site-lisp/org-init.el b/emacs/site-lisp/org-init.el index 4033c30..789b1bb 100644 --- a/emacs/site-lisp/org-init.el +++ b/emacs/site-lisp/org-init.el @@ -77,6 +77,7 @@ (expand-file-name "~/documents/org/misc/bookmarks.org")) "Agenda files that are work-agnostic, should always show up.") +(setq org-agenda-cmp-user-defined (lambda (a b) 1)) (setq org-agenda-custom-commands '(("P" . "Personal only") ("Pa" "Personal agenda" agenda "" @@ -100,7 +101,7 @@ (search . " %i %-12:c"))) (setq org-agenda-sorting-strategy '((agenda habit-down time-up priority-down category-keep) - (todo priority-down category-keep) + (todo user-defined-down) (tags priority-down category-keep) (search category-keep))) (setq org-agenda-tags-column -101) -- cgit v1.3-2-g0d8e From 47989707515b462b952886acdae24b9a6e119b7a Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 11 Mar 2013 00:40:57 +0100 Subject: Emacs: move ido settings to org --- emacs/init.el | 10 ------- emacs/init.org | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ emacs/site-lisp/oni.el | 13 --------- 3 files changed, 78 insertions(+), 23 deletions(-) (limited to 'emacs/site-lisp') diff --git a/emacs/init.el b/emacs/init.el index 064af83..ca0b82b 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -23,7 +23,6 @@ "Face for the supposedly empty line in commit messages." :group 'local) -(eval-after-load "ido" '(oni:ido-init)) (eval-after-load "jabber" '(oni:jabber-init)) (eval-after-load "newst-treeview" '(require 'newsticker-init)) (eval-after-load "org" '(require 'org-init)) @@ -98,12 +97,6 @@ (setq help-at-pt-display-when-idle t) (setq highlight-80+-columns 72) (setq identica-enable-striping t) -(setq ido-auto-merge-delay-time 1000000) -(setq ido-default-buffer-method 'selected-window) -(setq ido-max-window-height 1) -(setq ido-save-directory-list-file nil) -(setq ido-ubiquitous-command-exceptions - '(org-refile org-capture-refile)) (setq inferior-lisp-program "sbcl") (setq inhibit-default-init t) (setq inhibit-local-menu-bar-menus t) @@ -225,7 +218,6 @@ (global-set-key (kbd "M-2") 'split-window-below) (global-set-key (kbd "M-3") 'split-window-right) (global-set-key (kbd "M-4") 'split-window-horizontally) -(global-set-key (kbd "M-n") 'idomenu) (global-set-key (kbd "M-o") 'other-window) (global-set-key (kbd "\"") 'oni:self-insert-dwim) @@ -270,8 +262,6 @@ (cua-selection-mode t) (electric-indent-mode) (electric-pair-mode) -(ido-mode) -(ido-ubiquitous-mode) (savehist-mode) (show-paren-mode) (winner-mode) diff --git a/emacs/init.org b/emacs/init.org index 003d229..5394f5e 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -516,3 +516,81 @@ (setq jabber-use-global-history nil jabber-history-dir "~/.emacs.d/jabber-hist") #+END_SRC + +* ido + + Keep some buffers from showing up when using ido-mode. Either these + get used very rarely or they don't have any really useful + information in them. + + #+BEGIN_SRC emacs-lisp + (defun oni:ido-init () + "Initialization functionn for ido." + (setq ido-ignore-buffers + (list "^\\` " "^irc\\." "^\\#" "^\\*Customize Option:" + (eval-when-compile + (regexp-opt + '("*-jabber-roster-*" + "*Messages*" + "*fsm-debug*" + "*magit-process*" + "*magit-edit-log*" + "*Backtrace*")))))) + + (eval-after-load "ido" '(oni:ido-init)) + #+END_SRC + + Ido tries to be smart and find files in other directories, I don't + like that, stop doing that (or at least wait a long time). + + #+BEGIN_SRC emacs-lisp + (setq ido-auto-merge-delay-time 1000000) + #+END_SRC + + Open files in the selected window when switching between buffers. + + #+BEGIN_SRC emacs-lisp + (setq ido-default-buffer-method 'selected-window) + #+END_SRC + + Only ever show one line of possibilities when using ido. I hate it + when the minibuffer grows. + + #+BEGIN_SRC emacs-lisp + (setq ido-max-window-height 1) + #+END_SRC + + Don't save ido state between invocations. + + #+BEGIN_SRC emacs-lisp + (setq ido-save-directory-list-file nil) + #+END_SRC + + Enable =ido-mode=. + + #+BEGIN_SRC emacs-lisp + (ido-mode) + #+END_SRC + +** ido-ubiquitous + + Don't use ido when calling =org-refile= or =org-capture-refile=. + + #+BEGIN_SRC emacs-lisp + (setq ido-ubiquitous-command-exceptions + '(org-refile org-capture-refile)) + #+END_SRC + + Enable =ido-ubiquitous=. + + #+BEGIN_SRC emacs-lisp + (ido-ubiquitous-mode) + #+END_SRC + +** idomenu + + Call =idomenu= with ~M-n~. + + #+BEGIN_SRC emacs-lisp + (global-set-key (kbd "M-n") 'idomenu) + #+END_SRC diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index 9b2df64..37f818d 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -129,19 +129,6 @@ DOT are intentionally being skipped." (fci-mode) (flycheck-mode)) -(defun oni:ido-init () - "Initialization functionn for ido." - (setq ido-ignore-buffers - (list "^\\` " "^irc\\." "^\\#" "^\\*Customize Option:" - (eval-when-compile - (regexp-opt - '("*-jabber-roster-*" - "*Messages*" - "*fsm-debug*" - "*magit-process*" - "*magit-edit-log*" - "*Backtrace*")))))) - (defun oni:indent-shift-left (start end &optional count) "Rigidly indent region. Region is from START to END. Move -- cgit v1.3-2-g0d8e From afba3f97aee13d6d52b577dc28089d9fd9596bf0 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 22 Mar 2013 13:37:00 +0100 Subject: Emacs: Hide compilation window more consistently --- emacs/site-lisp/ext.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'emacs/site-lisp') diff --git a/emacs/site-lisp/ext.el b/emacs/site-lisp/ext.el index d6abaa6..d9e1973 100644 --- a/emacs/site-lisp/ext.el +++ b/emacs/site-lisp/ext.el @@ -44,8 +44,9 @@ ;; there were errors (message "compilation errors, press C-x ` to visit") ;; no errors, make the compilation window go away in 0.5 seconds - (run-at-time 0.5 nil 'delete-windows-on buf) - (message "No compilation errors!"))) + (when (member (buffer-name) '("*Compilation*" "*compilation*")) + (run-at-time 0.5 nil 'delete-windows-on buf) + (message "No compilation errors!")))) (defun ext:reload-buffer () "Reload current buffer." -- cgit v1.3-2-g0d8e From d9fec92e0babba26580f2bac4e91408bda227a24 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 22 Mar 2013 13:38:21 +0100 Subject: Emacs: Remove jabber-init from oni.el It was moved to init.org some commits ago --- emacs/site-lisp/oni.el | 4 ---- 1 file changed, 4 deletions(-) (limited to 'emacs/site-lisp') diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index 37f818d..9ff1ee4 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -178,10 +178,6 @@ If COUNT has been specified indent by that much, otherwise look at "Function for `jabber-chat-mode-hook'." (visual-line-mode)) -(defun oni:jabber-init () - "Initialization function for jabber." - (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)) - (defun oni:jabber-roster-mode-func () "Function for `jabber-roster-mode-hook'." (setq mode-line-format -- cgit v1.3-2-g0d8e From 3104ad4735d0f8e09e68ecd3b2f3c3db741ece57 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 28 Mar 2013 01:41:09 +0100 Subject: Emacs: Remove emacs/site-lisp/newsticker-init.el I haven't used newsticker in quite a while... --- emacs/init.org | 1 - emacs/site-lisp/newsticker-init.el | 6 ------ 2 files changed, 7 deletions(-) delete mode 100644 emacs/site-lisp/newsticker-init.el (limited to 'emacs/site-lisp') diff --git a/emacs/init.org b/emacs/init.org index b9db462..adc31d2 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -516,7 +516,6 @@ Define some faces to make editing magit logs nicer. #+END_SRC #+BEGIN_SRC emacs-lisp - (eval-after-load "newst-treeview" '(require 'newsticker-init)) (eval-after-load "org" '(require 'org-init)) (eval-after-load "rainbow-mode" '(oni:rainbow-mode-init)) (eval-after-load "smex" '(oni:smex-init)) diff --git a/emacs/site-lisp/newsticker-init.el b/emacs/site-lisp/newsticker-init.el deleted file mode 100644 index c393df1..0000000 --- a/emacs/site-lisp/newsticker-init.el +++ /dev/null @@ -1,6 +0,0 @@ -(setq newsticker-automatically-mark-items-as-old nil) -(setq newsticker-html-renderer 'w3m-region) -(setq newsticker-obsolete-item-max-age 604800) -(setq newsticker-use-full-width nil) - -(provide 'newsticker-init) -- cgit v1.3-2-g0d8e From 547450d83f53d73cc38fa44143f96ce535bff4b4 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Thu, 28 Mar 2013 01:44:08 +0100 Subject: Emacs: Remove newsticker-init.el from Makefile --- emacs/site-lisp/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'emacs/site-lisp') diff --git a/emacs/site-lisp/Makefile b/emacs/site-lisp/Makefile index bbccbb7..bf452e9 100644 --- a/emacs/site-lisp/Makefile +++ b/emacs/site-lisp/Makefile @@ -1,7 +1,7 @@ DESTDIR:=$(DESTDIR)/site-lisp objects=dzen.elc dzen.el eltuki.elc eltuki.el ext.elc ext.el \ metalexpress.elc metalexpress.el mu4e-init.elc mu4e-init.el \ - newsticker-init.elc newsticker-init.el oni.elc oni.el org-init.elc \ - org-init.el quick-edit-mode.elc quick-edit-mode.el + oni.elc oni.el org-init.elc org-init.el quick-edit-mode.elc \ + quick-edit-mode.el include ../../dotfiles.mk -- cgit v1.3-2-g0d8e From 752c0436b1b6017baedd752a4d676973a6f2ab87 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 29 Mar 2013 15:46:50 +0100 Subject: Emacs: speedup calling of ansi-term --- emacs/site-lisp/oni.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'emacs/site-lisp') diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index 9ff1ee4..027463b 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -373,7 +373,7 @@ When dealing with braces, add another line and indent that too." (let ((buffer (get-buffer "*ansi-term*"))) (if (and buffer (not arg)) (switch-to-buffer buffer) - (call-interactively 'ansi-term)))) + (ansi-term (getenv "SHELL"))))) (defun oni:raise-scratch (&optional mode) "Show the *scratch* buffer. -- cgit v1.3-2-g0d8e From bab8601a498e6bd18c612b849c21235dd4bf65f6 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 9 Apr 2013 16:53:19 +0200 Subject: Emacs: Stop using org I like literal programming, but I'm nog good at writing stories for each change. --- emacs/.gitignore | 1 - emacs/Makefile | 4 - emacs/init.el | 607 +++++++++++++++++++++++++++++++++++ emacs/init.org | 844 ------------------------------------------------- emacs/site-lisp/ext.el | 10 - 5 files changed, 607 insertions(+), 859 deletions(-) create mode 100644 emacs/init.el delete mode 100644 emacs/init.org (limited to 'emacs/site-lisp') diff --git a/emacs/.gitignore b/emacs/.gitignore index 66209de..771231f 100644 --- a/emacs/.gitignore +++ b/emacs/.gitignore @@ -13,5 +13,4 @@ templates/ rinit.* !rinit.org history -init.el *.html diff --git a/emacs/Makefile b/emacs/Makefile index db6203e..43ee5ec 100644 --- a/emacs/Makefile +++ b/emacs/Makefile @@ -5,7 +5,3 @@ modules=eshell site-lisp snippets EMACS=emacs include ../dotfiles.mk - -init.el: init.org - $(EMACS) -Q -batch \ - -eval "(progn (require 'org) (require 'ob-tangle) (org-babel-tangle-file \"$^\"))" diff --git a/emacs/init.el b/emacs/init.el new file mode 100644 index 0000000..60ba521 --- /dev/null +++ b/emacs/init.el @@ -0,0 +1,607 @@ +;;; Turn the menu, scroll-bar and tool-bar off quickly, so they don't +;;; jump around as much. +(menu-bar-mode -1) +(scroll-bar-mode -1) +(tool-bar-mode -1) + +(defmacro 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))) + +;;; Load my very own theme. +(eval-after-init (load-theme 'yoshi t)) + +;;; Add some project directories and my site-lisp directory to the +;;; load path to make it easy to (auto)load them. +(mapc #'(lambda (dir) + (add-to-list 'load-path dir) + (let ((loaddefs (concat dir "/loaddefs.el"))) + (when (file-exists-p loaddefs) + (load loaddefs)))) + '("~/projects/emacs/mode-icons" "~/.emacs.d/site-lisp" + "~/projects/emacs/pony-mode/src" "~/projects/emacs/php-mode")) + +;;; I have never, yet, accidentally said `y' or `n' when asked. +(defalias 'yes-or-no-p 'y-or-n-p) + +;;; These are much more feature-rich. +(defalias 'list-buffers 'ibuffer) +(defalias 'dabbrev-expand 'hippie-expand) + +(defun ext:comp-finish-function (buf str) + "Close the compilation buffer quickly if everything went OK." + (if (string-match "exited abnormally" str) + ;; there were errors + (message "compilation errors, press C-x ` to visit") + ;; no errors, make the compilation window go away in 0.5 seconds + (when (member (buffer-name) '("*Compilation*" "*compilation*")) + (run-at-time 0.5 nil 'delete-windows-on buf) + (message "No compilation errors!")))) + +(add-to-list 'compilation-finish-functions 'ext:comp-finish-function) + +;;; I close the compilation window if there are no errors. Seeing it +;;; scroll past lets me see if there were any warnings I might want to +;;; look at. +(setq compilation-scroll-output t) + +;;; Enable the excellent `paredit-mode' for any lisp-like languages. +(add-hook 'clojure-mode-hook 'paredit-mode) +(add-hook 'emacs-lisp-mode-hook 'paredit-mode) +(add-hook 'lisp-mode-hook 'paredit-mode) +(add-hook 'sawfish-mode-hook 'paredit-mode) +(add-hook 'scheme-mode-hook 'paredit-mode) + +;;; Remove the pylint and pyflakes checkers from the flycheck +;;; configuration so the flake8 checker remains. +(eval-after-load "flycheck" + '(progn + (mapc (lambda (c) (delq c flycheck-checkers)) + '(python-pylint python-pyflakes)))) + +(defun oni:pretty-control-l-function (win) + "Just make a string of either `fci-rule-column' or +`fill-column' length -1. Use the `-' character. WIN is ignored." + (ignore win) + (make-string + (1- (if (boundp 'fci-rule-column) fci-rule-column fill-column)) ?-)) + +;;; Use `oni:pretty-control-l-function' to create a nice horizontal +;;; line. +(setq pp^L-^L-string-function 'oni:pretty-control-l-function) + +;;; Don't put anything before the pp^L string. +(setq pp^L-^L-string-pre nil) + +;;; Enable pp^L at startup and again for each frame created. +(add-hook 'emacs-startup-hook 'pretty-control-l-mode) +(add-hook 'after-make-frame-functions + '(lambda (arg) (pretty-control-l-mode))) + +(setq erc-autojoin-channels-alist + '(("freenode.net" "#ninthfloor" "#emacs"))) +(setq erc-hide-list '("PART")) +(setq erc-insert-timestamp-function 'erc-insert-timestamp-left) +(setq erc-timestamp-format "[%H:%M] ") +(setq erc-timestamp-only-if-changed-flag nil) +(setq erc-nick "ryuslash") + +(defun oni:erc-mode-func () + "Function for `erc-mode-hook'." + (erc-fill-mode -1) + (visual-line-mode) + (setq truncate-lines nil)) + +(add-hook 'erc-mode-hook 'oni:erc-mode-func) + +;;; Since unison requires unbuffered input it should not show up in +;;; eshell, but a real term shell. +(eval-after-load "em-term" + '(add-to-list 'eshell-visual-commands "unison")) + +;;; To be able to highlight the eshell prompt just as I want it with +;;; regular text properties the standard highlighting should be turned +;;; off, otherwise it always overwrites whatever text properties it +;;; finds. +(setq eshell-highlight-prompt 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))) + (branch + (shell-command-to-string + "git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'")) + (userstatus (if (zerop (user-uid)) ?# ?$))) + (concat + (propertize (char-to-string status) + 'face `(:foreground ,(if (= status ?+) + "green" + "red"))) + " " + (propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id) + " " + (propertize (oni:shorten-dir dir) 'face 'font-lock-string-face) + " " + (when (not (string= branch "")) + (propertize + ;; Cut off "* " and "\n" + (substring branch 2 -1) + 'face 'font-lock-function-name-face)) + " \n" + (propertize (char-to-string userstatus) + 'face `(:foreground "blue")) + "> "))) + +(setq eshell-prompt-function 'oni:eshell-prompt-function + eshell-prompt-regexp "^[#$]> ") + +(defun oni:eshell-mode-func () + "Function for `eshell-mode-hook'." + (setq truncate-lines nil)) + +(add-hook 'eshell-mode-hook 'oni:eshell-mode-func) + +(defun oni:raise-eshell () + "Start or switch back to `eshell'. +Also change directories to current working directory." + (interactive) + (let ((dir (file-name-directory + (or (buffer-file-name) "~/"))) + (hasfile (not (eq (buffer-file-name) nil)))) + (eshell) + (if (and hasfile (eq eshell-process-list nil)) + (progn + (eshell/cd dir) + (eshell-reset))))) + +(global-set-key (kbd "") 'oni:raise-eshell) + +;;; Since I don't ever get any mail from people that use right-to-left +;;; text, and even if I did I wouldn't be able to read it, I don't +;;; need bidirectional text support. You shouldn't actually disable it +;;; (if that's even still possible) since, supposedly, it is an +;;; integral part of the display engine now, but telling it to always +;;; use left-to-right should keep it from slowing your emacs down. +(setq-default bidi-paragraph-direction 'left-to-right) + +;;; Enable the following commands because they're useful sometimes and +;;; I'm not an Emacs beginner anymore, they don't confuse me. +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) +(put 'narrow-to-region 'disabled nil) +(put 'scroll-left 'disabled nil) + +(defun oni:jabber-init () + "Initialization function for jabber." + (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)) + +(eval-after-load "jabber" '(oni:jabber-init)) + +(autoload 'jabber-message-libnotify "jabber-libnotify") +(autoload 'jabber-muc-libnotify "jabber-libnotify") + +(add-hook 'jabber-alert-message-hooks 'jabber-message-libnotify) +(add-hook 'jabber-alert-muc-hooks 'jabber-muc-libnotify) + +(setq jabber-history-enabled t + jabber-history-muc-enabled t) + +(setq jabber-use-global-history nil + jabber-history-dir "~/.emacs.d/jabber-hist") + +(setq jabber-account-list '(("ryuslash@jabber.org") + ("tom@ryuslash.org/drd" + (:connection-type . ssl)))) + +(defun oni:ido-init () + "Initialization functionn for ido." + (setq ido-ignore-buffers + (list "^\\` " "^irc\\." "^\\#" "^\\*Customize Option:" + (eval-when-compile + (regexp-opt + '("*-jabber-roster-*" + "*Messages*" + "*fsm-debug*" + "*magit-process*" + "*magit-edit-log*" + "*Backtrace*" + "*Ibuffer*")))))) + +(eval-after-load "ido" '(oni:ido-init)) + +(setq ido-auto-merge-delay-time 1000000) + +(setq ido-default-buffer-method 'selected-window) + +(setq ido-max-window-height 1) + +(setq ido-save-directory-list-file nil) + +(ido-mode) + +(setq ido-ubiquitous-command-exceptions + '(org-refile org-capture-refile)) + +(add-hook 'emacs-startup-hook 'ido-ubiquitous-mode) + +(global-set-key (kbd "M-n") 'idomenu) + +(setq minibuffer-eldef-shorten-default t) +(minibuffer-electric-default-mode) + +(setq mode-line-default-help-echo "") + +(eval-after-load "jedi" '(setcar jedi:server-command "python2")) +(add-hook 'python-mode-hook 'jedi:setup) + +(setq jedi:tooltip-method nil) + +(defface git-commit-summary-face + '((t (:inherit org-level-1))) + "Face for the git title line." + :group 'local) + +(defface git-commit-overlong-summary-face + '((t (:background "#873732"))) + "Face for commit titles that are too long." + :group 'local) + +(defface git-commit-nonempty-second-line-face + '((t (:inherit git-commit-overlong-summary-face))) + "Face for the supposedly empty line in commit messages." + :group 'local) + +(eval-after-load "org" '(require 'org-init)) + +(defun indent-defun () + "Indent the current defun." + (interactive) + (save-excursion + (mark-defun) + (indent-region (region-beginning) (region-end)))) + +(global-set-key (kbd "C-M-z") 'indent-defun) + +(defadvice term-handle-exit (after oni:kill-buffer-after-exit activate) + "Kill the term buffer if the process finished." + (let ((msg (ad-get-arg 1))) + (when (string-equal msg "finished\n") + (kill-buffer (current-buffer))))) + +(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:upcase-prev (num) + (interactive "p") + (oni:change-prev-case num 'up)) + +(defun oni:downcase-prev (num) + (interactive "p") + (oni:change-prev-case num 'down)) + +(global-set-key (kbd "C-c u") 'oni:upcase-prev) +(global-set-key (kbd "C-c d") 'oni:downcase-prev) + +(defun oni:vala-mode-func () + "Function for `vala-mode-hook'." + (setq indent-tabs-mode nil)) + +(add-hook 'vala-mode-hook 'oni:vala-mode-func) + +(eval-after-load "rainbow-mode" '(oni:rainbow-mode-init)) +(eval-after-load "smex" '(oni:smex-init)) +(eval-after-load "yasnippet" '(oni:yasnippet-init)) + +(autoload 'define-slime-contrib "slime") +(autoload 'gtags-mode "gtags" nil t) +(autoload 'jabber-connect "jabber" nil t) +(autoload 'php-mode "php-mode" nil t) +(autoload 'po-mode "po-mode" nil t) +(autoload 'pony-mode "pony-mode" nil t) +(autoload 'sawfish-mode "sawfish" nil t) +(autoload 'server-running-p "server") +(autoload 'slime-js-minor-mode "slime-js" nil t) +(autoload 'xmodmap-mode "xmodmap-mode" nil t) +(autoload 'w3m-bookmark-view "w3m" nil t) +(autoload 'w3m-goto-url "w3m" nil t) + +(require 'uniquify) +(require 'ext) +(require 'oni) + +(setq-default c-basic-offset 4) +(setq-default fci-rule-column 73) +(setq-default indent-tabs-mode nil) +(setq-default php-mode-warn-if-mumamo-off nil) +(setq-default require-final-newline t) +(setq-default tab-width 4) +(setq-default truncate-lines t) + +(setq appt-disp-window-function #'oni:appt-display-window-and-jabber) +(setq appt-display-diary nil) +(setq auto-mode-case-fold nil) +(setq auto-save-file-name-transforms oni:auto-save-name-transforms) +(setq avandu-article-render-function #'avandu-view-w3m) +(setq backup-directory-alist oni:backup-directory-alist) +(setq browse-url-browser-function 'browse-url-generic) +(setq browse-url-generic-program (getenv "BROWSER")) +(setq c-offsets-alist '((statement-block-intro . +) + (knr-argdecl-intro . 5) + (substatement-open . +) + (substatement-label . 0) + (label . 0) + (statement-case-open . +) + (statement-cont . +) + (arglist-intro . +) + (arglist-close . 0) + (inline-open . 0) + (brace-list-open . +) + (topmost-intro-cont first c-lineup-topmost-intro-cont + c-lineup-gnu-DEFUN-intro-cont))) +(setq comment-auto-fill-only-comments t) +(setq custom-file "~/.emacs.d/custom.el") +(setq custom-theme-directory "~/.emacs.d/themes") +(setq default-frame-alist + `((border-width . 0) + (internal-border-width . 0) + (vertical-scroll-bars . nil) + (menu-bar-lines . nil) + (tool-bar-lines . nil) + (font . "Envy Code R:pixelsize=18"))) +(setq elnode-do-init nil) +(setq fci-rule-color "darkred") +(setq frame-title-format '(:eval (concat "emacs: " (buffer-name)))) +(setq geiser-repl-history-filename "~/.emacs.d/geiser-history") +(setq gnus-init-file "~/.emacs.d/gnus") +(setq gtags-auto-update t) +(setq help-at-pt-display-when-idle t) +(setq highlight-80+-columns 72) +(setq identica-enable-striping t) +(setq inferior-lisp-program "sbcl") +(setq inhibit-default-init t) +(setq inhibit-local-menu-bar-menus t) +(setq inhibit-startup-message t) +(setq initial-major-mode 'emacs-lisp-mode) +(setq initial-scratch-message nil) +(setq jabber-avatar-cache-directory "~/.emacs.d/jabber-avatars/") +(setq jabber-chat-buffer-format "*jab:%n*") +(setq jabber-chat-buffer-show-avatar nil) +(setq jabber-chat-fill-long-lines nil) +(setq jabber-chat-foreign-prompt-format "%t %u/%r <\n") +(setq jabber-chat-local-prompt-format "%t %u/%r >\n") +(setq jabber-chatstates-confirm nil) +(setq jabber-muc-autojoin '("aethon@muc.ryuslash.org")) +(setq jabber-roster-show-bindings nil) +(setq jabber-vcard-avatars-publish nil) +(setq jabber-vcard-avatars-retrieve nil) +(setq jit-lock-defer-time 0.2) +(setq magit-repo-dirs '("~/projects/")) +(setq message-log-max 1000) +(setq message-send-mail-function 'message-send-mail-with-sendmail) +(setq message-sendmail-extra-arguments '("-a" "ryuslash")) +(setq package-archives + '(("melpa" . "http://melpa.milkbox.net/packages/") + ("marmalade" . "http://marmalade-repo.org/packages/") + ("gnu" . "http://elpa.gnu.org/packages/"))) +(setq package-load-list '((htmlize "1.39") + (lua-mode "20111107") + all)) +(setq php-function-call-face 'font-lock-function-name-face) +(setq php-mode-force-pear t) +(setq pony-tpl-indent-moves t) +(setq rainbow-delimiters-max-face-count 12) +(setq redisplay-dont-pause t) +(setq send-mail-function 'smtpmail-send-it) +(setq sendmail-program "/usr/bin/msmtp") +(setq sentence-end-double-space nil) +(setq smex-key-advice-ignore-menu-bar t) +(setq smex-save-file "~/.emacs.d/smex-items") +(setq split-height-threshold 40) +(setq time-stamp-active t) +(setq time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)") +(setq type-break-good-rest-interval (* 60 10)) +(setq type-break-interval (* 60 50)) +(setq type-break-keystroke-threshold '(nil . nil)) +(setq uniquify-buffer-name-style 'post-forward) +(setq use-dialog-box nil) +(setq user-full-name "Tom Willemsen") +(setq user-mail-address "tom@ryuslash.org") +(setq w3m-fill-column 72) +(setq window-combination-resize t) +(setq yas-fallback-behavior nil) +(setq yas-prompt-functions '(yas-ido-prompt)) + +(add-hook 'after-change-major-mode-hook 'set-current-mode-icon) +(add-hook 'after-save-hook 'oni:after-save-func t) +(add-hook 'before-save-hook 'oni:before-save-func) +(add-hook 'c-mode-hook 'oni:c-mode-func) +(add-hook 'css-mode-hook 'oni:css-mode-func) +(add-hook 'diary-display-hook 'oni:diary-display-func) +(add-hook 'emacs-startup-hook 'oni:emacs-startup-func) +(add-hook 'emacs-lisp-mode-hook 'oni:emacs-lisp-mode-func) +(add-hook 'go-mode-hook 'oni:go-mode-func) +(add-hook 'gtags-mode-hook 'oni:gtags-mode-func) +(add-hook 'haskell-mode-hook 'oni:haskell-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) +(add-hook 'java-mode-hook 'oni:java-mode-func) +(add-hook 'js-mode-hook 'oni:js-mode-func) +(add-hook 'js2-mode-hook 'oni:js2-mode-func) +(add-hook 'lua-mode-hook 'oni:lua-mode-func) +(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-mode-hook 'oni:org-mode-func) +(add-hook 'php-mode-hook 'oni:php-mode-func) +(add-hook 'prog-mode-hook 'oni:prog-mode-func) +(add-hook 'python-mode-hook 'oni:python-mode-func) +(add-hook 'rst-mode-hook 'oni:rst-mode-func) +(add-hook 'term-mode-hook 'oni:term-mode-func) +(add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func) +(add-hook 'write-file-hooks 'oni:write-file-func) +(add-hook 'yas-minor-mode-hook 'oni:yas-minor-mode-func) + +(define-key key-translation-map (kbd "C-j") (kbd "C-l")) +(define-key key-translation-map (kbd "C-l") (kbd "C-j")) + +(global-set-key (kbd "'") 'oni:self-insert-dwim) +(global-set-key (kbd "") 'oni:raise-scratch) +(global-set-key (kbd "") 'gnus) +(global-set-key (kbd "") 'git-project-show-files) +(global-set-key (kbd "") 'ext:reload-buffer) +(global-set-key (kbd "") 'jabber-switch-to-roster-buffer) +(global-set-key (kbd "") 'magit-status) +(global-set-key (kbd "") 'oni:show-org-index) +(global-set-key (kbd "C-<") 'oni:indent-shift-left) +(global-set-key (kbd "C->") 'oni:indent-shift-right) +(global-set-key (kbd "C-M-4") 'split-window-vertically) +(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) +(global-set-key (kbd "C-a") 'oni:move-beginning-of-dwim) +(global-set-key (kbd "C-c a") 'org-agenda) +(global-set-key (kbd "C-c c") 'org-capture) +(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 t") 'oni:raise-ansi-term) +(global-set-key (kbd "C-d") 'oni:kill-region-or-forward-char) +(global-set-key (kbd "C-e") 'oni:move-end-of-dwim) +(global-set-key (kbd "C-k") 'oni:kill-region-or-line) +(global-set-key (kbd "C-w") 'oni:kill-region-or-backward-char) +(global-set-key (kbd "M-0") 'delete-window) +(global-set-key (kbd "M-1") 'delete-other-windows) +(global-set-key (kbd "M-2") 'split-window-below) +(global-set-key (kbd "M-3") 'split-window-right) +(global-set-key (kbd "M-4") 'split-window-horizontally) +(global-set-key (kbd "M-o") 'other-window) +(global-set-key (kbd "\"") 'oni:self-insert-dwim) + +(if (daemonp) + (global-set-key "\C-x\C-c" 'oni:close-client-window)) + +(when (or window-system (daemonp)) + (global-unset-key "\C-z")) + +(add-to-list 'auto-mode-alist '("\\.jl$" . sawfish-mode)) +(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode)) +(add-to-list 'auto-mode-alist + '("\\.m\\(ark\\)?d\\(?:o?wn\\)?$" . markdown-mode)) +(add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode)) +(add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode)) +(add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode)) +(add-to-list 'auto-mode-alist '("^PKGBUILD$" . shell-script-mode)) +(add-to-list 'auto-mode-alist '("^\\.Xmodmap$" . xmodmap-mode)) + +(add-to-list 'debug-ignored-errors "^Can't shift all lines enough") + +(add-to-list + 'display-buffer-alist + '("^\\*\\(?:.+-\\)?scratch\\*$" . ((display-buffer-same-window . nil)))) +(add-to-list + 'display-buffer-alist + '("^\\*git-project-list\\*$" . ((git-project-show-window . nil)))) +(add-to-list + 'display-buffer-alist + '("^\\*magit: .*\\*$" . ((display-buffer-same-window . nil)))) + +(blink-cursor-mode -1) +(column-number-mode -1) +(line-number-mode -1) +(tooltip-mode -1) + +(package-initialize) + +(auto-insert-mode) +(electric-indent-mode) +(savehist-mode) +(show-paren-mode) +(winner-mode) + +(smex-initialize) +(help-at-pt-set-timer) +(windmove-default-keybindings) +(global-diff-hl-mode) + +;;; Diminish lighter for a bunch of minor modes that should be on in +;;; certain modes and usually just clogg up the mode line. +(diminish 'auto-fill-function) +(eval-after-load "eldoc" '(diminish 'eldoc-mode)) +(eval-after-load "paredit" '(diminish 'paredit-mode)) +(eval-after-load "auto-complete" '(diminish 'auto-complete-mode)) +(eval-after-load "flycheck" '(diminish 'flycheck-mode)) +(eval-after-load "smartparens" '(diminish 'smartparens-mode)) + +;;; 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) + +(add-hook 'python-mode-hook 'smartparens-mode) +(add-hook 'html-mode-hook 'smartparens-mode) + +(defun oni:scroll-down-or-prev-page (arg) + "Either scroll down or go to the previous page. + +Depending on the value of `buffer-narrowed-p'." + (interactive "P") + (if (buffer-narrowed-p) + (progn + (narrow-to-page (or arg -1)) + (goto-char (point-min))) + (scroll-down-command arg))) + +(defun oni:scroll-up-or-next-page (arg) + "Either scroll up or go to the next page. + +Depending on the value of `buffer-narrowed-p'." + (interactive "P") + (if (buffer-narrowed-p) + (progn + (narrow-to-page (or arg 1)) + (goto-char (point-min))) + (scroll-up-command arg))) + +(global-set-key (kbd "") 'oni:scroll-down-or-prev-page) +(global-set-key (kbd "") 'oni:scroll-up-or-next-page) + +;;; Emacs Alsa Player +(add-to-list 'load-path "~/.emacs.d/site-lisp/eap") +(load "eap-autoloads") + +(setq eap-music-library "/mnt/music") +(setq eap-playlist-library "~/music/playlists") + +;;; Finally, load any `customize' settings and slime. +(load custom-file) +(load (expand-file-name "~/quicklisp/slime-helper.el")) diff --git a/emacs/init.org b/emacs/init.org deleted file mode 100644 index a127d78..0000000 --- a/emacs/init.org +++ /dev/null @@ -1,844 +0,0 @@ -#+TITLE: Emacs init -#+LINK: yoshi-theme http://ryuslash.org/projects/yoshi-theme.html -#+OPTIONS: author:nil num:nil -#+PROPERTY: tangle init.el -#+STARTUP: showall - -Disable the ~menu-bar-mode~, ~tool-bar-mode~ and ~scroll-bar-mode~ early on -so the disappear quickly after emacs starts up. - -#+BEGIN_SRC emacs-lisp - (menu-bar-mode -1) - (scroll-bar-mode -1) - (tool-bar-mode -1) -#+END_SRC - -Define a macro for deferring code until after emacs has started up. -This gets used by certain functions that rely on packages installed -from ELPA. These packages don't get loaded until /after/ the init file -has completed loading. - -#+BEGIN_SRC emacs-lisp - (defmacro eval-after-init (&rest body) - "Defer execution of BODY until after Emacs init." - `(add-hook 'emacs-startup-hook #'(lambda () ,@body))) -#+END_SRC - -Defer loading my theme until after emacs initialization. This is -because it has been installed with ~package.el~, and the packages aren't -added to the ~load-path~ until _after_ ~init.el~ has been run through. - -#+BEGIN_SRC emacs-lisp - (eval-after-init (load-theme 'yoshi t)) -#+END_SRC - -Add some of my project directories and other important directories -into ~load-path~ so I can easily load libraries in them. Also, if it -exists, load ~loaddefs.el~ in each directory for autoloads. - -#+BEGIN_SRC emacs-lisp - (mapc #'(lambda (dir) - (add-to-list 'load-path dir) - (let ((loaddefs (concat dir "/loaddefs.el"))) - (when (file-exists-p loaddefs) - (load loaddefs)))) - '("~/projects/emacs/mode-icons" "~/.emacs.d/site-lisp" - "~/projects/emacs/pony-mode/src" "~/projects/emacs/php-mode")) -#+END_SRC - -Replace the question of ~yes~ or ~no~ with just ~y~ or ~n~, I have never (yet) -accidentally typed a ~y~ or ~n~ when asked and typing ~yes~ or ~no~ is just -too much work. - -#+BEGIN_SRC emacs-lisp - (defalias 'yes-or-no-p 'y-or-n-p) -#+END_SRC - -Replace these functions with better alternatives. They offer the same -functionality, plus more. - -#+BEGIN_SRC emacs-lisp - (defalias 'list-buffers 'ibuffer) - (defalias 'dabbrev-expand 'hippie-expand) -#+END_SRC - -#+BEGIN_SRC emacs-lisp - (setq compilation-scroll-output t) -#+END_SRC - -#+BEGIN_SRC emacs-lisp - (add-hook 'clojure-mode-hook 'paredit-mode) - (add-hook 'emacs-lisp-mode-hook 'paredit-mode) - (add-hook 'lisp-mode-hook 'paredit-mode) - (add-hook 'scheme-mode-hook 'paredit-mode) -#+END_SRC - -Load ~flymake-cursor~ after loading ~flymake~, add Python and Go to -"allowed" files and add go error output to error patterns. - -#+BEGIN_SRC emacs-lisp - (defun oni:flymake-init () - "Initialization function for flymake." - (require 'flymake-cursor) - - (add-to-list ; Make sure pyflakes is loaded - 'flymake-allowed-file-name-masks ; for python files. - '("\\.py\\'" ext:flymake-pyflakes-init)) - - (add-to-list ; Error line repexp for go - 'flymake-err-line-patterns ; compilation. - '("^\\([a-zA-Z0-9_]+\\.go\\):\\([0-9]+\\):\\(.*\\)$" - 1 2 nil 3)) - - (add-to-list ; Go uses makefiles, makes - 'flymake-allowed-file-name-masks ; flymaking 'easy'. - '("\\.go$" flymake-simple-make-init))) - - (eval-after-load "flymake" '(oni:flymake-init)) -#+END_SRC - -Disable the GUI for flymake errors. This causes the flymake errors -to be shown in the minibuffer. - -#+BEGIN_SRC emacs-lisp - (setq flymake-gui-warnings-enabled nil) -#+END_SRC - -Add a bunch of pep8, flymake and pyflakes messages to warning and -info patterns, set the log file to somewhere in my home directory -and set logging level to 0. - -#+BEGIN_SRC emacs-lisp - (setq flymake-info-line-regexp - (eval-when-compile - (regexp-opt - '("Invalid name" - "String statement has no effect" - "Missing docstring" - "Empty docstring" - "multiple imports on one line" - "expected 2 blank lines, found 1" - "expected 2 blank lines, found 0" - "TODO:" - "whitespace after '{'" - "whitespace before '}'" - "whitespace before ':'" - "whitespace after '('" - "whitespace before ')'" - "whitespace after '['" - "whitespace before ']'" - "the backslash is redundant between brackets" - "continuation line over-indented for visual indent" - "continuation line under-indented for visual indent" - "Too many statements" - "comparison to None should be" - "missing whitespace around operator" - "missing whitespace after ','" - "line too long" - "at least two spaces before inline comment" - "trailing whitespace" - "imported but unused" - "Unused import" - "too many blank lines")))) - (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" - "redefinition of unused" - "Redefining built-in" - "Redefining name" - "Unused argument" - "Unused variable" - "Dangerous default value {} as argument" - "no newline at end of file" - "Access to a protected member")))) -#+END_SRC - -After loading ~flycheck~ Remove the default python checkers and -replace them with my own, which tries both ~flake8~ and ~pylint~. - -#+BEGIN_SRC emacs-lisp - (eval-after-load "flycheck" - '(progn - (mapc (lambda (c) (delete c flycheck-checkers)) - '(python-pylint python-pyflakes)))) -#+END_SRC - -Make the ~C-l~ look like a line of ~-~ up to =fill-column= or -=fci-rule-column= and remove the string displayed before the ~C-l~. - -#+BEGIN_SRC emacs-lisp - (defun oni:pretty-control-l-function (win) - "Just make a string of either `fci-rule-column' or - `fill-column' length -1. Use the `-' character. WIN is ignored." - (make-string - (1- (if (boundp 'fci-rule-column) - fci-rule-column fill-column)) ?-)) - - (setq pp^L-^L-string-function 'oni:pretty-control-l-function) -#+END_SRC - -Remove the string displayed before the ~C-l~. - -#+BEGIN_SRC emacs-lisp - (setq pp^L-^L-string-pre nil) -#+END_SRC - -Enable =pretty-control-l-mode= at startup and whenever a new frame is -created. - -#+BEGIN_SRC emacs-lisp - (add-hook 'emacs-startup-hook 'pretty-control-l-mode) - (add-hook 'after-make-frame-functions - '(lambda (arg) (pretty-control-l-mode))) -#+END_SRC - -Automatically join some channels when connecting to freenode.net. - -#+BEGIN_SRC emacs-lisp - (setq erc-autojoin-channels-alist - '(("freenode.net" "#ninthfloor" "#emacs"))) -#+END_SRC - -Don't show ~PART~ messages. - -#+BEGIN_SRC emacs-lisp - (setq erc-hide-list '("PART")) -#+END_SRC - -Insert a timestamp every time a message comes in, print it on the -left and print the hour and minute parts of the time. - -#+BEGIN_SRC emacs-lisp - (setq erc-insert-timestamp-function 'erc-insert-timestamp-left) - (setq erc-timestamp-format "[%H:%M] ") - (setq erc-timestamp-only-if-changed-flag nil) -#+END_SRC - -Set my nickname. - -#+BEGIN_SRC emacs-lisp - (setq erc-nick "ryuslash") -#+END_SRC - -When starting ERC disable truncating lines, don't let ERC fill each -line and enable =visual-line-mode=. - -#+BEGIN_SRC emacs-lisp - (defun oni:erc-mode-func () - "Function for `erc-mode-hook'." - (erc-fill-mode -1) - (visual-line-mode) - (setq truncate-lines nil)) - - (add-hook 'erc-mode-hook 'oni:erc-mode-func) -#+END_SRC - -Add ~unison~ to the list of =eshell-visual-commands= because it -expects unbuffered input and eshell just doesn't give that. - -#+BEGIN_SRC emacs-lisp - (eval-after-load "em-term" - '(add-to-list 'eshell-visual-commands "unison")) -#+END_SRC - -Don't let eshell highlight it's prompt, this way I can decide the -colors for it myself. - -#+BEGIN_SRC emacs-lisp - (setq eshell-highlight-prompt nil) -#+END_SRC - -In the prompt: - - - Show the exit status of the last program/command run represented - by a green ~+~ and a red ~-~ sign. - - Show the current hostname with the =mode-line-buffer-id= face. - - Show an abbreviation of the current directory (as seen in ~fish~) - using the =font-lock-string-face= face. - - If we're in a git repository, show the current branch with the - =font-lock-function-name-face= face. - - Show the status of priviledges in blue. - -And set the =eshell-prompt-regexp= to - -#+BEGIN_SRC emacs-lisp - (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))) - (branch - (shell-command-to-string - "git branch --contains HEAD 2>/dev/null | sed -e '/^[^*]/d'")) - (userstatus (if (zerop (user-uid)) ?# ?$))) - (concat - (propertize (char-to-string status) - 'face `(:foreground ,(if (= status ?+) - "green" - "red"))) - " " - (propertize (substring hostname 0 -1) 'face 'mode-line-buffer-id) - " " - (propertize (oni:shorten-dir dir) 'face 'font-lock-string-face) - " " - (when (not (string= branch "")) - (propertize - ;; Cut off "* " and "\n" - (substring branch 2 -1) - 'face 'font-lock-function-name-face)) - " \n" - (propertize (char-to-string userstatus) - 'face `(:foreground "blue")) - "> "))) - - (setq eshell-prompt-function 'oni:eshell-prompt-function - eshell-prompt-regexp "^[#$]> ") -#+END_SRC - -Don't truncate lines in eshell, wrap them. - -#+BEGIN_SRC emacs-lisp - (defun oni:eshell-mode-func () - "Function for `eshell-mode-hook'." - (setq truncate-lines nil)) - - (add-hook 'eshell-mode-hook 'oni:eshell-mode-func) -#+END_SRC - -Bind the ~f8~ key to easily show eshell. - -#+BEGIN_SRC emacs-lisp - (defun oni:raise-eshell () - "Start or switch back to `eshell'. - Also change directories to current working directory." - (interactive) - (let ((dir (file-name-directory - (or (buffer-file-name) "~/"))) - (hasfile (not (eq (buffer-file-name) nil)))) - (eshell) - (if (and hasfile (eq eshell-process-list nil)) - (progn - (eshell/cd dir) - (eshell-reset))))) - - (global-set-key (kbd "") 'oni:raise-eshell) -#+END_SRC - -Disable bi-directional text, since I don't write right-to-left -myself and I don't know anyone who does. I have read that it is a -bad idea to disable it completely, but forcing left-to-right should -help. - -#+BEGIN_SRC emacs-lisp - (setq-default bidi-paragraph-direction 'left-to-right) -#+END_SRC - -There are some functions which get disabled by default because they -"confuse new users", but these I like using. - -#+BEGIN_SRC emacs-lisp - (put 'upcase-region 'disabled nil) - (put 'downcase-region 'disabled nil) - (put 'narrow-to-region 'disabled nil) - (put 'scroll-left 'disabled nil) -#+END_SRC - -Don't echo presence updates in the message area. - -#+BEGIN_SRC emacs-lisp - (defun oni:jabber-init () - "Initialization function for jabber." - (remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)) - - (eval-after-load "jabber" '(oni:jabber-init)) -#+END_SRC - -Autoload functions from =jabber-libnotify= so we can use them in some -hooks. - -#+BEGIN_SRC emacs-lisp - (autoload 'jabber-message-libnotify "jabber-libnotify") - (autoload 'jabber-muc-libnotify "jabber-libnotify") -#+END_SRC - -Enable libnotify alerts for regular and mutli-user chats, this is -preferable to seeing them in the echo area. - -#+BEGIN_SRC emacs-lisp - (add-hook 'jabber-alert-message-hooks 'jabber-message-libnotify) - (add-hook 'jabber-alert-muc-hooks 'jabber-muc-libnotify) -#+END_SRC - -Keep track of what was said to and by my contacts, both for -"personal" chats and muc chats. - -#+BEGIN_SRC emacs-lisp - (setq jabber-history-enabled t - jabber-history-muc-enabled t) -#+END_SRC - -Store history on a per-contact basis and keep these files in -~$HOME/.emacs.d/jabber-hist~. - -#+BEGIN_SRC emacs-lisp - (setq jabber-use-global-history nil - jabber-history-dir "~/.emacs.d/jabber-hist") -#+END_SRC - -Add some accounts. - -#+BEGIN_SRC emacs-lisp - (setq jabber-account-list '(("ryuslash@jabber.org") - ("tom@ryuslash.org/drd" - (:connection-type . ssl)))) -#+END_SRC - -Keep some buffers from showing up when using ido-mode. Either these -get used very rarely or they don't have any really useful -information in them. - -#+BEGIN_SRC emacs-lisp - (defun oni:ido-init () - "Initialization functionn for ido." - (setq ido-ignore-buffers - (list "^\\` " "^irc\\." "^\\#" "^\\*Customize Option:" - (eval-when-compile - (regexp-opt - '("*-jabber-roster-*" - "*Messages*" - "*fsm-debug*" - "*magit-process*" - "*magit-edit-log*" - "*Backtrace*" - "*Ibuffer*")))))) - - (eval-after-load "ido" '(oni:ido-init)) -#+END_SRC - -Ido tries to be smart and find files in other directories, I don't -like that, stop doing that (or at least wait a long time). - -#+BEGIN_SRC emacs-lisp - (setq ido-auto-merge-delay-time 1000000) -#+END_SRC - -Open files in the selected window when switching between buffers. - -#+BEGIN_SRC emacs-lisp - (setq ido-default-buffer-method 'selected-window) -#+END_SRC - -Only ever show one line of possibilities when using ido. I hate it -when the minibuffer grows. - -#+BEGIN_SRC emacs-lisp - (setq ido-max-window-height 1) -#+END_SRC - -Don't save ido state between invocations. - -#+BEGIN_SRC emacs-lisp - (setq ido-save-directory-list-file nil) -#+END_SRC - -Enable =ido-mode=. - -#+BEGIN_SRC emacs-lisp - (ido-mode) -#+END_SRC - -Don't use ido when calling =org-refile= or =org-capture-refile=. - -#+BEGIN_SRC emacs-lisp - (setq ido-ubiquitous-command-exceptions - '(org-refile org-capture-refile)) -#+END_SRC - -Enable =ido-ubiquitous=. - -#+BEGIN_SRC emacs-lisp - (add-hook 'emacs-startup-hook 'ido-ubiquitous-mode) -#+END_SRC - -Call =idomenu= with ~M-n~. - -#+BEGIN_SRC emacs-lisp - (global-set-key (kbd "M-n") 'idomenu) -#+END_SRC - -A new feature in Emacs 24.3 can shorten ~(default ...)~ to ~[...]~ when -prompting for something. The =minibuffer-eldef-shorten-default= should -be set before enabling the =minibuffer-electric-default-mode=. - -#+BEGIN_SRC emacs-lisp - (setq minibuffer-eldef-shorten-default t) - (minibuffer-electric-default-mode) -#+END_SRC - -Don't show any default help messages, if no help message was -specified, just leave the echo area empty. - -#+BEGIN_SRC emacs-lisp - (setq mode-line-default-help-echo "") -#+END_SRC - -Start jedi when =python-mode= is started. - -#+BEGIN_SRC emacs-lisp - (eval-after-load "jedi" '(setcar jedi:server-command "python2")) - (add-hook 'python-mode-hook 'jedi:setup) -#+END_SRC - -Show argument lists and such from jedi in the echo area. - -#+BEGIN_SRC emacs-lisp - (setq jedi:tooltip-method nil) -#+END_SRC - -Define some faces to make editing magit logs nicer. - -#+BEGIN_SRC emacs-lisp - (defface git-commit-summary-face - '((t (:inherit org-level-1))) - "Face for the git title line." - :group 'local) - - (defface git-commit-overlong-summary-face - '((t (:background "#873732"))) - "Face for commit titles that are too long." - :group 'local) - - (defface git-commit-nonempty-second-line-face - '((t (:inherit git-commit-overlong-summary-face))) - "Face for the supposedly empty line in commit messages." - :group 'local) -#+END_SRC - -I have quite a few modifications to my org-mode setup, so don't load -them immediately, they take a little time to load. - -#+BEGIN_SRC emacs-lisp - (eval-after-load "org" '(require 'org-init)) -#+END_SRC - -Found on [[http://emacsredux.com/blog/2013/03/28/indent-defun/][Indent defun - Emacs Redux]], indents a function. Should be -just a tiny bit easier than going to the beginning of a function and -then calling =indent-sexp=, which only works in lisp-like languages -anyway. - -#+BEGIN_SRC emacs-lisp - (defun indent-defun () - "Indent the current defun." - (interactive) - (save-excursion - (mark-defun) - (indent-region (region-beginning) (region-end)))) - - (global-set-key (kbd "C-M-z") 'indent-defun) -#+END_SRC - -Kill the ~*ansi-term*~ buffer (or any term buffer) after the underlying -shell process has finished. When I quit a shell I don't want the -buffer hanging around. - -#+BEGIN_SRC emacs-lisp - (defadvice term-handle-exit (after oni:kill-buffer-after-exit activate) - "Kill the term buffer if the process finished." - (let ((msg (ad-get-arg 1))) - (when (string-equal msg "finished\n") - (kill-buffer (current-buffer))))) -#+END_SRC - -I don't have a capslock key on my keyboard, and sometimes it's -annoying to have to hold my shift key for long enums and such. The -idea is to type everything except regular caps in lower case and then -use these functions to fix them. - -#+BEGIN_SRC emacs-lisp - (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:upcase-prev (num) - (interactive "p") - (oni:change-prev-case num 'up)) - - (defun oni:downcase-prev (num) - (interactive "p") - (oni:change-prev-case num 'down)) - - (global-set-key (kbd "C-c u") 'oni:upcase-prev) - (global-set-key (kbd "C-c d") 'oni:downcase-prev) -#+END_SRC - -For some reason, =vala-mode= turns on =indent-tabs-mode=, I don't like -that. - -#+BEGIN_SRC emacs-lisp - (defun oni:vala-mode-func () - "Function for `vala-mode-hook'." - (setq indent-tabs-mode nil)) - - (add-hook 'vala-mode-hook 'oni:vala-mode-func) -#+END_SRC - -#+BEGIN_SRC emacs-lisp - (eval-after-load "rainbow-mode" '(oni:rainbow-mode-init)) - (eval-after-load "smex" '(oni:smex-init)) - (eval-after-load "yasnippet" '(oni:yasnippet-init)) - - (autoload 'define-slime-contrib "slime") - (autoload 'gtags-mode "gtags" nil t) - (autoload 'jabber-connect "jabber" nil t) - (autoload 'php-mode "php-mode" nil t) - (autoload 'po-mode "po-mode" nil t) - (autoload 'pony-mode "pony-mode" nil t) - (autoload 'sawfish-mode "sawfish" nil t) - (autoload 'server-running-p "server") - (autoload 'slime-js-minor-mode "slime-js" nil t) - (autoload 'xmodmap-mode "xmodmap-mode" nil t) - (autoload 'w3m-bookmark-view "w3m" nil t) - (autoload 'w3m-goto-url "w3m" nil t) - - (require 'uniquify) - (require 'ext) - (require 'oni) - - (setq-default c-basic-offset 4) - (setq-default fci-rule-column 73) - (setq-default indent-tabs-mode nil) - (setq-default php-mode-warn-if-mumamo-off nil) - (setq-default require-final-newline t) - (setq-default tab-width 4) - (setq-default truncate-lines t) - - (setq appt-disp-window-function #'oni:appt-display-window-and-jabber) - (setq appt-display-diary nil) - (setq auto-mode-case-fold nil) - (setq auto-save-file-name-transforms oni:auto-save-name-transforms) - (setq avandu-article-render-function #'avandu-view-w3m) - (setq backup-directory-alist oni:backup-directory-alist) - (setq browse-url-browser-function 'browse-url-generic) - (setq browse-url-generic-program (getenv "BROWSER")) - (setq c-offsets-alist '((statement-block-intro . +) - (knr-argdecl-intro . 5) - (substatement-open . +) - (substatement-label . 0) - (label . 0) - (statement-case-open . +) - (statement-cont . +) - (arglist-intro . +) - (arglist-close . 0) - (inline-open . 0) - (brace-list-open . +) - (topmost-intro-cont first c-lineup-topmost-intro-cont - c-lineup-gnu-DEFUN-intro-cont))) - (setq comment-auto-fill-only-comments t) - (setq custom-file "~/.emacs.d/custom.el") - (setq custom-theme-directory "~/.emacs.d/themes") - (setq default-frame-alist - `((border-width . 0) - (internal-border-width . 0) - (vertical-scroll-bars . nil) - (menu-bar-lines . nil) - (tool-bar-lines . nil) - (font . "Envy Code R:pixelsize=18"))) - (setq elnode-do-init nil) - (setq fci-rule-color "darkred") - (setq frame-title-format '(:eval (concat "emacs: " (buffer-name)))) - (setq geiser-repl-history-filename "~/.emacs.d/geiser-history") - (setq gnus-init-file "~/.emacs.d/gnus") - (setq gtags-auto-update t) - (setq help-at-pt-display-when-idle t) - (setq highlight-80+-columns 72) - (setq identica-enable-striping t) - (setq inferior-lisp-program "sbcl") - (setq inhibit-default-init t) - (setq inhibit-local-menu-bar-menus t) - (setq inhibit-startup-message t) - (setq initial-major-mode 'emacs-lisp-mode) - (setq initial-scratch-message nil) - (setq jabber-avatar-cache-directory "~/.emacs.d/jabber-avatars/") - (setq jabber-chat-buffer-format "*jab:%n*") - (setq jabber-chat-buffer-show-avatar nil) - (setq jabber-chat-fill-long-lines nil) - (setq jabber-chat-foreign-prompt-format "%t %u/%r <\n") - (setq jabber-chat-local-prompt-format "%t %u/%r >\n") - (setq jabber-chatstates-confirm nil) - (setq jabber-muc-autojoin '("aethon@muc.ryuslash.org")) - (setq jabber-roster-show-bindings nil) - (setq jabber-vcard-avatars-publish nil) - (setq jabber-vcard-avatars-retrieve nil) - (setq jit-lock-defer-time 0.2) - (setq magit-repo-dirs '("~/projects/")) - (setq message-log-max 1000) - (setq message-send-mail-function 'message-send-mail-with-sendmail) - (setq message-sendmail-extra-arguments '("-a" "ryuslash")) - (setq package-archives - '(("melpa" . "http://melpa.milkbox.net/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/") - ("gnu" . "http://elpa.gnu.org/packages/"))) - (setq package-load-list '((htmlize "1.39") - (lua-mode "20111107") - all)) - (setq php-function-call-face 'font-lock-function-name-face) - (setq php-mode-force-pear t) - (setq pony-tpl-indent-moves t) - (setq rainbow-delimiters-max-face-count 12) - (setq redisplay-dont-pause t) - (setq send-mail-function 'smtpmail-send-it) - (setq sendmail-program "/usr/bin/msmtp") - (setq sentence-end-double-space nil) - (setq smex-key-advice-ignore-menu-bar t) - (setq smex-save-file "~/.emacs.d/smex-items") - (setq split-height-threshold 40) - (setq time-stamp-active t) - (setq time-stamp-format "%04y-%02m-%02d %02H:%02M:%02S (%u)") - (setq type-break-good-rest-interval (* 60 10)) - (setq type-break-interval (* 60 50)) - (setq type-break-keystroke-threshold '(nil . nil)) - (setq uniquify-buffer-name-style 'post-forward) - (setq use-dialog-box nil) - (setq user-full-name "Tom Willemsen") - (setq user-mail-address "tom@ryuslash.org") - (setq w3m-fill-column 72) - (setq window-combination-resize t) - (setq yas-fallback-behavior nil) - (setq yas-prompt-functions '(yas-ido-prompt)) - - (add-hook 'after-change-major-mode-hook 'set-current-mode-icon) - (add-hook 'after-save-hook 'oni:after-save-func t) - (add-hook 'before-save-hook 'oni:before-save-func) - (add-hook 'c-mode-hook 'oni:c-mode-func) - (add-hook 'css-mode-hook 'oni:css-mode-func) - (add-hook 'diary-display-hook 'oni:diary-display-func) - (add-hook 'emacs-startup-hook 'oni:emacs-startup-func) - (add-hook 'emacs-lisp-mode-hook 'oni:emacs-lisp-mode-func) - (add-hook 'go-mode-hook 'oni:go-mode-func) - (add-hook 'gtags-mode-hook 'oni:gtags-mode-func) - (add-hook 'haskell-mode-hook 'oni:haskell-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) - (add-hook 'java-mode-hook 'oni:java-mode-func) - (add-hook 'js-mode-hook 'oni:js-mode-func) - (add-hook 'js2-mode-hook 'oni:js2-mode-func) - (add-hook 'lua-mode-hook 'oni:lua-mode-func) - (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-mode-hook 'oni:org-mode-func) - (add-hook 'php-mode-hook 'oni:php-mode-func) - (add-hook 'prog-mode-hook 'oni:prog-mode-func) - (add-hook 'python-mode-hook 'oni:python-mode-func) - (add-hook 'rst-mode-hook 'oni:rst-mode-func) - (add-hook 'term-mode-hook 'oni:term-mode-func) - (add-hook 'texinfo-mode-hook 'oni:texinfo-mode-func) - (add-hook 'write-file-hooks 'oni:write-file-func) - (add-hook 'yas-minor-mode-hook 'oni:yas-minor-mode-func) - - (define-key key-translation-map (kbd "C-j") (kbd "C-l")) - (define-key key-translation-map (kbd "C-l") (kbd "C-j")) - - (global-set-key (kbd "'") 'oni:self-insert-dwim) - (global-set-key (kbd "") 'oni:raise-scratch) - (global-set-key (kbd "") 'gnus) - (global-set-key (kbd "") 'git-project-show-files) - (global-set-key (kbd "") 'ext:reload-buffer) - (global-set-key (kbd "") 'jabber-switch-to-roster-buffer) - (global-set-key (kbd "") 'magit-status) - (global-set-key (kbd "") 'oni:show-org-index) - (global-set-key (kbd "C-<") 'oni:indent-shift-left) - (global-set-key (kbd "C->") 'oni:indent-shift-right) - (global-set-key (kbd "C-M-4") 'split-window-vertically) - (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) - (global-set-key (kbd "C-a") 'oni:move-beginning-of-dwim) - (global-set-key (kbd "C-c a") 'org-agenda) - (global-set-key (kbd "C-c c") 'org-capture) - (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 t") 'oni:raise-ansi-term) - (global-set-key (kbd "C-d") 'oni:kill-region-or-forward-char) - (global-set-key (kbd "C-e") 'oni:move-end-of-dwim) - (global-set-key (kbd "C-k") 'oni:kill-region-or-line) - (global-set-key (kbd "C-w") 'oni:kill-region-or-backward-char) - (global-set-key (kbd "M-0") 'delete-window) - (global-set-key (kbd "M-1") 'delete-other-windows) - (global-set-key (kbd "M-2") 'split-window-below) - (global-set-key (kbd "M-3") 'split-window-right) - (global-set-key (kbd "M-4") 'split-window-horizontally) - (global-set-key (kbd "M-o") 'other-window) - (global-set-key (kbd "\"") 'oni:self-insert-dwim) - - (if (daemonp) - (global-set-key "\C-x\C-c" 'oni:close-client-window)) - - (when (or window-system (daemonp)) - (global-unset-key "\C-z")) - - (add-to-list 'auto-mode-alist '("\\.jl$" . sawfish-mode)) - (add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode)) - (add-to-list 'auto-mode-alist - '("\\.m\\(ark\\)?d\\(?:o?wn\\)?$" . markdown-mode)) - (add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode)) - (add-to-list 'auto-mode-alist '("\\.po\\'\\|\\.po\\." . po-mode)) - (add-to-list 'auto-mode-alist '("\\.tpl$" . html-mode)) - (add-to-list 'auto-mode-alist '("^PKGBUILD$" . shell-script-mode)) - (add-to-list 'auto-mode-alist '("^\\.Xmodmap$" . xmodmap-mode)) - - (add-to-list 'debug-ignored-errors "^Can't shift all lines enough") - - (add-to-list - 'display-buffer-alist - '("^\\*\\(?:.+-\\)?scratch\\*$" . ((display-buffer-same-window . nil)))) - (add-to-list - 'display-buffer-alist - '("^\\*git-project-list\\*$" . ((git-project-show-window . nil)))) - (add-to-list - 'display-buffer-alist - '("^\\*magit: .*\\*$" . ((display-buffer-same-window . nil)))) - - (add-to-list 'compilation-finish-functions 'ext:comp-finish-function) - - (blink-cursor-mode -1) - (column-number-mode -1) - (line-number-mode -1) - (tooltip-mode -1) - - (package-initialize) - - (auto-insert-mode) - (cua-selection-mode t) - (electric-indent-mode) - (electric-pair-mode) - (savehist-mode) - (show-paren-mode) - (winner-mode) - - (smex-initialize) - (help-at-pt-set-timer) - (windmove-default-keybindings) - (global-diff-hl-mode) - - (load custom-file) - ;; (load "rudel-loaddefs.el") - (load (expand-file-name "~/quicklisp/slime-helper.el")) - - (unless (server-running-p) - (server-start)) - - (diminish 'auto-fill-function "_") -#+END_SRC - -# Local Variables: -# eval: (flyspell-mode 1) -# End: diff --git a/emacs/site-lisp/ext.el b/emacs/site-lisp/ext.el index d9e1973..2ed65d4 100644 --- a/emacs/site-lisp/ext.el +++ b/emacs/site-lisp/ext.el @@ -38,16 +38,6 @@ buffer-file-name)))) (list "pycheck.sh" (list local-file)))) -(defun ext:comp-finish-function (buf str) - "Don't show compilation window if everything went ok" - (if (string-match "exited abnormally" str) - ;; there were errors - (message "compilation errors, press C-x ` to visit") - ;; no errors, make the compilation window go away in 0.5 seconds - (when (member (buffer-name) '("*Compilation*" "*compilation*")) - (run-at-time 0.5 nil 'delete-windows-on buf) - (message "No compilation errors!")))) - (defun ext:reload-buffer () "Reload current buffer." (interactive) -- cgit v1.3-2-g0d8e From d07f2eb138231656b671ff8b0bd2e26d046d415f Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 10 Apr 2013 22:05:48 +0200 Subject: More --- .hgrc | 2 +- emacs/gnus.el | 1 + emacs/init.el | 2 +- emacs/site-lisp/dzen.el | 4 ++-- emacs/site-lisp/eltuki.el | 4 ++-- emacs/site-lisp/ext.el | 4 ++-- emacs/site-lisp/metalexpress.el | 4 ++-- emacs/site-lisp/mu4e-init.el | 4 ++-- emacs/site-lisp/oni.el | 4 ++-- emacs/site-lisp/org-init.el | 4 ++-- emacs/site-lisp/quick-edit-mode.el | 4 ++-- emacs/snippets/python-mode/import_from | 4 ++-- 12 files changed, 21 insertions(+), 20 deletions(-) (limited to 'emacs/site-lisp') diff --git a/.hgrc b/.hgrc index 4fa66ab..adef43b 100644 --- a/.hgrc +++ b/.hgrc @@ -1,4 +1,4 @@ [ui] -username = Tom Willemsen +username = Tom Willemse [extensions] hgext.bookmarks = diff --git a/emacs/gnus.el b/emacs/gnus.el index aac7c6e..49b3931 100644 --- a/emacs/gnus.el +++ b/emacs/gnus.el @@ -45,6 +45,7 @@ (address "tom.willemsen@archlinux.us") (eval (setq message-sendmail-extra-arguments '("-a" "arch")))) ("aethon:" + (name "Tom Willemsen") (address "thomas@aethon.nl") (signature-file "~/documents/work/aethon/signature.txt") (eval (setq message-sendmail-extra-arguments '("-a" "aethon") diff --git a/emacs/init.el b/emacs/init.el index 60ba521..176d904 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -415,7 +415,7 @@ Also change directories to current working directory." (setq type-break-keystroke-threshold '(nil . nil)) (setq uniquify-buffer-name-style 'post-forward) (setq use-dialog-box nil) -(setq user-full-name "Tom Willemsen") +(setq user-full-name "Tom Willemse") (setq user-mail-address "tom@ryuslash.org") (setq w3m-fill-column 72) (setq window-combination-resize t) diff --git a/emacs/site-lisp/dzen.el b/emacs/site-lisp/dzen.el index 6cc3eae..da83099 100644 --- a/emacs/site-lisp/dzen.el +++ b/emacs/site-lisp/dzen.el @@ -1,8 +1,8 @@ ;;; dzen.el --- Control DZEN2 from emacs -;; Copyright (C) 2012 Tom Willemsen +;; Copyright (C) 2012 Tom Willemse -;; Author: Tom Willemsen +;; Author: Tom Willemse ;; Keywords: convenience ;; This program is free software; you can redistribute it and/or modify diff --git a/emacs/site-lisp/eltuki.el b/emacs/site-lisp/eltuki.el index 224e9ab..d457a0f 100644 --- a/emacs/site-lisp/eltuki.el +++ b/emacs/site-lisp/eltuki.el @@ -1,8 +1,8 @@ ;;; eltuki.el --- Tekuti functions -;; Copyright (C) 2012 Tom Willemsen +;; Copyright (C) 2012 Tom Willemse -;; Author: Tom Willemsen +;; Author: Tom Willemse ;; Keywords: convenience ;; This program is free software; you can redistribute it and/or modify diff --git a/emacs/site-lisp/ext.el b/emacs/site-lisp/ext.el index 2ed65d4..eb84a3f 100644 --- a/emacs/site-lisp/ext.el +++ b/emacs/site-lisp/ext.el @@ -1,8 +1,8 @@ ;;; ext.el --- More emacs functions -;; Copyright (C) 2012 Tom Willemsen +;; Copyright (C) 2012 Tom Willemse -;; Author: Tom Willemsen +;; Author: Tom Willemse ;; Keywords: local ;; This program is free software; you can redistribute it and/or modify diff --git a/emacs/site-lisp/metalexpress.el b/emacs/site-lisp/metalexpress.el index 0c4539a..d4a92d7 100644 --- a/emacs/site-lisp/metalexpress.el +++ b/emacs/site-lisp/metalexpress.el @@ -1,8 +1,8 @@ ;;; metalexpress.el --- Listen to Metal Express Radio -;; Copyright (C) 2012 Tom Willemsen +;; Copyright (C) 2012 Tom Willemse -;; Author: Tom Willemsen +;; Author: Tom Willemse ;; Keywords: multimedia ;; This program is free software; you can redistribute it and/or modify diff --git a/emacs/site-lisp/mu4e-init.el b/emacs/site-lisp/mu4e-init.el index 258a6ef..e11baf5 100644 --- a/emacs/site-lisp/mu4e-init.el +++ b/emacs/site-lisp/mu4e-init.el @@ -1,8 +1,8 @@ ;;; mu4e-init.el --- mu4e initialization -;; Copyright (C) 2012 Tom Willemsen +;; Copyright (C) 2012 Tom Willemse -;; Author: Tom Willemsen +;; Author: Tom Willemse ;; Keywords: ;; This program is free software; you can redistribute it and/or modify diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index 027463b..2076093 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -1,8 +1,8 @@ ;;; oni.el --- Functions for emacs -;; Copyright (C) 2012 Tom Willemsen +;; Copyright (C) 2012 Tom Willemse -;; Author: Tom Willemsen +;; Author: Tom Willemse ;; Keywords: local ;; This program is free software; you can redistribute it and/or modify diff --git a/emacs/site-lisp/org-init.el b/emacs/site-lisp/org-init.el index 789b1bb..3c698d2 100644 --- a/emacs/site-lisp/org-init.el +++ b/emacs/site-lisp/org-init.el @@ -1,8 +1,8 @@ ;;; org-init.el --- Org initialization -;; Copyright (C) 2012 Tom Willemsen +;; Copyright (C) 2012 Tom Willemse -;; Author: Tom Willemsen +;; Author: Tom Willemse ;; Keywords: ;; This program is free software; you can redistribute it and/or modify diff --git a/emacs/site-lisp/quick-edit-mode.el b/emacs/site-lisp/quick-edit-mode.el index 821c738..898d7c2 100644 --- a/emacs/site-lisp/quick-edit-mode.el +++ b/emacs/site-lisp/quick-edit-mode.el @@ -1,8 +1,8 @@ ;;; quick-edit-mode.el --- Quickly edit stuff -;; Copyright (C) 2012 Tom Willemsen +;; Copyright (C) 2012 Tom Willemse -;; Author: Tom Willemsen +;; Author: Tom Willemse ;; Keywords: convenience ;; This program is free software; you can redistribute it and/or modify diff --git a/emacs/snippets/python-mode/import_from b/emacs/snippets/python-mode/import_from index 5c23b8e..d9cc4e2 100644 --- a/emacs/snippets/python-mode/import_from +++ b/emacs/snippets/python-mode/import_from @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # name: from ... import ... -# contributor: Tom Willemsen +# contributor: Tom Willemse # key: from # -- -from ${1:module} import ${2:class_or_module} \ No newline at end of file +from ${1:module} import ${2:class_or_module} -- cgit v1.3-2-g0d8e