From 7a5a232c27394a8afd87abc2f27b31f62cd91b59 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 15 Jan 2013 12:11:41 +0100 Subject: Emacs: Update some things --- .emacs.d/site-lisp/dzen.el | 4 ++- .emacs.d/site-lisp/oni.el | 34 +++++++++++++---------- .emacs.d/site-lisp/org-init.el | 63 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 76 insertions(+), 25 deletions(-) (limited to '.emacs.d/site-lisp') 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 -- cgit v1.2.3-54-g00ecf