From 7a5a232c27394a8afd87abc2f27b31f62cd91b59 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 15 Jan 2013 12:11:41 +0100 Subject: [PATCH] Emacs: Update some things --- .emacs.d/init.el | 26 ++++++++---- .emacs.d/init.org | 14 ++++++- .emacs.d/site-lisp/dzen.el | 4 +- .emacs.d/site-lisp/oni.el | 34 +++++++++------- .emacs.d/site-lisp/org-init.el | 63 ++++++++++++++++++++++++----- .emacs.d/snippets/org-mode/Makefile | 2 +- .emacs.d/snippets/org-mode/project | 51 +++++++++++++++++++++++ .emacs.d/snippets/org-mode/snippet | 14 +++++++ 8 files changed, 172 insertions(+), 36 deletions(-) create mode 100644 .emacs.d/snippets/org-mode/project create mode 100644 .emacs.d/snippets/org-mode/snippet diff --git a/.emacs.d/init.el b/.emacs.d/init.el index ebbb83d..76ac42a 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -40,8 +40,16 @@ '("\\.go$" flymake-simple-make-init)))) (eval-after-load "ido" - '(setq ido-ignore-buffers `(,@ido-ignore-buffers - "^\\*.*\\*$" "^irc\\." "^\\#"))) + '(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 "jabber" '(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)) @@ -113,10 +121,10 @@ (vertical-scroll-bars . nil) (menu-bar-lines . nil) (tool-bar-lines . nil) - (font . "monaco-12"))) + (font . "Consolas-14"))) (setq emms-source-file-default-directory "/mnt/music/") (setq erc-autojoin-channels-alist - '(("freenode.net" "#ninthfloor" "#emacs" "#dispass"))) + '(("freenode.net" "#ninthfloor" "#emacs"))) (setq erc-hide-list '("JOIN" "PART" "QUIT")) (setq erc-insert-timestamp-function 'erc-insert-timestamp-left) (setq erc-nick "ryuslash") @@ -177,11 +185,14 @@ (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 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)) +(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) @@ -206,9 +217,8 @@ (setq message-sendmail-extra-arguments '("-a" "ryuslash")) (setq package-archives '(("melpa" . "http://melpa.milkbox.net/packages/") - ("ELPA" . "http://tromey.com/elpa/") - ("gnu" . "http://elpa.gnu.org/packages/") - ("marmalade" . "http://marmalade-repo.org/packages/"))) + ("marmalade" . "http://marmalade-repo.org/packages/") + ("gnu" . "http://elpa.gnu.org/packages/"))) (setq package-load-list '((htmlize "1.39") (lua-mode "20111107") all)) diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 6e7ca46..86cafbc 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -1,6 +1,7 @@ #+TITLE: Emacs init #+STYLE: #+OPTIONS: author:nil +#+STARTUP: showall * Startup @@ -73,7 +74,8 @@ #+BEGIN_SRC emacs-lisp (mapc #'oni:add-to-load-path-maybe-load-defs '("~/projects/emacs/dispass.el" "~/var/src/emacs/mode-icons" - "~/.emacs.d/site-lisp")) + "~/.emacs.d/site-lisp" "~/projects/emacs/pony-mode/src" + "~/projects/emacs/php-mode")) #+END_SRC The =oni:add-to-load-path-maybe-load-defs= function just adds the @@ -321,7 +323,7 @@ Since the ~C-l~ combination is so much easier than ~C-j~ when using the [[http://colemak.com][colemak]] keyboard layout and I use ~C-j~ much more, switch them. - #+BEGIN_SRC emacs-lisp tangle init2.el + #+BEGIN_SRC emacs-lisp :tangle init2.el (define-key key-translation-map (kbd "C-j") (kbd "C-l")) (define-key key-translation-map (kbd "C-l") (kbd "C-j")) #+END_SRC @@ -346,6 +348,14 @@ '(add-to-list 'eshell-visual-commands "unison")) #+end_src +* Window movement + + Make it easier to move through windows by using ~windmove~. + + #+BEGIN_SRC emacs-lisp :tangle init2.el + (windmove-default-keybindings) + #+END_SRC + * Footnotes [fn:1] Though it doesn't happen often that ~trunk~ is so messed up that diff --git a/.emacs.d/site-lisp/dzen.el b/.emacs.d/site-lisp/dzen.el index 2d43f95..6cc3eae 100644 --- a/.emacs.d/site-lisp/dzen.el +++ b/.emacs.d/site-lisp/dzen.el @@ -39,7 +39,9 @@ (defun dzen-update () (let ((strl "") - (strc metal-express-radio-currently-playing) + (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) diff --git a/.emacs.d/site-lisp/oni.el b/.emacs.d/site-lisp/oni.el index 79b5f6e..0098ea2 100644 --- a/.emacs.d/site-lisp/oni.el +++ b/.emacs.d/site-lisp/oni.el @@ -61,7 +61,7 @@ DOT are intentionally being skipped." (defvar oni:required-packages '(graphviz-dot-mode htmlize magit rainbow-delimiters rainbow-mode yasnippet markdown-mode flymake flymake-cursor sauron expand-region - fill-column-indicator git-auto-commit-mode idomenu magit smex) + git-auto-commit-mode idomenu magit smex) "List of all the packages I have (want) installed.") (defun oni:after-save-func () @@ -81,7 +81,9 @@ DOT are intentionally being skipped." 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) @@ -192,7 +194,8 @@ DOT are intentionally being skipped." (defun oni:html-mode-func () "Function for `html-mode-hook'." (yas-minor-mode) - (fci-mode)) + (highlight-80+-mode) + (flycheck-mode)) (defun oni:indent-shift-left (start end &optional count) "Rigidly indent region. @@ -258,8 +261,7 @@ If COUNT has been specified indent by that much, otherwise look at (defun oni:js-mode-func () "Function for `js-mode-hook'." (rainbow-delimiters-mode) - (local-set-key "\C-j" 'oni:newline-and-indent) - (pretty-symbols-mode -1)) + (local-set-key "\C-j" 'oni:newline-and-indent)) (defun oni:js2-mode-func () "Function for `js2-mode-hook'." @@ -293,7 +295,8 @@ If COUNT has been specified indent by that much, otherwise look at "Function for `lua-mode-hook'." (local-unset-key (kbd ")")) (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'." @@ -404,24 +407,25 @@ When dealing with braces, add another line and indent that too." (defun oni:php-mode-func () "Function for `php-mode-hook'." - (flymake-mode) (local-set-key "\C-j" 'oni:newline-and-indent) (c-set-offset 'arglist-intro '+) (c-set-offset 'arglist-close '0) (rainbow-delimiters-mode) - (setq fci-rule-column 80)) + (setq-local highlight-80+-columns 80) + (flycheck-mode)) (defun oni:pretty-control-l-function (win) - "Just make a string of either `fci-rule-colum' or `fill-column' -length -1. Use the `-' character. WIN is ignored." + "Just make a string of either `highlight-80+-columns' or +`fill-column' length -1. Use the `-' character. WIN is +ignored." (make-string - (1- (if (boundp 'fci-rule-column) fci-rule-column fill-column)) ?-)) + (1- (if (boundp 'highlight-80+-columns) + highlight-80+-columns fill-column)) ?-)) (defun oni:prog-mode-func () "Function for `prog-mode-hook'." (rainbow-delimiters-mode) - (fci-mode) - (pretty-symbols-mode) + (highlight-80+-mode) (yas-minor-mode) (auto-fill-mode)) @@ -432,10 +436,10 @@ length -1. Use the `-' character. WIN is ignored." (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 + (setq highlight-80+-columns 79 fill-column 72) (setq-local whitespace-style '(tab-mark)) - (fci-mode) + (highlight-80+-mode) (whitespace-mode)) (defun oni:raise-ansi-term (arg) diff --git a/.emacs.d/site-lisp/org-init.el b/.emacs.d/site-lisp/org-init.el index 23ae6a5..b02f0cc 100644 --- a/.emacs.d/site-lisp/org-init.el +++ b/.emacs.d/site-lisp/org-init.el @@ -33,13 +33,60 @@ (eval-after-load "org-crypt" '(org-crypt-use-before-save-magic)) +(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/aethon.org")) + "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 - '(("w" "Work todo." tags-todo "work"))) + '(("P" . "Personal only") + ("Pa" "Personal agenda" agenda "" + ((org-agenda-files (append oni:personal-agenda-files + oni:common-agenda-files)))) + ("Pt" "Personal todo" agenda "" + ((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 %(concat \"[ \"(org-format-outline-path (org-get-outline-path)) \" ]\") ") - (tags . " %i %-12:c %(concat \"[ \"(org-format-outline-path (org-get-outline-path)) \" ]\") ") + (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) @@ -54,12 +101,6 @@ "* TODO %?\n\n %a"))) (setq org-contacts-files '("~/documents/org/misc/contacts.org")) (setq org-directory (expand-file-name "~/documents/org")) -(setq org-agenda-files - (append - `(,(concat org-directory "/tasks") - ,(concat org-directory "/misc/contacts.org") - ,(concat org-directory "/misc/bookmarks.org")) - org-agenda-files)) (setq org-agenda-show-outline-path nil) (setq org-agenda-todo-ignore-deadlines 'far) (setq org-agenda-todo-ignore-scheduled t) @@ -103,5 +144,9 @@ (org-agenda-to-appt) (ad-activate 'org-agenda-redo) +(oni:set-org-agenda-files) +(run-at-time "09:00" (* 60 60 24) 'oni:set-org-agenda-files) +(run-at-time "17:00" (* 60 60 24) 'oni:set-org-agenda-files) + (provide 'org-init) ;;; org-init.el ends here diff --git a/.emacs.d/snippets/org-mode/Makefile b/.emacs.d/snippets/org-mode/Makefile index e913708..34d4cd9 100644 --- a/.emacs.d/snippets/org-mode/Makefile +++ b/.emacs.d/snippets/org-mode/Makefile @@ -1,4 +1,4 @@ DESTDIR:=$(DESTDIR)/org-mode -objects=codeblock heading +objects=codeblock heading project snippet include ../../../dotfiles.mk diff --git a/.emacs.d/snippets/org-mode/project b/.emacs.d/snippets/org-mode/project new file mode 100644 index 0000000..269d655 --- /dev/null +++ b/.emacs.d/snippets/org-mode/project @@ -0,0 +1,51 @@ +# -*- mode: snippet -*- +# name: project +# key: project +# -- +#+TITLE: ${1:project_name} +#+LINK: src ${2:http://code.ryuslash.org/cgit.cgi/$3$1/} +#+LINK: tar_gz $2${4:snapshot/$1-master}.tar.gz +#+LINK: zip $2$4.zip +#+STARTUP: showall + +#+begin_html + + +#+end_html + +#+INCLUDE: "dlmenu.inc" + +* About + + ${5:A short description about $1} + + | $0Status | $6 | + | Language | $7 | + | License | ${8:GPLv3} | + +* Why? + + ${9:Why did you even think of writing $1?} + +* Features + + ${10:$1 does...} + +* Dependencies + + ${11:$1 needs to have...} + +* Download + + ${12:To download $1...} + +* Install + + ${13:To install $1...} + +* Usage + + ${14:Using $1...} \ No newline at end of file diff --git a/.emacs.d/snippets/org-mode/snippet b/.emacs.d/snippets/org-mode/snippet new file mode 100644 index 0000000..67f15d5 --- /dev/null +++ b/.emacs.d/snippets/org-mode/snippet @@ -0,0 +1,14 @@ +# -*- mode: snippet -*- +# name: snippet +# key: snippet +# -- +#+TITLE: ${1:snippet-name} +#+OPTIONS: toc:nil + +* $1 + + ${2:A short description abount $1} + + #+BEGIN_SRC $3 :tangle yes +$0 + #+END_SRC \ No newline at end of file