summaryrefslogtreecommitdiffstats
path: root/.emacs.d
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d')
-rw-r--r--.emacs.d/init.el221
-rw-r--r--.emacs.d/init.org508
-rw-r--r--.emacs.d/site-lisp/dzen.el4
-rw-r--r--.emacs.d/site-lisp/oni.el222
-rw-r--r--.emacs.d/site-lisp/org-init.el83
-rw-r--r--.emacs.d/snippets/org-mode/Makefile2
-rw-r--r--.emacs.d/snippets/org-mode/project51
-rw-r--r--.emacs.d/snippets/org-mode/snippet14
8 files changed, 541 insertions, 564 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index d2d68bc..21ecce6 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -8,13 +8,6 @@
(load (concat user-emacs-directory "init2"))
-(define-key key-translation-map (kbd "C-j") (kbd "C-l"))
-(define-key key-translation-map (kbd "C-l") (kbd "C-j"))
-
-(defalias 'yes-or-no-p 'y-or-n-p)
-(defalias 'list-buffers 'ibuffer)
-(defalias 'dabbrev-expand 'hippie-expand)
-
(defface git-commit-summary-face
'((t (:inherit org-level-1)))
"Face for the git title line."
@@ -30,69 +23,31 @@
"Face for the supposedly empty line in commit messages."
:group 'local)
-(eval-after-load "eldoc"
- '(diminish 'eldoc-mode))
-
-(eval-after-load "em-term"
- '(add-to-list 'eshell-visual-commands "unison"))
-
-(eval-after-load "emms-source-file"
- '(progn
- (require 'emms-setup)
- (require 'emms-player-mpd)
-
- (emms-standard)
-
- (add-to-list 'emms-info-functions 'emms-info-mpd)
- (add-to-list 'emms-player-list 'emms-player-mpd)
-
- (setq emms-player-mpd-server-name "localhost")
- (setq emms-player-mpd-server-port "6600")
- (setq emms-player-mpd-music-directory "/mnt/music/mp3")))
-
-(eval-after-load "flymake"
- '(progn
- (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 "ido"
- '(setq ido-ignore-buffers `(,@ido-ignore-buffers
- "^\\*.*\\*$" "^irc\\." "^\\#")))
-
-(eval-after-load "jabber"
- '(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo))
-
-(eval-after-load "newst-treeview"
- '(require 'newsticker-init))
-
-(eval-after-load "org"
- '(require 'org-init))
-
-(eval-after-load "pretty-symbols-mode"
- '(diminish 'pretty-symbols-mode))
-
-(eval-after-load "rainbow-mode"
- '(diminish 'rainbmow-mode))
-
-(eval-after-load "smex"
- '(progn
- (global-set-key (kbd "M-x") 'smex)
- (global-set-key (kbd "C-M-x") 'smex-major-mode-commands)))
-
-(eval-after-load "yasnippet"
- '(diminish 'yas-minor-mode))
+(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))
+(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 'geiser-install)
+(require 'uniquify)
+(require 'ext)
+(require 'oni)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
@@ -112,11 +67,9 @@
(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
- `((".*" ,temporary-file-directory t)))
+(setq auto-save-file-name-transforms oni:auto-save-name-transforms)
(setq avandu-article-render-function #'avandu-view-w3m)
-(setq backup-directory-alist
- `((".*" . ,temporary-file-directory)))
+(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 . +)
@@ -141,75 +94,30 @@
(vertical-scroll-bars . nil)
(menu-bar-lines . nil)
(tool-bar-lines . nil)
- (font . "monaco-12")))
-(setq emms-source-file-default-directory "/mnt/music/")
+ (font . "Envy Code R:pixelsize=18")
+ (alpha 90 90)))
+(setq elnode-do-init nil)
(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")
(setq erc-timestamp-format "[%H:%M] ")
(setq erc-timestamp-only-if-changed-flag nil)
-(setq eshell-highlight-prompt nil)
-(setq eshell-prompt-function 'oni:eshell-prompt-function)
-(setq eshell-prompt-regexp "^[#$]> ")
(setq fci-rule-color "darkred")
-(setq flymake-gui-warnings-enabled nil)
-(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"))))
(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 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)
@@ -217,15 +125,16 @@
(setq initial-major-mode 'emacs-lisp-mode)
(setq initial-scratch-message nil)
(setq jabber-account-list '(("ryuslash@jabber.org")
- ("tom@ryuslash.org"
+ ("tom@ryuslash.org/Emacs"
(:connection-type . ssl))))
-(setq jabber-chat-buffer-format "*jabber:%n*")
+(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 <\n")
-(setq jabber-chat-local-prompt-format "%t >\n")
+(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-history-dir "~/.emacs.d/jabber")
+(setq jabber-muc-autojoin '("aethon@muc.ryuslash.org"))
(setq jabber-roster-show-bindings nil)
(setq jit-lock-defer-time 0.2)
(setq magit-repo-dirs '("~/projects/" "~/var/src/"))
@@ -234,9 +143,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))
@@ -249,6 +157,7 @@
(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)
@@ -272,12 +181,12 @@
(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 'erc-mode-hook 'oni:erc-mode-func)
-(add-hook 'eshell-mode-hook 'oni:eshell-mode-func)
-(add-hook 'flymake-mode-hook 'oni:flymake-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-alert-message-hooks 'oni:jabber-alert-message-func)
(add-hook 'jabber-chat-mode-hook 'oni:jabber-chat-mode-func)
@@ -299,19 +208,17 @@
(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 "<XF86AudioNext>") 'emms-next)
-(global-set-key (kbd "<XF86AudioPlay>") 'oni:emms-toggle-playing)
-(global-set-key (kbd "<XF86AudioPrev>") 'emms-previous)
-(global-set-key (kbd "<XF86AudioStop>") 'emms-stop)
(global-set-key (kbd "<XF86HomePage>") 'oni:raise-scratch)
(global-set-key (kbd "<XF86Mail>") 'oni:view-mail)
-(global-set-key (kbd "<XF86Tools>") 'oni:start-emms)
(global-set-key (kbd "<f10>") 'git-project-show-files)
(global-set-key (kbd "<f5>") 'ext:reload-buffer)
(global-set-key (kbd "<f6>") 'jabber-switch-to-roster-buffer)
(global-set-key (kbd "<f7>") 'magit-status)
-(global-set-key (kbd "<f8>") 'oni:raise-eshell)
+(global-set-key (kbd "<hiragana>") '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)
@@ -329,14 +236,14 @@
(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-4") 'split-window-horizontally)
-(global-set-key (kbd "M-n") 'idomenu)
-(global-set-key (kbd "\"") 'oni:self-insert-dwim)
-(global-set-key (kbd "M-o") 'other-window)
+(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-0") 'delete-window)
+(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)
(if (daemonp)
(global-set-key "\C-x\C-c" 'oni:close-client-window))
@@ -369,24 +276,15 @@
'display-buffer-alist
'("^\\*magit: .*\\*$" . ((display-buffer-same-window . nil))))
-(unless (oni:required-packages-installed-p)
- (message "%s" "Refreshing package database...")
- (package-refresh-contents)
- (message "%s" " done.")
- (mapc #'(lambda (package)
- (when (not (package-installed-p package))
- (package-install package)))
- oni:required-packages))
-
(blink-cursor-mode -1)
(column-number-mode -1)
(line-number-mode -1)
-(menu-bar-mode -1)
-(scroll-bar-mode -1)
-(tool-bar-mode -1)
(tooltip-mode -1)
+(package-initialize)
+
(auto-insert-mode)
+(cua-selection-mode t)
(electric-indent-mode)
(electric-pair-mode)
(ido-mode)
@@ -398,8 +296,8 @@
(smex-initialize)
(help-at-pt-set-timer)
-
-(load-theme 'yoshi t)
+(windmove-default-keybindings)
+(global-diff-hl-mode)
(load custom-file)
;; (load "rudel-loaddefs.el")
@@ -408,7 +306,6 @@
(server-start))
(diminish 'auto-fill-function "_")
-(ac-config-default)
(provide 'init)
diff --git a/.emacs.d/init.org b/.emacs.d/init.org
index 6cd2032..f4acfca 100644
--- a/.emacs.d/init.org
+++ b/.emacs.d/init.org
@@ -1,308 +1,310 @@
#+TITLE: Emacs init
#+STYLE: <link href="http://ryuslash.ninth.su/test2.css" rel="stylesheet">
#+OPTIONS: author:nil
+#+STARTUP: showall
+#+LINK: yoshi-theme http://ryuslash.org/projects/yoshi-theme.html
-* Startup
-
- Startup requires a bit of customization to handle all my
- customizations.
-
-** Load paths
-
- I have two versions of Emacs installed on my main computer. I have
- a daily build of Emacs's ~trunk~ (or currently ~emacs-24~) branch from
- bazaar and I have the official ~emacs~ package from archlinux
- installed. I keep that second one around so that the occasional
- emacs package that I install using ~pacman~ will recognize it as a
- dependency and so that if there has been some horrible mistake in
- the ~trunk~ branch I still have a stable version to fall back
- on[fn:1].
-
-*** Package initialization
+* Emacs init
- In order for packages installed through ELPA to be included
- without having to mess with load paths and such, use:
-
- #+NAME: package-initialize
- #+BEGIN_SRC emacs-lisp
- (package-initialize)
- #+END_SRC
+ Before doing anything else I should make sure that both the
+ directories ~/usr/local/emacs/share/emacs/site-lisp~ and
+ ~/usr/share/emacs/site-list~ are included in =load-path=, along with
+ their subdirectories, but only if they haven't already been added
+ and exist. Place them at the end of =load-path= so they don't mess up
+ package precedence.
-*** site-lisp
-
- Because of the setup I wrote about I need to have both the
- self-built ~site-lisp~ directory in my load path *and* the "official"
- one.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (eval-and-compile
+ (defun oni:path-init (dir)
+ "Add DIR to `load-path' and all its subdirectories, unless
+ DIR is already in `load-path'."
+ (unless (or (member dir load-path) (not (file-exists-p dir)))
+ (let ((default-directory dir))
+ (add-to-list 'load-path dir t)
+ (normal-top-level-add-subdirs-to-load-path))))
+ (oni:path-init "/usr/share/emacs/site-lisp")
+ (oni:path-init "/usr/local/emacs/share/emacs/site-lisp"))
+ #+END_SRC
- The =oni:add-all-to-load-path= function just binds =default-directory=
- to the given directory and calls
- =normal-top-level-add-subdirs-to-load-path= to add it and all its
- subdirectories to the load path.
+ Add my project [[yoshi-theme]] to =custom-theme-load-path= and load it.
- #+NAME: add-all
- #+BEGIN_SRC emacs-lisp
- (defun oni:add-all-to-load-path (dir)
- (add-to-list 'load-path dir)
- (let ((default-directory dir))
- (normal-top-level-add-subdirs-to-load-path)))
- #+END_SRC
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (add-to-list 'custom-theme-load-path "~/projects/emacs/yoshi-theme/")
+ (load-theme 'yoshi t)
+ #+END_SRC
-**** TODO Add load paths in different order depending on version
+ Remove the ~menu-bar~, ~tool-bar~ and ~scroll-bar~ from the UI since I
+ don't use them at all.
- The officially installed version should load
- =/usr/share/emacs/site-lisp= before
- =/usr/local/emacs/share/emacs/sit-lisp= and the bzr version should
- do the reversed.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (menu-bar-mode -1)
+ (scroll-bar-mode -1)
+ (tool-bar-mode -1)
+ #+END_SRC
-*** Projects
+ Add any other interesting paths to =load-path= and, if it exists,
+ load the ~loaddefs.el~ file from these directories.
- Then there are some projects I'm working on, which I use on a
- daily basis, these should also be added so I don't have to
- constantly remove and re-install them through ~package.el~ when
- working on them. And there is the ~load-defs.el~ in my personal
- ~site-lisp~ directory of course.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (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
- #+NAME: load-projects
- #+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"))
- #+END_SRC
+ Don't ask ~yes~ or ~no~, ask ~y~ or ~n~, I've never had an accidental ~y~ so
+ far.
- The =oni:add-to-load-path-maybe-load-defs= function just adds the
- given directory to the load path and then looks for a file named
- ~loaddefs.el~ within that directory, if it exists it loads it.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (defalias 'yes-or-no-p 'y-or-n-p)
+ #+END_SRC
- #+NAME: add-with-loaddefs
- #+BEGIN_SRC emacs-lisp
- (defun oni:add-to-load-path-maybe-load-defs (dir)
- (add-to-list 'load-path dir)
- (let ((loaddefs (concat dir "/loaddefs.el")))
- (when (file-exists-p loaddefs)
- (load loaddefs))))
- #+END_SRC
+ Use =ibuffer= instead of the default =list-buffers= because it has many
+ more features.
-*** Themes
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (defalias 'list-buffers 'ibuffer)
+ #+END_SRC
- And, finally, I'm also working on a color theme for emacs, this
- should be added to ~custom-theme-load-path~. By using =mapc= here as
- well I'm keeping in mind that this isn't the first theme I've
- worked on and it might not be the last either.
+ Do the same with =hippie-expand= and =dabbrev-expand=.
- #+NAME: load-themes
- #+BEGIN_SRC emacs-lisp
- (mapc #'oni:add-to-custom-theme-load-path
- '("~/projects/emacs/yoshi-theme"))
- #+END_SRC
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (defalias 'dabbrev-expand 'hippie-expand)
+ #+END_SRC
- The =oni:add-to-custom-theme-load-path= just adds the given
- directory to the cutom theme load path.
+ Don't show it when ~eldoc~ is running, I almost assume that it is
+ whenever I'm working in a mode that supports it anyway. This should
+ only execute once ~eldoc~ has been loaded.
- #+NAME: add-themes
- #+BEGIN_SRC emacs-lisp
- (defun oni:add-to-custom-theme-load-path (dir)
- (add-to-list 'custom-theme-load-path dir))
- #+END_SRC
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (eval-after-load "eldoc" '(diminish 'eldoc-mode))
+ #+END_SRC
-*** Evaluation
+ Use the standard EMMS configuration and add some MPD settings.
- Because during byte-compilation certain parts loaded so far might
- also be required I put it in an =eval-and-compile= form, so that all
- components are loaded with ~emacs -Q~ as well. Without this
- compilation might fail at certain points.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el :noweb yes
- (eval-and-compile
- <<add-all>>
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (defun oni:emms-init ()
+ "Initialization function for EMMS."
+ (require 'emms-setup)
+ (require 'emms-player-mpd)
- <<add-with-loaddefs>>
+ (emms-standard)
- <<add-themes>>
+ (add-to-list 'emms-info-functions 'emms-info-mpd)
+ (add-to-list 'emms-player-list 'emms-player-mpd)
- <<package-initialize>>
- <<load-site-lisps>>
- <<load-projects>>
- <<load-themes>>)
- #+END_SRC
-
-** Modules
+ (setq emms-player-mpd-server-name "localhost")
+ (setq emms-player-mpd-server-port "6600")
+ (setq emms-player-mpd-music-directory "/mnt/music/mp3"))
- While I try to use =eval-after-load= and =autoload= as much as
- possible, some things require direct =require='ing to be of use.
+ (eval-after-load "emms-source-file" '(oni:emms-init))
+ (setq emms-source-file-default-directory "/mnt/music/")
+ #+END_SRC
-*** Require
-
- - ~auto-complete-config~ :: This sets up some default settings to
- make ~auto-complete~ work for most[fn:2] of the modes it
- supports.
+ Add some keybindings for EMMS.
#+BEGIN_SRC emacs-lisp :tangle init2.el
- (require 'auto-complete-config)
+ (defun oni:emms-toggle-playing ()
+ "Toggle between playing/paused states."
+ (interactive)
+ (if (eq emms-player-playing-p nil)
+ (emms-start)
+ (emms-pause)))
+
+ (defun oni:start-emms ()
+ "Check to see if the function `emms' exists, if not call
+ `emms-player-mpd-connect' and assume that will have loaded it."
+ (interactive)
+ (unless (fboundp 'emms)
+ (emms-player-mpd-connect))
+ (emms))
+
+ (global-set-key (kbd "<XF86AudioNext>") 'emms-next)
+ (global-set-key (kbd "<XF86AudioPlay>") 'oni:emms-toggle-playing)
+ (global-set-key (kbd "<XF86AudioPrev>") 'emms-previous)
+ (global-set-key (kbd "<XF86AudioStop>") 'emms-stop)
+ (global-set-key (kbd "<XF86Tools>") 'oni:start-emms)
#+END_SRC
- - ~geiser-install~ :: Sets up geiser autoloads and such.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (require 'geiser-install)
- #+END_SRC
-
- - ~uniquify~ :: Provides more helpful buffer name uniquification.
- The default of using ~buffer-name<2>~ is boring and
- uninformative, ~uniquify~ fixes this.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (require 'uniquify)
- #+END_SRC
-
- - ~ext~ :: Functions from external sources.
- - ~oni~ :: Functions written personally.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (require 'ext)
- (require 'oni)
- #+END_SRC
-
-*** Autoload
-
- These might not be used at all in a session, so they should only
- be loaded when necessary.
-
- =define-slime-contrib= was used by some module that didn't autoload
- or require it[fn:3]. But since I don't use whichever model it
- was every day, it is of no use to load it every single time.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'define-slime-contrib "slime")
- #+END_SRC
-
- I installed ~global~ with ~pacman~, but this doesn't add anything to
- any =loaddefs.el=, so doesn't create any autoloads.
+ 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 :tangle init2.el
- (autoload 'gtags-mode "gtags" nil t)
- #+END_SRC
-
- ~jabber.el~ does create ~jabber-autoloads.el~, but I only ever start
- using it through ~jabber-connect~, so anything else isn't really
- necessary.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'jabber-connect "jabber" nil t)
- #+END_SRC
-
- I used to work a bit on ~php-mode~, but that was a while ago, so
- it's still in my ~site-lisp~ directory.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'php-mode "php-mode" nil t)
- #+END_SRC
-
- The same that goes for ~gtags.el~ also goes for ~po-mode.el~.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'po-mode "po-mode" nil t)
- #+END_SRC
-
- And the same that went for ~php-mode~ also goes for ~pony-mode~,
- except I'm still working on it and I was too lazy to put it with
- my other projects. I should still do that.
-
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'pony-mode "pony-mode" nil t)
- #+END_SRC
-
- ~sawfish.el~ has the same problem that ~gtags.el~ and ~po-mode.el~ have.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (defun oni:flymake-init ()
+ "Initialization function for flymake."
+ (require 'flymake-cursor)
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'sawfish-mode "sawfish" nil t)
- #+END_SRC
+ (add-to-list ; Make sure pyflakes is loaded
+ 'flymake-allowed-file-name-masks ; for python files.
+ '("\\.py\\'" ext:flymake-pyflakes-init))
- I use =server-running-p= to check whether or not I should start a
- new server, but this function isn't autoloaded by default.
+ (add-to-list ; Error line repexp for go
+ 'flymake-err-line-patterns ; compilation.
+ '("^\\([a-zA-Z0-9_]+\\.go\\):\\([0-9]+\\):\\(.*\\)$"
+ 1 2 nil 3))
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'server-running-p "server")
- #+END_SRC
+ (add-to-list ; Go uses makefiles, makes
+ 'flymake-allowed-file-name-masks ; flymaking 'easy'.
+ '("\\.go$" flymake-simple-make-init)))
- I was starting to try ~slime-js~ to make JavaScript programming
- more interesting, but I haven't gotten around to trying it out
- fully, yet. It shares issues with ~gtags.el~, ~po-mode.el~ and
- ~sawfish.el~.
+ (eval-after-load "flymake" '(oni:flymake-init))
+ #+END_SRC
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'slime-js-minor-mode "slime-js" nil t)
- #+END_SRC
+ Disable the GUI for flymake errors, 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.
- I found ~xmodmap-mode~ on the [[http://emacswiki.org][EmacsWiki]] some time ago, it was
- simple and a good example of how to use ~define-generic-mode~, but
- since it's not really my project and it's really small it just
- sits in my ~site-lisp~ directory.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (setq flymake-gui-warnings-enabled nil)
+ (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
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'xmodmap-mode "xmodmap-mode" nil t)
- #+END_SRC
+ After loading ~flycheck~ Remove the default python checkers and
+ replace them with my own, which tries both ~flake8~ and ~pylint~.
- ~w3m~ also has a setup module like ~geiser-install~, but since I only
- ever use these two functions to start it, there is no real need
- for anything else.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (eval-after-load "flycheck"
+ '(progn
+ (mapc (lambda (c) (delete c flycheck-checkers))
+ '(python-pylint python-pyflakes))))
+ #+END_SRC
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (autoload 'w3m-bookmark-view "w3m" nil t)
- (autoload 'w3m-goto-url "w3m" nil t)
- #+END_SRC
+** Eshell
-* Aliases
+ Add ~unison~ to the list of =eshell-visual-commands= because it
+ expects unbuffered input and eshell just doesn't give that.
- There are some functions that are just better than others, no
- matter how politically incorrect it might be to admit.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (eval-after-load "em-term"
+ '(add-to-list 'eshell-visual-commands "unison"))
+ #+END_SRC
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (defalias 'yes-or-no-p 'y-or-n-p)
- (defalias 'list-buffers 'ibuffer)
- (defalias 'dabbrev-expand 'hippie-expand)
- #+END_SRC
+ Don't let eshell highlight it's prompt, this way I can decide the
+ colors for it myself.
-* Faces
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (setq eshell-highlight-prompt nil)
+ #+END_SRC
- Define faces for use with ~magit~ log edit mode.
+ In the prompt:
- #+BEGIN_SRC emacs-lisp :tangle init2.el
- (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
+ - 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.
-* Keys
+ And set the =eshell-prompt-regexp= to
- With the awesome power of Emacs comes the need for lots of
- keybindings.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (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
-** Translation
+ Don't truncate lines in eshell, wrap them.
- Since the ~C-l~ combination is so much easier than ~C-j~ when using
- the [[http://colemak.com][colemak]] keyboard layout and ~C-j~ is used so much more, switch
- them.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (defun oni:eshell-mode-func ()
+ "Function for `eshell-mode-hook'."
+ (setq truncate-lines nil))
- #+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"))
+ (add-hook 'eshell-mode-hook 'oni:eshell-mode-func)
#+END_SRC
-* Footnotes
-
-[fn:1] Though it doesn't happen often that ~trunk~ is so messed up that
-I can't use it.
-[fn:2] Or perhaps all.
+ Bind the ~f8~ key to easily show eshell.
-[fn:3] I think it was ~slime-js-minor-mode~, but I'm not sure.
+ #+BEGIN_SRC emacs-lisp :tangle init2.el
+ (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 "<f8>") 'oni:raise-eshell)
+ #+END_SRC
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 979e804..ea64d3f 100644
--- a/.emacs.d/site-lisp/oni.el
+++ b/.emacs.d/site-lisp/oni.el
@@ -27,22 +27,6 @@
(autoload 'notifications-notify "notifications")
(autoload 'jabber-send-message "jabber-chat")
-(defmacro oni:define-mailbox (name email &optional signature longname)
- "Define a mailbox function for mailbox NAME with address EMAIL.
-Optionally set signature to SIGNATURE and use LONGNAME as the
-actual account name."
- `(defun ,(make-symbol (concat "oni:" name "-mailbox")) ()
- ,(concat "Settings for " name " mailbox")
- (setq mu4e-mu-home ,(expand-file-name (concat "~/.mu/" name))
- mu4e-maildir ,(expand-file-name (concat "~/documents/mail/"
- (or longname name)))
- mu4e-get-mail-command ,(concat "offlineimap -oa " (or longname
- name))
- mu4e~main-buffer-name ,(concat "*mu4e-" name "*")
- user-mail-address ,email
- message-sendmail-extra-arguments '("-a" ,name)
- message-signature-file ,signature)))
-
(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
@@ -50,20 +34,6 @@ DOT are intentionally being skipped."
(concat (symbol-name user) "@" (symbol-name host) "."
(symbol-name com)))
-(defvar oni:mailbox-map
- '("top" ("menu"
- ("ryulash.org" . "ryuslash")
- ("ninthfloor" . "ninthfloor")
- ("gmail" . "gmail")
- ("aethon" . "aethon")))
- "A mailbox map for use with `tmm-prompt'.")
-
-(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)
- "List of all the packages I have (want) installed.")
-
(defun oni:after-save-func ()
"Function for `after-save-hook'."
(oni:compile-el)
@@ -81,7 +51,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)
@@ -99,6 +71,10 @@ DOT are intentionally being skipped."
(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))
@@ -128,12 +104,10 @@ DOT are intentionally being skipped."
"Function for `emacs-lisp-mode-hook'."
(eldoc-mode))
-(defun oni:emms-toggle-playing ()
- "Toggle between playing/paused states."
- (interactive)
- (if (eq emms-player-playing-p nil)
- (emms-start)
- (emms-pause)))
+(defun oni:emacs-startup-func ()
+ "Function for `emacs-init-hook'."
+ (require 'auto-complete-config)
+ (ac-config-default))
(defun oni:erc-mode-func ()
"Function for `erc-mode-hook'."
@@ -141,44 +115,6 @@ DOT are intentionally being skipped."
(visual-line-mode)
(setq truncate-lines nil))
-(defun oni:eshell-mode-func ()
- "Function for `eshell-mode-hook'."
- (setq truncate-lines 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"))
- "> ")))
-
-(defun oni:flymake-mode-func ()
- "Function for `flymake-mode-hook'."
- (local-set-key [M-P] 'flymake-goto-prev-error)
- (local-set-key [M-N] 'flymake-goto-next-error))
-
(defun oni:go-mode-func ()
"Function for `go-mode-hook'."
(setq indent-tabs-mode nil)
@@ -189,9 +125,28 @@ DOT are intentionally being skipped."
(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'."
- (fci-mode))
+ (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.
@@ -245,6 +200,10 @@ If COUNT has been specified indent by that much, otherwise look at
'(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
@@ -257,8 +216,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'."
@@ -292,7 +250,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'."
@@ -403,29 +362,30 @@ 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 fci-rule-column 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 `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)) ?-))
+ (1- (if (boundp 'fci-rule-column)
+ fci-rule-column fill-column)) ?-))
(defun oni:prog-mode-func ()
"Function for `prog-mode-hook'."
(rainbow-delimiters-mode)
(fci-mode)
- (pretty-symbols-mode)
+ (yas-minor-mode)
(auto-fill-mode))
(defun oni:python-mode-func ()
"Function for `python-mode-hook'."
- (flymake-mode)
+ (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)
@@ -436,6 +396,10 @@ length -1. Use the `-' character. WIN is ignored."
(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")
@@ -444,19 +408,6 @@ length -1. Use the `-' character. WIN is ignored."
(switch-to-buffer buffer)
(call-interactively 'ansi-term))))
-(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)))))
-
(defun oni:raise-scratch (&optional mode)
"Show the *scratch* buffer.
If called with a universal argument, ask the user which mode to
@@ -519,16 +470,6 @@ use. If MODE is not nil, open a new buffer with the name
default-directory "' request-pull " (when patchp "-p ")
from " " url " " to))))))
-(defun oni:required-packages-installed-p ()
- "Check if all the packages I need are installed."
- (let ((tmp-packages oni:required-packages)
- (result t))
- (while (and tmp-packages result)
- (if (not (package-installed-p (car tmp-packages)))
- (setq result nil))
- (setq tmp-packages (cdr tmp-packages)))
- result))
-
(defun oni:rst-mode-func ()
"Function for `rst-mode-hook'."
(auto-fill-mode))
@@ -559,6 +500,16 @@ insert at the end of the region and at the beginning."
(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.
@@ -582,13 +533,16 @@ If no direction is given, don't split."
((?h) (split-window-horizontally))
(t window))))
-(defun oni:start-emms ()
- "Check to see if the function `emms' exists, if not call
-`emms-player-mpd-connect' and assume that will have loaded it."
+(defun oni:start-python-test-mail-server ()
+ "Run the python test mailserver."
(interactive)
- (unless (fboundp 'emms)
- (emms-player-mpd-connect))
- (emms))
+ (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'."
@@ -599,20 +553,6 @@ If no direction is given, don't split."
(setq-local comment-auto-fill-only-comments nil)
(auto-fill-mode))
-(defun oni:view-mail (inbox)
- "Show a menu with all mailbox options from `oni:mailbox-map'
-for easy selection."
- (interactive
- (list (progn
- (require 'tmm)
- (let ((tmm-completion-prompt "Choose a mailbox\n"))
- (tmm-prompt oni:mailbox-map)))))
- (if inbox
- (progn
- (require 'mu4e)
- (funcall (intern (concat "oni:" inbox "-mailbox")))
- (mu4e))))
-
(defun oni:write-file-func ()
"Function for `write-file-hooks'."
(time-stamp))
@@ -623,11 +563,25 @@ for easy selection."
(define-key yas-minor-mode-map [(tab)] nil)
(define-key yas-minor-mode-map (kbd "C-\\") 'yas-expand))
-(define-skeleton html-tag
- "Testing creation of an html tag"
- "Tagname:"
- "<" str ("Attribute: " " " str "=\"" (skeleton-read "Value: ") "\"") ">\n"
- "</" str ">\n")
+(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.d/site-lisp/org-init.el b/.emacs.d/site-lisp/org-init.el
index 23ae6a5..4033c30 100644
--- a/.emacs.d/site-lisp/org-init.el
+++ b/.emacs.d/site-lisp/org-init.el
@@ -30,16 +30,73 @@
(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
- '(("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" 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 %(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)
@@ -47,23 +104,19 @@
(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")
+ `(("t" "Task" entry (file "~/documents/org/tasks")
"* TODO %?")
("T" "Linked task" entry (file "~/documents/org/tasks")
- "* TODO %?\n\n %a")))
+ "* 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-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)
-(setq org-default-notes-file (concat org-directory "/org"))
(setq org-export-htmlize-output-type 'css)
(setq org-feed-alist
'(("MyEpisodes"
@@ -103,5 +156,9 @@
(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.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
+ <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...} \ 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