Emacs: Update some things

This commit is contained in:
Tom Willemsen 2013-01-15 12:11:41 +01:00
parent 25dcd4dd48
commit 7a5a232c27
8 changed files with 172 additions and 36 deletions

View file

@ -40,8 +40,16 @@
'("\\.go$" flymake-simple-make-init)))) '("\\.go$" flymake-simple-make-init))))
(eval-after-load "ido" (eval-after-load "ido"
'(setq ido-ignore-buffers `(,@ido-ignore-buffers '(setq ido-ignore-buffers
"^\\*.*\\*$" "^irc\\." "^\\#"))) (list "^\\` " "^irc\\." "^\\#" "^\\*Customize Option:"
(eval-when-compile
(regexp-opt
'("*-jabber-roster-*"
"*Messages*"
"*fsm-debug*"
"*magit-process*"
"*magit-edit-log*"
"*Backtrace*"))))))
(eval-after-load "jabber" (eval-after-load "jabber"
'(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)) '(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo))
@ -113,10 +121,10 @@
(vertical-scroll-bars . nil) (vertical-scroll-bars . nil)
(menu-bar-lines . nil) (menu-bar-lines . nil)
(tool-bar-lines . nil) (tool-bar-lines . nil)
(font . "monaco-12"))) (font . "Consolas-14")))
(setq emms-source-file-default-directory "/mnt/music/") (setq emms-source-file-default-directory "/mnt/music/")
(setq erc-autojoin-channels-alist (setq erc-autojoin-channels-alist
'(("freenode.net" "#ninthfloor" "#emacs" "#dispass"))) '(("freenode.net" "#ninthfloor" "#emacs")))
(setq erc-hide-list '("JOIN" "PART" "QUIT")) (setq erc-hide-list '("JOIN" "PART" "QUIT"))
(setq erc-insert-timestamp-function 'erc-insert-timestamp-left) (setq erc-insert-timestamp-function 'erc-insert-timestamp-left)
(setq erc-nick "ryuslash") (setq erc-nick "ryuslash")
@ -177,11 +185,14 @@
(setq gnus-init-file "~/.emacs.d/gnus") (setq gnus-init-file "~/.emacs.d/gnus")
(setq gtags-auto-update t) (setq gtags-auto-update t)
(setq help-at-pt-display-when-idle 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-auto-merge-delay-time 1000000)
(setq ido-default-buffer-method 'selected-window) (setq ido-default-buffer-method 'selected-window)
(setq ido-max-window-height 1) (setq ido-max-window-height 1)
(setq ido-save-directory-list-file nil) (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 inferior-lisp-program "sbcl")
(setq inhibit-default-init t) (setq inhibit-default-init t)
(setq inhibit-local-menu-bar-menus t) (setq inhibit-local-menu-bar-menus t)
@ -206,9 +217,8 @@
(setq message-sendmail-extra-arguments '("-a" "ryuslash")) (setq message-sendmail-extra-arguments '("-a" "ryuslash"))
(setq package-archives (setq package-archives
'(("melpa" . "http://melpa.milkbox.net/packages/") '(("melpa" . "http://melpa.milkbox.net/packages/")
("ELPA" . "http://tromey.com/elpa/") ("marmalade" . "http://marmalade-repo.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/") ("gnu" . "http://elpa.gnu.org/packages/")))
("marmalade" . "http://marmalade-repo.org/packages/")))
(setq package-load-list '((htmlize "1.39") (setq package-load-list '((htmlize "1.39")
(lua-mode "20111107") (lua-mode "20111107")
all)) all))

View file

@ -1,6 +1,7 @@
#+TITLE: Emacs init #+TITLE: Emacs init
#+STYLE: <link href="http://ryuslash.ninth.su/test2.css" rel="stylesheet"> #+STYLE: <link href="http://ryuslash.ninth.su/test2.css" rel="stylesheet">
#+OPTIONS: author:nil #+OPTIONS: author:nil
#+STARTUP: showall
* Startup * Startup
@ -73,7 +74,8 @@
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(mapc #'oni:add-to-load-path-maybe-load-defs (mapc #'oni:add-to-load-path-maybe-load-defs
'("~/projects/emacs/dispass.el" "~/var/src/emacs/mode-icons" '("~/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 #+END_SRC
The =oni:add-to-load-path-maybe-load-defs= function just adds the 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 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. [[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-j") (kbd "C-l"))
(define-key key-translation-map (kbd "C-l") (kbd "C-j")) (define-key key-translation-map (kbd "C-l") (kbd "C-j"))
#+END_SRC #+END_SRC
@ -346,6 +348,14 @@
'(add-to-list 'eshell-visual-commands "unison")) '(add-to-list 'eshell-visual-commands "unison"))
#+end_src #+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 * Footnotes
[fn:1] Though it doesn't happen often that ~trunk~ is so messed up that [fn:1] Though it doesn't happen often that ~trunk~ is so messed up that

View file

@ -39,7 +39,9 @@
(defun dzen-update () (defun dzen-update ()
(let ((strl "") (let ((strl "")
(strc metal-express-radio-currently-playing) (strc (if (boundp 'metal-express-radio-currently-playing)
metal-express-radio-currently-playing
""))
(strr (format (strr (format
"jabber: %s ryu: %d gm: %d aet: %d 9n: %d rss: %d\n" "jabber: %s ryu: %d gm: %d aet: %d 9n: %d rss: %d\n"
(oni:current-jabber-status) (oni:current-jabber-status)

View file

@ -61,7 +61,7 @@ DOT are intentionally being skipped."
(defvar oni:required-packages (defvar oni:required-packages
'(graphviz-dot-mode htmlize magit rainbow-delimiters rainbow-mode '(graphviz-dot-mode htmlize magit rainbow-delimiters rainbow-mode
yasnippet markdown-mode flymake flymake-cursor sauron expand-region 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.") "List of all the packages I have (want) installed.")
(defun oni:after-save-func () (defun oni:after-save-func ()
@ -81,7 +81,9 @@ DOT are intentionally being skipped."
nil (format "%s%s (in %s minutes)" nil (format "%s%s (in %s minutes)"
new-time appt-msg min-to-app) nil) new-time appt-msg min-to-app) nil)
(appt-disp-window min-to-app new-time appt-msg)) (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 () (defun oni:before-save-func ()
"Function for `before-save-hook'." "Function for `before-save-hook'."
(if (eq major-mode 'html-mode) (if (eq major-mode 'html-mode)
@ -192,7 +194,8 @@ DOT are intentionally being skipped."
(defun oni:html-mode-func () (defun oni:html-mode-func ()
"Function for `html-mode-hook'." "Function for `html-mode-hook'."
(yas-minor-mode) (yas-minor-mode)
(fci-mode)) (highlight-80+-mode)
(flycheck-mode))
(defun oni:indent-shift-left (start end &optional count) (defun oni:indent-shift-left (start end &optional count)
"Rigidly indent region. "Rigidly indent region.
@ -258,8 +261,7 @@ If COUNT has been specified indent by that much, otherwise look at
(defun oni:js-mode-func () (defun oni:js-mode-func ()
"Function for `js-mode-hook'." "Function for `js-mode-hook'."
(rainbow-delimiters-mode) (rainbow-delimiters-mode)
(local-set-key "\C-j" 'oni:newline-and-indent) (local-set-key "\C-j" 'oni:newline-and-indent))
(pretty-symbols-mode -1))
(defun oni:js2-mode-func () (defun oni:js2-mode-func ()
"Function for `js2-mode-hook'." "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'." "Function for `lua-mode-hook'."
(local-unset-key (kbd ")")) (local-unset-key (kbd ")"))
(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 () (defun oni:magit-log-edit-mode-func ()
"Function for `magit-log-edit-mode-hook'." "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 () (defun oni:php-mode-func ()
"Function for `php-mode-hook'." "Function for `php-mode-hook'."
(flymake-mode)
(local-set-key "\C-j" 'oni:newline-and-indent) (local-set-key "\C-j" 'oni:newline-and-indent)
(c-set-offset 'arglist-intro '+) (c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-close '0) (c-set-offset 'arglist-close '0)
(rainbow-delimiters-mode) (rainbow-delimiters-mode)
(setq fci-rule-column 80)) (setq-local highlight-80+-columns 80)
(flycheck-mode))
(defun oni:pretty-control-l-function (win) (defun oni:pretty-control-l-function (win)
"Just make a string of either `fci-rule-colum' or `fill-column' "Just make a string of either `highlight-80+-columns' or
length -1. Use the `-' character. WIN is ignored." `fill-column' length -1. Use the `-' character. WIN is
ignored."
(make-string (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 () (defun oni:prog-mode-func ()
"Function for `prog-mode-hook'." "Function for `prog-mode-hook'."
(rainbow-delimiters-mode) (rainbow-delimiters-mode)
(fci-mode) (highlight-80+-mode)
(pretty-symbols-mode)
(yas-minor-mode) (yas-minor-mode)
(auto-fill-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) (local-set-key (kbd "C-<") 'python-indent-shift-left)
(set (make-local-variable 'electric-indent-chars) nil) (set (make-local-variable 'electric-indent-chars) nil)
(rainbow-delimiters-mode) (rainbow-delimiters-mode)
(setq fci-rule-column 79 (setq highlight-80+-columns 79
fill-column 72) fill-column 72)
(setq-local whitespace-style '(tab-mark)) (setq-local whitespace-style '(tab-mark))
(fci-mode) (highlight-80+-mode)
(whitespace-mode)) (whitespace-mode))
(defun oni:raise-ansi-term (arg) (defun oni:raise-ansi-term (arg)

View file

@ -33,13 +33,60 @@
(eval-after-load "org-crypt" (eval-after-load "org-crypt"
'(org-crypt-use-before-save-magic)) '(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 (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 (setq org-agenda-prefix-format
'((agenda . " %i %-12:c%?-12t% s") '((agenda . " %i %-12:c%?-12t% s")
(timeline . " % s") (timeline . " % s")
(todo . " %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 %(concat \"[ \"(org-format-outline-path (org-get-outline-path)) \" ]\") ") (tags . " %i %-12:c %(oni:org-maybe-outline-path)")
(search . " %i %-12:c"))) (search . " %i %-12:c")))
(setq org-agenda-sorting-strategy (setq org-agenda-sorting-strategy
'((agenda habit-down time-up priority-down category-keep) '((agenda habit-down time-up priority-down category-keep)
@ -54,12 +101,6 @@
"* TODO %?\n\n %a"))) "* TODO %?\n\n %a")))
(setq org-contacts-files '("~/documents/org/misc/contacts.org")) (setq org-contacts-files '("~/documents/org/misc/contacts.org"))
(setq org-directory (expand-file-name "~/documents/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-show-outline-path nil)
(setq org-agenda-todo-ignore-deadlines 'far) (setq org-agenda-todo-ignore-deadlines 'far)
(setq org-agenda-todo-ignore-scheduled t) (setq org-agenda-todo-ignore-scheduled t)
@ -103,5 +144,9 @@
(org-agenda-to-appt) (org-agenda-to-appt)
(ad-activate 'org-agenda-redo) (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) (provide 'org-init)
;;; org-init.el ends here ;;; org-init.el ends here

View file

@ -1,4 +1,4 @@
DESTDIR:=$(DESTDIR)/org-mode DESTDIR:=$(DESTDIR)/org-mode
objects=codeblock heading objects=codeblock heading project snippet
include ../../../dotfiles.mk include ../../../dotfiles.mk

View file

@ -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
<script src="/keyjs.js" type="text/javascript"></script>
<script type="text/javascript">
keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ],
"h": [ "keyjs_goto", "http://ryuslash.org" ] });
</script>
#+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...}

View file

@ -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