added emacs files
authorJoerg Jaspert <joerg@debian.org>
Sun, 24 Feb 2013 22:28:47 +0000 (23:28 +0100)
committerJoerg Jaspert <joerg@debian.org>
Sun, 24 Feb 2013 22:28:47 +0000 (23:28 +0100)
.emacs.d/Ganneff-theme.el [new file with mode: 0644]
.emacs.d/config/emacs.org [new file with mode: 0644]
.emacs.d/config/gkar.ganneff.de.org [new file with mode: 0644]
.emacs.d/config/gnus.org [new file with mode: 0644]
.emacs.d/init.el [new file with mode: 0644]

diff --git a/.emacs.d/Ganneff-theme.el b/.emacs.d/Ganneff-theme.el
new file mode 100644 (file)
index 0000000..5bade0f
--- /dev/null
@@ -0,0 +1,139 @@
+(deftheme Ganneff
+  "Created 2012-04-24.")
+
+(custom-theme-set-variables
+ 'Ganneff
+ '(abbrev-mode nil)
+ '(add-log-keep-changes-together t)
+ '(add-log-mailing-address "joerg@debian.org")
+ '(backup-by-copying t)
+ '(backup-directory-alist (quote (("," . "~/tmp/"))))
+ '(bbdb-complete-name-allow-cycling t)
+ '(bbdb-hashtable-size 104729)
+ '(browse-url-browser-function (quote browse-url-generic))
+ '(browse-url-generic-program "/usr/bin/x-www-browser")
+ '(calendar-week-start-day 1)
+ '(case-fold-search t)
+ '(change-log-default-name nil)
+ '(change-log-version-info-enabled nil)
+ '(cperl-electric-keywords t)
+ '(cperl-electric-lbrace-space t)
+ '(cperl-electric-parens nil)
+ '(cperl-hairy t)
+ '(cperl-highlight-variables-indiscriminately t)
+ '(cperl-imenu-addback t)
+ '(cperl-invalid-face (quote underline))
+ '(cperl-lazy-help-time 5)
+ '(cperl-mode-hook (quote (turn-on-tinyperl-mode)))
+ '(cperl-scan-files-regexp "\\.\\([pP][Llm]\\|xs\\|cgi\\)$")
+ '(cperl-syntaxify-by-font-lock t)
+ '(cperl-use-syntax-table-text-property-for-tags t)
+ '(current-language-environment "UTF-8")
+ '(cursor-in-non-selected-windows nil)
+ '(custom-browse-only-groups t)
+ '(custom-browse-order-groups (quote first))
+ '(custom-browse-sort-alphabetically t)
+ '(custom-buffer-order-groups (quote first))
+ '(custom-buffer-sort-alphabetically t)
+ '(custom-buffer-style (quote links))
+ '(custom-magic-show-button t)
+ '(custom-menu-sort-alphabetically t)
+ '(custom-raised-buttons t)
+ '(custom-reset-button-menu t)
+ '(cvs-add-default-message "New File added.")
+ '(cvs-allow-dir-commit t)
+ '(cvs-dired-use-hook (quote always))
+ '(default-input-method "latin-1-prefix")
+ '(dired-auto-revert-buffer (quote dired-directory-changed-p))
+ '(dired-dwim-target t)
+ '(dired-listing-switches "-alh")
+ '(dired-recursive-copies (quote top))
+ '(dired-recursive-deletes (quote top))
+ '(display-time-24hr-format t)
+ '(eol-mnemonic-dos "(DOS)")
+ '(eol-mnemonic-mac "(Mac)")
+ '(gc-cons-threshold 24000000)
+ '(gnus-picon-databases (quote ("/usr/lib/picon" "/usr/local/faces" "/usr/share/picons")))
+ '(gnus-summary-muttprint-program "muttprint -x -l de -e local -2 -z 10 -c auto")
+ '(inhibit-startup-echo-area-message "joerg")
+ '(mail-user-agent (quote gnus-user-agent))
+ '(make-backup-files t)
+ '(max-lisp-eval-depth 1000)
+ '(max-specpdl-size 3000)
+ '(message-kill-buffer-on-exit t)
+ '(mm-inline-media-tests (quote (("image/pjepg" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote jpeg) handle))) ("image/jpeg" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote jpeg) handle))) ("image/png" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote png) handle))) ("image/gif" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote gif) handle))) ("image/tiff" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote tiff) handle))) ("image/xbm" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xbm) handle))) ("image/x-xbitmap" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xbm) handle))) ("image/xpm" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xpm) handle))) ("image/x-pixmap" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote xpm) handle))) ("image/bmp" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote bmp) handle))) ("image/x-portable-bitmap" mm-inline-image (lambda (handle) (mm-valid-and-fit-image-p (quote pbm) handle))) ("text/plain" mm-inline-text identity) ("text/enriched" mm-inline-text identity) ("text/richtext" mm-inline-text identity) ("text/x-patch" mm-display-patch-inline (lambda (handle) (locate-library "diff-mode"))) ("application/emacs-lisp" mm-display-elisp-inline identity) ("application/x-emacs-lisp" mm-display-elisp-inline identity) ("text/html" mm-inline-text (lambda (handle) (gnus-functionp mm-inline-text-html-renderer))) ("text/x-vcard" mm-inline-text (lambda (handle) (or (featurep (quote vcard)) (locate-library "vcard")))) ("message/delivery-status" mm-inline-text identity) ("message/rfc822" mm-inline-message identity) ("message/partial" mm-inline-partial identity) ("message/external-body" mm-inline-external-body identity) ("text/.*" mm-inline-text identity) ("audio/wav" mm-inline-audio (lambda (handle) (and (or (featurep (quote nas-sound)) (featurep (quote native-sound))) (device-sound-enabled-p)))) ("audio/au" mm-inline-audio (lambda (handle) (and (or (featurep (quote nas-sound)) (featurep (quote native-sound))) (device-sound-enabled-p)))) ("application/pgp-signature" ignore identity) ("application/x-pkcs7-signature" ignore identity) ("application/pkcs7-signature" ignore identity) ("application/x-pkcs7-mime" mm-inline-text identity) ("application/pkcs7-mime" mm-inline-text identity) ("multipart/alternative" ignore identity) ("multipart/mixed" ignore identity) ("multipart/related" ignore identity) ("audio/.*" ignore ignore) ("application/pgp" mm-inline-text identity) ("image/.*" ignore ignore) (".*" mm-inline-text mm-readable-p))))
+ '(mouse-wheel-follow-mouse t)
+ '(mouse-yank-at-point t)
+ '(nnir-search-engine (quote imap))
+ '(nnmail-cache-accepted-message-ids t)
+ '(nnmail-message-id-cache-length 10000)
+ '(nnmail-split-abbrev-alist (quote ((any . "x-beenthere\\|from\\|to\\|cc\\|sender\\|apparently-to\\|resent-from\\|resent-to\\|resent-cc\\|x-loop\\|delivered-to") (mail . "mailer-daemon\\|postmaster\\|uucp") (to . "to\\|cc\\|apparently-to\\|resent-to\\|resent-cc") (from . "from\\|sender\\|resent-from") (nato . "to\\|cc\\|resent-to\\|resent-cc") (naany . "from\\|to\\|cc\\|sender\\|resent-from\\|resent-to\\|resent-cc") (xloop . "x-loop") (deliveredto . "delivered-to"))))
+ '(nnmail-treat-duplicates (quote delete))
+ '(notmuch-fcc-dirs nil)
+ '(org-agenda-log-mode-items (quote (closed clock state)))
+ '(org-agenda-ndays 7)
+ '(org-agenda-show-all-dates t)
+ '(org-agenda-start-on-weekday nil)
+ '(org-deadline-warning-days 14)
+ '(org-default-notes-file "~/notes.org")
+ '(org-enforce-todo-checkbox-dependencies t)
+ '(org-enforce-todo-dependencies t)
+ '(org-fast-tag-selection-single-key (quote expert))
+ '(org-hide-block-startup t)
+ '(org-insert-mode-line-in-empty-file t)
+ '(org-log-done (quote note))
+ '(org-log-into-drawer t)
+ '(org-log-reschedule (quote time))
+ '(org-log-states-order-reversed t)
+ '(org-mobile-agendas (quote all))
+ '(org-mobile-directory "/scpx:joerg@garibaldi.ganneff.de:/srv/www2.ganneff.de/htdocs/org/")
+ '(org-mobile-inbox-for-pull "~/org/tasks.org")
+ '(org-modules (quote (org-bbdb org-bibtex org-crypt org-docview org-gnus org-id org-info org-jsinfo org-habit org-inlinetask org-irc org-protocol org-w3m org-mouse org-checklist org-notmuch)))
+ '(org-return-follows-link t)
+ '(org-reverse-note-order t)
+ '(org-todo-keywords (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)") (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
+ '(planner-id-add-task-id-flag t)
+ '(printer-name "")
+ '(ps-build-face-reference t)
+ '(ps-line-number nil)
+ '(ps-paper-type (quote a4))
+ '(ps-print-footer nil)
+ '(ps-printer-name t)
+ '(ps-spool-duplex t)
+ '(ps-use-face-background nil)
+ '(randomsig-files (quote randomsig-search-sigfiles))
+ '(randomsig-static-string "bye, Joerg
+")
+ '(recentf-arrange-rules (quote (("Perl Files (%d)" ".\\([pP][Llm]\\|xs\\|cgi\\)$") ("Elisp files (%d)" ".\\.el$") ("Java files (%d)" ".\\.java$") ("C/C++ files (%d)" "c\\(pp\\)?$"))))
+ '(recentf-exclude (quote ("\\.newsrc.*" "\\.bbdb")))
+ '(recentf-max-menu-items 15)
+ '(recentf-max-saved-items 30)
+ '(recentf-menu-filter (quote recentf-arrange-by-mode))
+ '(save-place nil)
+ '(scroll-bar-mode nil)
+ '(show-trailing-whitespace nil)
+ '(sieve-manage-default-port 4190)
+ '(smiley-data-directory "~/emacs/etc/smilies/")
+ '(tab-width 4)
+ '(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
+ '(tramp-auto-save-directory "~/emacs/autosave")
+ '(tramp-default-method "sshx")
+ '(tramp-verbose 5)
+ '(uniquify-after-kill-buffer-p t)
+ '(url-history-track t)
+ '(url-mime-language-string "de,en")
+ '(url-personal-mail-address "nowhere@does.not.exist")
+ '(url-privacy-level (quote (email os lastloc)))
+ '(url-proxy-services (quote (("http" . "lorien:3128") ("ftp" . "lorien:3128"))))
+ '(user-mail-address "joerg@debian.org")
+ '(widget-choice-toggle t)
+ '(x-select-enable-primary t)
+ '(uniquify-buffer-name-style (quote post-forward))
+ '(transient-mark-mode t)
+ '(show-paren-mode t)
+ '(recentf-mode t)
+ '(global-auto-revert-mode t)
+ '(display-time-mode t)
+ '(blink-cursor-mode nil))
+
+(provide-theme 'Ganneff)
diff --git a/.emacs.d/config/emacs.org b/.emacs.d/config/emacs.org
new file mode 100644 (file)
index 0000000..e876385
--- /dev/null
@@ -0,0 +1,1745 @@
+#+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
+#+TITLE:     emacs.org - Ganneffs emacs configuration
+#+DATE:      %Y-%m-%d
+#+SETUPFILE: ~/elisp/org-templates/level-0.org
+#+LATEX_CMD: xelatex
+
+* Notes for people looking at this using a webbrowser
+My whole emacs config is done using [[http://orgmode.org/][org-mode]] files, with a little magic
+in ~/.emacs.d/init.el to have it readable for emacs.
+
+I publish them using the [[http://orgmode.org/manual/HTML-export.html#HTML-export][HTML export feature]] of org-mode, combined with
+a javascript [[http://orgmode.org/worg/code/org-info-js/][called org-info.js]] which lets you navigate my config
+similar to what org-mode allows you in Emacs.
+
+Basic navigation is =n= for next, =p= for previous, =l= will give you
+a direct link to the point you are at and the key =?= will show you a
+help with all keyboard shortcuts. You might also want to try pressing
+=m= followed by a series of =F=.
+
+If you have Javascript disabled you only miss the nice navigation, you
+will see the whole file at once.
+
+
+* Copyright notice(s)
+My config is made up of stuff I wrote myself - and lots of stuff I
+copied from all around the net. I try to list all of the original
+authors here, but this config is a living thing for more than a decade
+now, so there are things where I just don't know anymore where it might
+be from.
+
+If you find something that you are the author off and I forgot to
+mention you don't hesitate to tell me and I will fix that oversight.
+
+** My own stuff
+----------
+#+BEGIN_QUOTE
+Copyright © 200x-2012 Joerg Jaspert <joerg@ganneff.de>
+
+My code in this document is free software: you can redistribute it
+and/or modify it under the terms of the [[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html][GNU General Public License]]
+as published by the Free Software Foundation, version 2.0.
+
+My writing here is subject to the  [[http://creativecommons.org/licenses/by-nc-sa/3.0/][CC —
+Attribution-NonCommercial-ShareAlike 3.0 Unported — CC BY-NC-SA 3.0]]
+license.
+#+END_QUOTE
+----------
+
+** Sacha Chua
+I copied various functions and snippets from [[http://sachachua.com/blog/category/emacs/][Sacha Chuas blog]] (worth a
+read). Her copyright/license notice:
+
+----------
+#+BEGIN_QUOTE
+Copyright © 2001-2012 Sacha Chua (sacha@sachachua.com).
+
+Please feel free to reuse content under a [[http://creativecommons.org/licenses/by-nc-sa/3.0/][Creative Commons —
+Attribution-NonCommercial-ShareAlike Unported — CC BY-NC-SA]] license
+unless otherwise noted. 
+#+END_QUOTE
+----------
+
+Functions copied from her start with /sacha//.
+
+** Bernt Hansen
+Much of my org-mode setup is copied from [[http://doc.norang.ca/org-mode.html][Bernt Hansens org-mode
+page]]. His license statement:
+
+----------
+#+BEGIN_QUOTE
+Copyright (C)  2012  Bernt Hansen.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3
+or any later version published by the Free Software Foundation;
+with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
+  
+Code in this document 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 code 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.
+#+END_QUOTE
+----------
+
+Functions copied from him start with /bh//.
+
+** Roland Mas
+I copied a few functions for my [[file:gnus.org][gnus]] setup from [[http://roland.entierement.nu/blog/2010/09/08/gnus-dovecot-offlineimap-search-a-howto.html][his blog]] that enable me to
+use notmuch and gnus together. His license statement:
+
+----------
+[[http://creativecommons.org/licenses/by-nc-sa/2.0/fr/][Creative Commons — Attribution - Pas d'Utilisation
+Commerciale - Partage dans les Mêmes Conditions 2.0 France — CC BY-NC-SA
+2.0]] Sauf indication contraire, le contenu de ce site est mis à
+disposition sous un contrat Creative Commons.
+----------
+
+In case you are as good in french as I am, that should be equal to:
+----------
+Please feel free to reuse content under a [[http://creativecommons.org/licenses/by-nc-sa/2.0/][Creative Commons —
+Attribution-NonCommercial-ShareAlike Unported — CC BY-NC-SA]] license
+unless otherwise noted.
+----------
+
+
+* Initial preparation
+To have my config here actually work, =emacs= needs a little help. For
+some reason it can't just read an =org-mode= based config on its own, tsk.
+
+Which means that the emacs initfile needs to have the magic. My init
+file is =~/.emacs.d/init.el=. I try to keep it as small as possible, yet
+it does have some entries.
+
+As I commented inside that file, I won't repeat stuff here, just read it
+below.
+
+#+INCLUDE "~/.emacs.d/init.el" src emacs-lisp
+
+
+* Basic config
+** General functions
+:PROPERTIES:
+:ID: b6e6cf73-9802-4a7b-bd65-fdb6f9745319
+:END:
+The following functions are used throughout my config, and so I load
+them first.
+
+- safe-load does not break emacs initialization, should a file be
+  unreadable while emacs boots up.
+  #+BEGIN_SRC emacs-lisp
+    (defvar safe-load-error-list ""
+            "*List of files that reported errors when loaded via safe-load")
+    
+    (defun safe-load (file &optional noerror nomessage nosuffix)
+      "Load a file.  If error on load, report back, wait for
+       a key stroke then continue on"
+      (interactive "f")
+      (condition-case nil (load file noerror nomessage nosuffix)
+        (error
+          (progn
+           (setq safe-load-error-list  (concat safe-load-error-list  " " file))
+           (message "****** [Return to continue] Error loading %s" safe-load-error-list )
+            (sleep-for 1)
+           nil))))
+    
+    (defun safe-load-check ()
+     "Check for any previous safe-load loading errors.  (safe-load.el)"
+      (interactive)
+      (if (string-equal safe-load-error-list "") ()
+                   (message (concat "****** error loading: " safe-load-error-list))))
+#+END_SRC
+
+- match-paren will either jump to the "other" paren or simply insert %
+  #+BEGIN_SRC emacs-lisp
+  ;;* Jump to other paren *or* insert %
+(defun match-paren (arg)
+  "Go to the matching parenthesis if on parenthesis otherwise insert %."
+  (interactive "p")
+  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
+        ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
+        (t (self-insert-command (or arg 1)))))
+  #+END_SRC
+
+- Always ensure to have a scratch buffer around.
+  #+BEGIN_SRC emacs-lisp
+  (save-excursion
+    (set-buffer (get-buffer-create "*scratch*"))
+    (lisp-interaction-mode)
+    (make-local-variable 'kill-buffer-query-functions)
+    (add-hook 'kill-buffer-query-functions 'kill-scratch-buffer))
+  #+END_SRC
+
+** Path settings
+*** Load path
+I don't list the path to org-mode here, as that is done in init.el
+already (or we couldn't load this file).
+
+I have various elisp packages I install locally (that is, in my
+~/elisp). Some of them aren't packaged, some of them aren't installed
+everywhere I use emacs, so this is easiest.
+
+They might not exist on every system, but it doesn't hurt to have them
+listed, so I just do it here globally.
+#+BEGIN_SRC emacs-lisp
+(add-to-list 'load-path "~/elisp/local")
+(add-to-list 'load-path "~/elisp/gnus")
+(add-to-list 'load-path "~/elisp/icicle")
+(add-to-list 'load-path "~/elisp/org/contrib")
+(add-to-list 'load-path "~/elisp/tiny")
+(add-to-list 'load-path "~/elisp/mo-git-blame")
+#+END_SRC
+*** Info path
+Help emacs to find the info files
+#+BEGIN_SRC emacs-lisp
+(setq Info-directory-list '("~/emacs/info"
+                            "/usr/local/share/info/"
+                            "/usr/local/info/"
+                            "/usr/local/gnu/info/"
+                            "/usr/local/gnu/lib/info/"
+                            "/usr/local/gnu/lib/emacs/info/"
+                            "/usr/local/emacs/info/"
+                            "/usr/local/lib/info/"
+                            "/usr/local/lib/emacs/info/"
+                            "/usr/share/info/emacs-23"
+                            "/usr/share/info/"
+                            "/usr/share/info/"))
+(setq Info-default-directory-list
+      (cons "~/emacs/info" Info-default-directory-list))
+#+END_SRC
+** Interface related
+*** General stuff
+:PROPERTIES:
+:ID: 0a1560d9-7e55-47ab-be52-b3a8b8eea4aa
+:END:
+I dislike the startup message
+#+BEGIN_SRC emacs-lisp
+(setq inhibit-startup-message t)
+#+END_SRC
+
+Usually I want the lines to break at 72 characters.
+#+BEGIN_SRC emacs-lisp
+(setq default-fill-column 72)
+#+END_SRC
+
+And it is nice to have a final newline in files
+#+BEGIN_SRC emacs-lisp
+(setq require-final-newline t)
+#+END_SRC
+
+After I typed 300 characters or took a break for more than a minute it
+would be nice of emacs to save whatever I am on in one of his auto-save
+backups. See [[info:emacs#Auto%20Save%20Control][info:emacs#Auto Save Control]] for more details.
+#+BEGIN_SRC emacs-lisp
+(setq auto-save-interval 300)
+(setq auto-save-timeout   60)
+#+END_SRC
+
+I really dislike `kill-line` (key: C-k) to kill from the point to the end of line.
+#+BEGIN_SRC emacs-lisp
+(setq kill-whole-line t)
+#+END_SRC
+
+Set my full name and my default mail address - for whatever wants to use
+it later. Also, I am using gnus.
+#+BEGIN_SRC emacs-lisp
+(setq user-full-name "Joerg Jaspert")
+(setq user-mail-address "joerg@ganneff.de")
+(setq mail-user-agent (quote gnus-user-agent))
+#+END_SRC
+
+My default mail server. Well, simply localhost, I have a forwarder that
+puts mail off the right way, no need for emacs to have any further
+knowledge here.
+#+BEGIN_SRC emacs-lisp
+(setq smtpmail-default-smtp-server "lorien")
+(setq smtpmail-smtp-server "lorien")
+#+END_SRC
+
+Enable automatic handling of compressed files.
+#+BEGIN_SRC emacs-lisp
+(auto-compression-mode 1)
+#+END_SRC
+
+I sometimes narrow my editing stuff to a region. Good for complicated
+replaces for example. But emacs by default disables it and asks
+questions. Blergh, nope, enable it.
+#+BEGIN_SRC emacs-lisp
+(put 'narrow-to-region 'disabled nil)
+#+END_SRC
+
+The default how emacs handles cutting/pasting with the primary selection
+changed in emacs24. I am used to the old way, so get it.
+#+BEGIN_SRC emacs-lisp
+(setq x-select-enable-primary t)
+#+END_SRC
+*** Font
+#+BEGIN_SRC emacs-lisp
+(set-default-font "Inconsolata-14")
+#+END_SRC
+
+*** Menu, Tool and Scrollbar
+I don't want to see the menu-bar, …
+#+BEGIN_SRC emacs-lisp
+  (when window-system
+      (menu-bar-mode -1))
+#+END_SRC
+
+… and I dislike the tool-bar, …
+#+BEGIN_SRC emacs-lisp
+  (when window-system
+      (tool-bar-mode -1))
+#+END_SRC
+
+… and don't you start with a scrollbar.
+#+BEGIN_SRC emacs-lisp
+  (scroll-bar-mode nil)
+#+END_SRC
+
+**** When using emacs in daemon mode
+Emacs has a very nice mode where it detaches itself and runs as daemon -
+and you can just open /frames/ (windows) from it by using [[http://www.emacswiki.org/emacs/EmacsClient][Emacs
+Client]]. It's fast, it's nice, it's convinient.
+
+Except that Emacs behaves stupid when you do that and ignores your
+menu/tool/scrollbar settings. Sucks.
+
+For them to work even then, we have to do two things.
+1. We have to set the frame alist. We simple set both,
+   =initial-frame-alist= and =default-frame-alist= to the same value here.
+   #+BEGIN_SRC emacs-lisp
+  (setq initial-frame-alist '(
+                              (horizontal-scroll-bars . nil)
+                              (vertical-scroll-bars . nil)
+                              (menu-bar-lines . 0)
+                              ))
+  (setq default-frame-alist (copy-alist initial-frame-alist))
+#+END_SRC
+2. We have to disable the toolbar using the customize interface, so you
+   can find that in the [[id:0102208d-fdf6-4928-9e40-7e341bd3aa3a][Customized variables]] section.
+
+*** Load our theme
+Actually not ours, it is from Julien Danjou, see [[http://git.naquadah.org/?p%3Dnaquadah-theme.git%3Ba%3Dsummary][git.naquadah.org Git -
+naquadah-theme.git]]
+#+BEGIN_SRC emacs-lisp
+(load-file "~/elisp/local/naquadah-theme.el")
+#+END_SRC
+
+*** Allow recursive minibuffers
+This allows (additional) minibuffer commands while in the minibuffer.
+#+BEGIN_SRC emacs-lisp
+(setq enable-recursive-minibuffers 't)
+#+END_SRC
+
+*** Modeline related changes
+
+I want to see line and column numbers, so turn them on.
+Size indication lets me know how far I am in a buffer.
+
+And modeline-posn is great. It will hilight the column number in the
+modeline in red as soon as you are over the defined limit.
+
+#+BEGIN_SRC emacs-lisp
+(line-number-mode 1)
+(column-number-mode 1)
+(size-indication-mode 1)
+(setq modelinepos-column-limit 72)
+(require 'modeline-posn)
+#+END_SRC
+
+*** Default mode
+Back when I started with text-mode. But nowadays I want default mode to
+be org-mode - it is just so much better to use. And does sensible things
+with many README files out there, and various other "crap" you get to
+read in emacs.
+#+BEGIN_SRC emacs-lisp
+(setq default-major-mode 'org-mode)
+(setq initial-major-mode 'org-mode)
+#+END_SRC
+
+*** Emacs shell
+Basic settings for emacs integrated shell, using zsh
+#+BEGIN_SRC emacs-lisp
+(setq shell-file-name "zsh")
+(setq shell-command-switch "-c")
+(setq explicit-shell-file-name shell-file-name)
+(setenv "SHELL" shell-file-name)
+(setq explicit-sh-args '("-login" "-i"))
+(setq eshell-cmpl-cycle-completions nil
+      eshell-save-history-on-exit t
+      eshell-cmpl-dir-ignore "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\)/\\'")
+(eval-after-load 'esh-opt
+  '(progn
+     (require 'em-cmpl)
+     (require 'em-prompt)
+     (require 'em-term)
+     ;; TODO: for some reason requiring this here breaks it, but
+     ;; requiring it after an eshell session is started works fine.
+     ;; (require 'eshell-vc)
+     (setenv "PAGER" "cat")
+     ; (set-face-attribute 'eshell-prompt nil :foreground "turquoise1")
+     (add-hook 'eshell-mode-hook ;; for some reason this needs to be a hook
+               '(lambda () (define-key eshell-mode-map "\C-a" 'eshell-bol)))
+     (add-to-list 'eshell-visual-commands "ssh")
+     (add-to-list 'eshell-visual-commands "tail")
+     (add-to-list 'eshell-command-completions-alist
+                  '("gunzip" "gz\\'"))
+     (add-to-list 'eshell-command-completions-alist
+                  '("tar" "\\(\\.tar|\\.tgz\\|\\.tar\\.gz\\)\\'"))
+     (add-to-list 'eshell-output-filter-functions 'eshell-handle-ansi-color)))
+  
+
+#+END_SRC
+*** Global keyboard changes not directly related to a mode
+Disable /suspend_frame/ function, I dislike it.
+#+BEGIN_SRC emacs-lisp
+(global-unset-key [(control z)])
+(global-unset-key [(control x) (control z)])
+#+END_SRC
+
+Default of *C-k* is to kill from the point to the end of line. If
+'kill-whole-line' (see [[id:0a1560d9-7e55-47ab-be52-b3a8b8eea4aa][the kill-whole-line part in "General stuff"]]) is
+set, including newline. But to kill the entire line, one still needs a
+*C-a* in front of it. So I change it, by defining a function to do just this for
+me. Lazyness++.
+#+BEGIN_SRC emacs-lisp
+(defun kill-entire-line ()
+  "Kill this entire line (including newline), regardless of where point is within the line."
+  (interactive)
+  (beginning-of-line)
+  (kill-line))
+
+(global-unset-key [(control k)])
+(global-set-key [(control k)] 'kill-entire-line)
+#+END_SRC
+
+I really hate tabs, so I don't want any indentation to try using them.
+And in case a project really needs them, I can change it just for that
+file/project, but luckily none of those I work in is as broken.
+#+BEGIN_SRC emacs-lisp
+(setq-default indent-tabs-mode nil)
+#+END_SRC
+
+Make the % key jump to the matching {}[]() if on another, like vi, see [[id:b6e6cf73-9802-4a7b-bd65-fdb6f9745319][the function]]
+#+BEGIN_SRC emacs-lisp
+(global-set-key "\M-5" 'match-paren)
+#+END_SRC
+
+Instead of the default "mark-defun" I want a more readline-like setting.
+#+begin_src emacs-lisp 
+(global-set-key (kbd "C-M-h") 'backward-kill-word)
+#+end_src
+
+Align whatever with a regexp.
+#+begin_src emacs-lisp 
+(global-set-key (kbd "C-x \\") 'align-regexp)
+#+end_src
+
+Font size changes
+#+begin_src emacs-lisp 
+(global-set-key (kbd "C-+") 'text-scale-increase)
+(global-set-key (kbd "C--") 'text-scale-decrease)
+#+end_src
+
+Regexes are too useful, so use the regex search by default.
+#+begin_src emacs-lisp 
+(global-set-key (kbd "C-s") 'isearch-forward-regexp)
+(global-set-key (kbd "\C-r") 'isearch-backward-regexp)
+(global-set-key (kbd "C-M-s") 'isearch-forward)
+(global-set-key (kbd "C-M-r") 'isearch-backward)
+#+end_src
+
+Rgrep is infinitely useful in multi-file projects.
+#+begin_src emacs-lisp
+  (define-key global-map "\C-x\C-r" 'rgrep)
+#+end_src
+
+**** Overwrite mode
+Usually you can press the *Ins*ert key, to get into overwrite mode. I
+don't like that, have broken much with it and so just forbid it by
+disabling that.
+
+#+BEGIN_SRC emacs-lisp
+(global-unset-key [insert])
+(global-unset-key [kp-insert])
+#+END_SRC
+
+*** Isearch related
+Incremental search is great, but annoyingly you need to type whatever
+you want. If you want to search for just the next (or previous)
+occurence of what is at your cursor position use the following.
+*C-x* will insert the current word while *M-up* and *M-down* will just
+jump to the next/previous occurence of it.
+#+BEGIN_SRC emacs-lisp
+(define-key isearch-mode-map (kbd "C-x") 'sacha/isearch-yank-current-word)
+(global-set-key '[M-up] 'sacha/search-word-backward)
+(global-set-key '[M-down] 'sacha/search-word-forward)
+#+END_SRC
+
+*** Frame configuration
+I want to see the buffername and its size, not the host I am on in my
+frame title.
+
+#+BEGIN_SRC emacs-lisp
+(setq frame-title-format "%b (%i)")
+#+END_SRC
+
+*** Protect some buffers
+I don't want some buffers to be killed, **scratch** for example.
+In the past I had a long function that just recreated them, but the
+=protbuf= package is easier.
+
+#+BEGIN_SRC emacs-lisp
+(require 'protbuf)
+(protect-buffer-from-kill-mode nil (get-buffer "*scratch*"))
+#+END_SRC
+
+*** yes-or-no-p
+Emas usually wants you to type /yes/ or /no/ fully. What a mess, I am
+lazy.
+#+BEGIN_SRC emacs-lisp
+(defalias 'yes-or-no-p 'y-or-n-p)
+#+END_SRC
+anguage/i18n stuff
+In this day and age, UTF-8 is the way to go.
+#+BEGIN_SRC emacs-lisp
+(set-language-environment 'utf-8)
+(set-default-coding-systems 'utf-8)
+(set-terminal-coding-system 'utf-8)
+(set-keyboard-coding-system 'utf-8)
+(set-clipboard-coding-system 'utf-8)
+(prefer-coding-system 'utf-8)
+#+END_SRC
+
+** Miscellaneous stuff
+#+BEGIN_SRC emacs-lisp
+(setq backup-by-copying t)
+(setq backup-directory-alist (quote (("." . "~/tmp/"))))
+(setq make-backup-files t)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+(setq calendar-week-start-day 1)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+(setq-default case-fold-search t)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+(setq clean-buffer-list-kill-buffer-names (quote ("*Help*" "*Apropos*"
+                                                  "*Man " "*Buffer List*"
+                                                  "*Compile-Log*"
+                                                  "*info*" "*vc*"
+                                                  "*vc-diff*" "*diff*"
+                                                  "*Customize"
+                                                  "*tramp/" "*debug "
+                                                  "*magit" "*Calendar")))
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+(setq-default cursor-in-non-selected-windows nil)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+(setq eol-mnemonic-dos "(DOS)")
+(setq eol-mnemonic-mac "(Mac)")
+#+END_SRC
+
+Much larger threshold for garbage collection prevents it to run too often.
+#+BEGIN_SRC emacs-lisp
+(setq gc-cons-threshold 48000000)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+(setq max-lisp-eval-depth 1000)
+(setq max-specpdl-size 3000)
+#+END_SRC
+
+*** Browser
+#+BEGIN_SRC emacs-lisp
+(setq browse-url-browser-function (quote browse-url-generic))
+(setq browse-url-generic-program "/usr/bin/x-www-browser")
+#+END_SRC
+
+*** When saving a script - make it executable
+#+BEGIN_SRC emacs-lisp
+(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
+#+END_SRC
+
+*** Registers
+One can use registers for a whole shitload of things, from storing
+strings, numbers, rectangles, pathes, configurations and markers. So one
+can use them for easy access for stuff, like a file you want to open
+lotsa times, things you type often, whatever.
+
+See [[http://www.emacswiki.org/emacs/Registers][EmacsWiki: Registers]] and/or [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Registers.html][Registers - GNU Emacs Manual]]
+
+#+BEGIN_SRC emacs-lisp
+;;**** C-x r j e opens .emacs
+(set-register ?e '(file . "~/dotfiles/.emacs"))
+#+END_SRC
+
+*** Emacs Server
+#+BEGIN_SRC emacs-lisp
+(server-start)
+#+END_SRC
+
+
+* Modes and their configuration
+** "Preface"
+I use quite a few modes and local added files, which would make emacs
+bootup slow. Especially on some of the slow machines I am forced to work
+on. Easy fix is to only load stuff when it is really needed.
+
+For that to work you need autoload definitions, so emacs knows what to
+load from where, when needed.
+
+#+BEGIN_SRC emacs-lisp
+(load-file "~/elisp/tiny/loaddefs.el")
+(load-file "~/elisp/local/loaddefs.el")
+#+END_SRC
+
+** mode alists
+For some file endings we need to tell emacs what mode we want for them.
+I only list modes here where I don't have any other special
+configuration.
+
+- Some extras for ruby, used with ruby on rails for example
+#+BEGIN_SRC emacs-lisp
+(add-to-list 'auto-mode-alist '("\\.rxml$" . ruby-mode))
+(add-to-list 'auto-mode-alist '("\\.rjs$" . ruby-mode))
+(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode))
+(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
+(add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode))
+#+END_SRC
+
+- Markdown syntax
+#+BEGIN_SRC emacs-lisp
+(add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
+#+END_SRC
+
+- diff
+#+BEGIN_SRC emacs-lisp
+(add-to-list 'auto-mode-alist '("COMMIT_EDITMSG$" . diff-mode))
+#+END_SRC
+
+- perl
+#+BEGIN_SRC emacs-lisp
+(add-to-list 'auto-mode-alist '("\\.p[lm]$" . cperl-mode))
+(add-to-list 'auto-mode-alist '("\\.pod$" . pod-mode))
+(add-to-list 'auto-mode-alist '("\\.tt$" . tt-mode))
+#+END_SRC
+
+- python
+#+BEGIN_SRC emacs-lisp
+(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
+(add-to-list 'auto-mode-alist '("\\.py$" . python-mode))
+(add-to-list 'interpreter-mode-alist '("python" . python-mode))
+#+END_SRC
+
+** Tramp
+Transparent Remote (file) Access, Multiple Protocol, remote file editing.
+#+BEGIN_SRC emacs-lisp
+(require 'tramp)
+(setq tramp-default-method "sshx")
+(add-to-list 'tramp-default-method-alist
+                        '("\\`localhost\\'" "\\`root\\'" "su")
+                        )
+#+END_SRC
+
+** tiny-tools
+We configure only a bit of the tiny-tools to load when I should need
+them. I don't need much actually, but these things are nice to have.
+
+#+BEGIN_SRC emacs-lisp
+(autoload 'turn-on-tinyperl-mode "tinyperl" "" t)
+(add-hook 'perl-mode-hook  'turn-on-tinyperl-mode)
+(add-hook 'cperl-mode-hook 'turn-on-tinyperl-mode)
+
+(autoload 'tinycomment-indent-for-comment      "tinycomment" "" t)
+(autoload 'tinyeat-forward-preserve            "tinyeat" "" t)
+(autoload 'tinyeat-backward-preserve           "tinyeat" "" t)
+(autoload 'tinyeat-delete-paragraph            "tinyeat" "" t)
+(autoload 'tinyeat-kill-line                   "tinyeat" "" t)
+(autoload 'tinyeat-zap-line                    "tinyeat" "" t)
+(autoload 'tinyeat-kill-line-backward          "tinyeat" "" t)
+(autoload 'tinyeat-kill-buffer-lines-point-max "tinyeat" "" t)
+(autoload 'tinyeat-kill-buffer-lines-point-min "tinyeat" "" t)
+#+END_SRC
+*** Keyboard changes for tiny-tools
+#+BEGIN_SRC emacs-lisp
+(global-set-key  "\M-;" 'tinycomment-indent-for-comment)
+
+(global-set-key (kbd "ESC C-k")       'tinyeat-kill-line-backward)
+(global-set-key (kbd "ESC d")         'tinyeat-forward-preserve)
+(global-set-key (kbd "ESC z")         'tinyeat-kill-buffer-lines-main)
+(global-set-key (kbd "<M-backspace>") 'tinyeat-backward-preserve)
+(global-set-key (kbd "<C-delete>")    'tinyeat-forward-preserve)
+(global-set-key (kbd "<S-backspace>") 'tinyeat-delete-whole-word)
+#+END_SRC
+
+** dired & co
+I like dired and work a lot with it, but it tends to leave lots of
+windows around.
+dired-single to the rescue.
+#+BEGIN_SRC emacs-lisp
+(autoload 'dired-single-buffer "dired-single" "" t)
+(autoload 'dired-single-buffer-mouse "dired-single" "" t)
+(autoload 'dired-single-magic-buffer "dired-single" "" t)
+(autoload 'dired-single-toggle-buffer-name "dired-single" "" t)
+#+END_SRC
+
+We want some extra key bindings loaded. In case we haven't loaded dired
+yet, there won't be a keymap to add to, so add our setup function to the
+load hook only. Otherwise just bind the keys.
+#+BEGIN_SRC emacs-lisp
+(if (boundp 'dired-mode-map)
+    ;; we're good to go; just add our bindings
+    (my-dired-init)
+  ;; it's not loaded yet, so add our bindings to the load-hook
+  (add-hook 'dired-load-hook 'my-dired-init))
+#+END_SRC
+
+A few settings
+#+BEGIN_SRC emacs-lisp
+(setq dired-auto-revert-buffer (quote dired-directory-changed-p))
+(setq dired-dwim-target t)
+(setq dired-listing-switches "-alh")
+(setq dired-recursive-copies (quote top))
+(setq dired-recursive-deletes (quote top))
+#+END_SRC
+
+wdired
+#+BEGIN_SRC emacs-lisp
+(setq wdired-allow-to-change-permissions t)
+#+END_SRC
+** icicles
+[[http://article.gmane.org/gmane.emacs.orgmode/4574/match%3Dicicles][“In case you never heard of it, Icicles is to ‘TAB’ completion what
+‘TAB’ completion is to typing things manually every time.”]]
+
+#+BEGIN_SRC emacs-lisp
+(require 'icicles)
+(icy-mode 1)
+#+END_SRC
+
+** uniquify
+Always have unique buffernames. See [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Uniquify.html][Uniquify - GNU Emacs Manual]]
+#+BEGIN_SRC emacs-lisp
+(require 'uniquify)
+(setq uniquify-buffer-name-style 'post-forward)
+(setq uniquify-after-kill-buffer-p t)
+#+END_SRC
+
+** abbrev
+A defined abbrev is a word which expands, if you insert it, into some
+different text. Abbrevs are defined by the user to expand in specific
+ways.
+#+BEGIN_SRC emacs-lisp
+(setq save-abbrevs 'silently)
+(if (file-exists-p abbrev-file-name)
+    (quietly-read-abbrev-file))
+(abbrev-mode 1)
+#+END_SRC
+
+** font-lock
+Obviously emacs can do syntax hilighting. For more things than you ever
+heard about.
+And I want to have it everywhere.
+#+BEGIN_SRC emacs-lisp
+(require 'font-lock)
+(global-font-lock-mode 1)
+(setq font-lock-maximum-decoration t)
+#+END_SRC
+** miniedit
+Edit minibuffer in a full (text-mode) buffer by pressing *M-C-e*.
+#+BEGIN_SRC emacs-lisp
+(require 'miniedit)
+(miniedit-install)
+#+END_SRC
+
+** timestamp
+By default, Emacs can update the time stamp for the following two
+formats if one exists in the first 8 lines of the file.
+- Time-stamp: <>
+- Time-stamp: " "
+
+#+BEGIN_SRC emacs-lisp
+(require 'time-stamp)
+(setq time-stamp-active t)
+(setq time-stamp-format "%02H:%02M:%02S (%z) - %02d.%02m.%:y from %u (%U) on %s")
+(setq time-stamp-old-format-warn nil)
+(setq time-stamp-time-zone nil)
+(add-hook 'write-file-hooks 'time-stamp)
+#+END_SRC
+
+** cperl
+I like /cperl-mode/ a bit more than the default /perl-mode/, so set it
+up here to be used.
+#+BEGIN_SRC emacs-lisp
+(require 'cperl-mode)
+(defalias 'perl-mode 'cperl-mode)
+(setq cperl-hairy t)
+(setq cperl-electric-keywords t)
+(setq cperl-electric-lbrace-space t)
+(setq cperl-electric-parens nil)
+(setq cperl-highlight-variables-indiscriminately t)
+(setq cperl-imenu-addback t)
+(setq cperl-invalid-face (quote underline))
+(setq cperl-lazy-help-time 5)
+(setq cperl-mode-hook (quote (turn-on-tinyperl-mode)))
+(setq cperl-scan-files-regexp "\\.\\([pP][Llm]\\|xs\\|cgi\\)$")
+(setq cperl-syntaxify-by-font-lock t)
+(setq cperl-use-syntax-table-text-property-for-tags t)
+#+END_SRC
+
+** python
+#+BEGIN_SRC emacs-lisp
+(add-hook 'python-mode-hook 'elide-head)
+(autoload 'python-mode "python-mode" "Python editing mode." t)
+(autoload 'py-shell "python-mode" "Python shell." t)
+#+END_SRC
+
+If an =ipython= executable is on the path, then assume that IPython is
+the preferred method python evaluation.
+#+BEGIN_SRC emacs-lisp
+  (when (executable-find "ipython")
+    (require 'ipython)
+    (setq org-babel-python-mode 'python-mode))
+#+END_SRC
+
+** sh
+I prefer comments to be indented too
+#+BEGIN_SRC emacs-lisp
+(setq sh-indent-comment t)
+#+END_SRC
+
+** auto-revert
+When files change outside emacs for whatever reason I want emacs to deal
+with it. Not to have to revert buffers myself
+#+BEGIN_SRC emacs-lisp
+(require 'autorevert)
+(setq global-auto-revert-mode t)
+(global-auto-revert-mode)
+#+END_SRC
+
+** Follow-Mouse
+By default, a window within an Emacs frame must be selected by typing
+`C-x o' (other-window) or by clicking [mouse-1] on the mode line or the
+buffer itself (mouse-set-point); this corresponds to a "click to type"
+window manager policy.  follow-mouse.el implements a "focus follows
+mouse" window manager policy, so that a window is selected when the
+mouse moves over it.
+
+#+BEGIN_SRC emacs-lisp
+(require 'follow-mouse)
+(setq follow-mouse-deselect-active-minibuffer nil)
+(setq follow-mouse-auto-raise-frame nil)
+#+END_SRC
+I haven't turned this on by default, I need it very seldomly. In case I
+want it, I can run the following manually - or enable it as lisp.
+#+BEGIN_EXAMPLE
+(turn-on-follow-mouse)
+#+END_EXAMPLE
+
+** linum (line number)
+Various modes should have line numbers in front of each line.
+
+But then there are some where it would just be deadly - like org-mode,
+gnus, so we have a list of modes where we don't want to see it.
+
+#+BEGIN_SRC emacs-lisp
+(require 'linum)
+(setq linum-format "%3d ")
+(setq linum-mode-inhibit-modes-list '(org-mode
+                                      eshell-mode
+                                      shell-mode
+                                      gnus-group-mode
+                                      gnus-summary-mode
+                                      gnus-article-mode))
+
+(defadvice linum-on (around linum-on-inhibit-for-modes)
+  "Stop the load of linum-mode for some major modes."
+    (unless (member major-mode linum-mode-inhibit-modes-list)
+      ad-do-it))
+
+(ad-activate 'linum-on)
+(global-linum-mode 1)
+#+END_SRC
+
+** css
+#+BEGIN_SRC emacs-lisp
+(autoload 'css-mode "css-mode")
+(setq auto-mode-alist
+      (cons '("\\.css\\'" . css-mode) auto-mode-alist))
+#+END_SRC
+
+** html-helper
+Instead of default /html-mode/ I use /html-helper-mode/.
+#+BEGIN_SRC emacs-lisp
+(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
+(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
+(setq auto-mode-alist (cons '("\\.asp$" . html-helper-mode) auto-mode-alist))
+(setq auto-mode-alist (cons '("\\.phtml$" . html-helper-mode) auto-mode-alist))
+(defalias 'html-mode 'html-helper-mode)
+#+END_SRC
+
+** auctex
+#+BEGIN_SRC emacs-lisp
+(setq auto-mode-alist
+      (cons '("\\.tex\\'" . latex-mode) auto-mode-alist))
+#+END_SRC
+
+** Debian related
+#+BEGIN_SRC emacs-lisp
+(require 'dpkg-dev-el-loaddefs)
+(require 'debian-el-loaddefs)
+
+(setq debian-changelog-full-name "Joerg Jaspert")
+(setq debian-changelog-mailing-address "joerg@debian.org")
+#+END_SRC
+
+** org                                                                :FIXME:
+#+BEGIN_SRC emacs-lisp
+(add-to-list 'auto-mode-alist '("\\.\\(org\\|org_archive\\|txt\\)$" . org-mode))
+(require 'org-install)
+(require 'org-protocol)
+
+(global-set-key "\C-cl" 'org-store-link)
+(global-set-key "\C-ca" 'org-agenda)
+(global-set-key "\C-cb" 'org-iswitchb)
+(define-key mode-specific-map [?a] 'org-agenda)
+;; Disable C-c [ and C-c ] in org-mode
+(add-hook 'org-mode-hook
+          (lambda ()
+            ;; Undefine C-c [ and C-c ] since this breaks my
+            ;; org-agenda files when directories are included. It
+            ;; expands the files in the directories individually
+            (org-defkey org-mode-map "\C-c["    'undefined)
+            (org-defkey org-mode-map "\C-c]"    'undefined))
+          'append)
+;; Enable abbrev-mode
+(add-hook 'org-mode-hook (lambda () (abbrev-mode 1)))
+(setq org-startup-indented t)
+(setq org-cycle-separator-lines 2)
+
+(setq org-reverse-note-order nil)
+
+(setq org-agenda-log-mode-items (quote (closed clock state)))
+(setq org-agenda-ndays 7)
+(setq org-agenda-show-all-dates t)
+(setq org-agenda-start-on-weekday nil)
+(setq org-deadline-warning-days 14)
+(setq org-default-notes-file "~/notes.org")
+(setq org-enforce-todo-checkbox-dependencies t)
+(setq org-enforce-todo-dependencies t)
+(setq org-fast-tag-selection-single-key (quote expert))
+(setq org-footnote-auto-adjust t)
+(setq org-hide-block-startup t)
+(setq org-icalendar-alarm-time 15)
+(setq org-icalendar-combined-description "Ganneffs Org-mode calendar entries")
+(setq org-icalendar-combined-name "\"Ganneffs OrgMode\"")
+(setq org-icalendar-honor-noexport-tag t)
+(setq org-icalendar-include-bbdb-anniversaries nil)
+(setq org-icalendar-include-body 200)
+(setq org-icalendar-include-todo nil)
+(setq org-icalendar-store-UID t)
+(setq org-icalendar-timezone "Europe/Berlin")
+(setq org-insert-mode-line-in-empty-file t)
+(setq org-log-done (quote note))
+(setq org-log-into-drawer t)
+(setq org-log-reschedule (quote time))
+(setq org-log-states-order-reversed t)
+(setq org-mobile-agendas (quote all))
+(setq org-mobile-directory "/scpx:joerg@garibaldi.ganneff.de:/srv/www2.ganneff.de/htdocs/org/")
+(setq org-mobile-inbox-for-pull "~/org/refile.org")
+(setq org-remember-store-without-prompt t)
+(setq org-return-follows-link t)
+(setq org-reverse-note-order t)
+(setq org-todo-keywords (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d@/!)") (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED(g@/!)" "|" "CANCELLED(c@/!)" "PHONE"))))
+
+; regularly save our org-mode buffers
+(run-at-time "00:59" 3600 'org-save-all-org-buffers)
+
+(setq org-log-done t)
+(setq org-agenda-files (quote ("~/org/"
+                               "~/org/debian"
+                               "~/org/debconf"
+                               "~/org/spi"
+                               "~/org/nsb"
+                               )))
+(setq org-default-notes-file "~/org/notes.org")
+;;*** disable priority handling
+(setq org-enable-priority-commands nil)
+(setq org-use-fast-todo-selection t)
+(setq org-treat-S-cursor-todo-selection-as-state-change nil)
+
+;; Custom Key Bindings
+(global-set-key (kbd "<f12>") 'org-agenda)
+(global-set-key (kbd "<f5>") 'bh/org-todo)
+(global-set-key (kbd "<S-f5>") 'bh/widen)
+(global-set-key (kbd "<f7>") 'bh/set-truncate-lines)
+(global-set-key (kbd "<f8>") 'org-cycle-agenda-files)
+(global-set-key (kbd "<f9> <f9>") 'bh/show-org-agenda)
+(global-set-key (kbd "<f9> c") 'calendar)
+(global-set-key (kbd "<f9> f") 'boxquote-insert-file)
+(global-set-key (kbd "<f9> h") 'bh/hide-other)
+(global-set-key (kbd "<f9> n") 'org-narrow-to-subtree)
+(global-set-key (kbd "<f9> w") 'widen)
+(global-set-key (kbd "<f9> u") 'bh/narrow-up-one-level)
+
+(global-set-key (kbd "<f9> I") 'bh/punch-in)
+(global-set-key (kbd "<f9> O") 'bh/punch-out)
+
+(global-set-key (kbd "<f9> r") 'boxquote-region)
+(global-set-key (kbd "<f9> s") 'bh/switch-to-scratch)
+
+(global-set-key (kbd "<f9> t") 'bh/insert-inactive-timestamp)
+(global-set-key (kbd "<f9> T") 'tabify)
+(global-set-key (kbd "<f9> U") 'untabify)
+
+(global-set-key (kbd "<f9> v") 'visible-mode)
+(global-set-key (kbd "<f9> SPC") 'bh/clock-in-last-task)
+(global-set-key (kbd "C-<f9>") 'previous-buffer)
+(global-set-key (kbd "M-<f9>") 'org-toggle-inline-images)
+(global-set-key (kbd "C-x n r") 'narrow-to-region)
+(global-set-key (kbd "C-<f10>") 'next-buffer)
+(global-set-key (kbd "<f11>") 'org-clock-goto)
+(global-set-key (kbd "C-<f11>") 'org-clock-in)
+(global-set-key (kbd "C-s-<f12>") 'bh/save-then-publish)
+(global-set-key (kbd "C-M-r") 'org-capture)
+(global-set-key (kbd "C-c r") 'org-capture)
+#+end_src
+
+Speed commands enable single-letter commands in Org-mode files when
+the point is at the beginning of a headline, or at the beginning of a
+code block.
+
+See the `=org-speed-commands-default=' variable for a list of the keys
+and commands enabled at the beginning of headlines.  All code blocks
+are available at the beginning of a code block, the following key
+sequence =C-c C-v h= (bound to `=org-babel-describe-bindings=') will
+display a list of the code blocks commands and their related keys.
+
+#+begin_src emacs-lisp
+(setq org-use-speed-commands t)
+(setq org-speed-commands-user (quote (("0" . ignore)
+                                      ("1" . ignore)
+                                      ("2" . ignore)
+                                      ("3" . ignore)
+                                      ("4" . ignore)
+                                      ("5" . ignore)
+                                      ("6" . ignore)
+                                      ("7" . ignore)
+                                      ("8" . ignore)
+                                      ("9" . ignore)
+
+                                      ("a" . ignore)
+                                      ("d" . ignore)
+                                      ("h" . bh/hide-other)
+                                      ("i" progn
+                                       (forward-char 1)
+                                       (call-interactively 'org-insert-heading-respect-content))
+                                      ("k" . org-kill-note-or-show-branches)
+                                      ("l" . ignore)
+                                      ("m" . ignore)
+                                      ("q" . bh/show-org-agenda)
+                                      ("r" . ignore)
+                                      ("s" . org-save-all-org-buffers)
+                                      ("w" . org-refile)
+                                      ("x" . ignore)
+                                      ("y" . ignore)
+                                      ("z" . org-add-note)
+
+                                      ("A" . ignore)
+                                      ("B" . ignore)
+                                      ("E" . ignore)
+                                      ("F" . bh/restrict-to-file-or-follow)
+                                      ("G" . ignore)
+                                      ("H" . ignore)
+                                      ("J" . org-clock-goto)
+                                      ("K" . ignore)
+                                      ("L" . ignore)
+                                      ("M" . ignore)
+                                      ("N" . bh/narrow-to-subtree)
+                                      ("P" . bh/narrow-to-project)
+                                      ("Q" . ignore)
+                                      ("R" . ignore)
+                                      ("S" . ignore)
+                                      ("T" . bh/org-todo)
+                                      ("U" . bh/narrow-up-one-level)
+                                      ("V" . ignore)
+                                      ("W" . bh/widen)
+                                      ("X" . ignore)
+                                      ("Y" . ignore)
+                                      ("Z" . ignore))))
+
+(add-hook 'org-agenda-mode-hook
+          (lambda ()
+            (define-key org-agenda-mode-map "q" 'bury-buffer))
+          'append)
+
+(setq org-todo-keyword-faces
+      (quote (("TODO" :foreground "red" :weight bold)
+              ("NEXT" :foreground "light blue" :weight bold)
+              ("DONE" :foreground "forest green" :weight bold)
+              ("WAITING" :foreground "orange" :weight bold)
+              ("HOLD" :foreground "orange" :weight bold)
+              ("DELEGATED" :foreground "yellow" :weight bold)
+              ("CANCELLED" :foreground "forest green" :weight bold)
+              ("PHONE" :foreground "forest green" :weight bold))))
+
+(setq org-todo-state-tags-triggers
+      (quote (("CANCELLED" ("CANCELLED" . t))
+              ("WAITING" ("WAITING" . t))
+              ("HOLD" ("WAITING" . t) ("HOLD" . t))
+              (done ("WAITING") ("HOLD"))
+              ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
+              ("NEXT" ("WAITING") ("CANCELLED") ("HOLD"))
+              ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))
+
+; Tags with fast selection keys
+(setq org-tag-alist (quote ((:startgroup)
+                            ("@errand" . ?e)
+                            ("@office" . ?o)
+                            ("@home" . ?H)
+                            (:endgroup)
+                            ("PHONE" . ?p)
+                            ("WAITING" . ?w)
+                            ("HOLD" . ?h)
+                            ("PERSONAL" . ?P)
+                            ("WORK" . ?W)
+                            ("ORG" . ?O)
+                            ("PRIVATE" . ?N)
+                            ("crypt" . ?E)
+                            ("MARK" . ?M)
+                            ("NOTE" . ?n)
+                            ("CANCELLED" . ?c)
+                            ("FLAGGED" . ??))))
+
+; Allow setting single tags without the menu
+(setq org-fast-tag-selection-single-key (quote expert))
+
+; Overwrite the current window with the agenda
+(setq org-agenda-window-setup 'current-window)
+#+end_src
+
+The following displays the contents of code blocks in Org-mode files
+using the major-mode of the code.  It also changes the behavior of
+=TAB= to as if it were used in the appropriate major mode.  This means
+that reading and editing code form inside of your Org-mode files is
+much more like reading and editing of code using its major mode.
+
+#+BEGIN_SRC emacs-lisp
+  (setq org-src-fontify-natively t)
+  (setq org-src-tab-acts-natively t)
+  
+  ; For tag searches ignore tasks with scheduled and deadline dates
+  (setq org-agenda-tags-todo-honor-ignore-options t)
+  
+  ;;** org capture replaces remember mode
+  (setq org-directory "~/org")
+  (setq org-default-notes-file "~/org/refile.org")
+  
+  ;; I use C-M-r to start capture mode
+  (global-set-key (kbd "C-M-r") 'org-capture)
+  ;; I use C-c r to start capture mode when using SSH from my Android phone
+  (global-set-key (kbd "C-c r") 'org-capture)
+  
+  ;; Capture templates for: TODO tasks, Notes, appointments, phone calls, and org-protocol
+  ;; see http://orgmode.org/manual/Template-elements.html
+  (setq org-capture-templates
+        (quote (("t" "todo" entry (file "~/org/refile.org")
+                 "* TODO %?\nAdded: %U\n"
+                 :clock-in t :clock-resume t)
+                ("l" "linktodo" entry (file "~/org/refile.org")
+                 "* TODO %?\nAdded: %U\n%a\n"
+                 :clock-in t :clock-resume t)
+                ("r" "respond" entry (file "~/org/refile.org")
+                 "* TODO Respond to %:from on %:subject\nAdded: %U\n%a\n"
+                 :clock-in t :clock-resume t :immediate-finish t)
+                ("n" "note" entry (file "~/org/refile.org")
+                 "* %? :NOTE:\nAdded: %U\n%a\n"
+                 :clock-in t :clock-resume t)
+                ("d" "Delegated" entry (file "~/org/refile.org")
+                 "* DELEGATED %?\nAdded: %U\n%a\n"
+                 :clock-in t :clock-resume t)
+                ("j" "Journal" entry (file+datetree "~/org/diary.org")
+                 "* %?\nAdded: %U\n"
+                 :clock-in t :clock-resume t)
+                ("w" "org-protocol" entry (file "~/org/refile.org")
+                 "* TODO Review %c\nAdded: %U\n"
+                 :immediate-finish t)
+                ("p" "Phone call" entry (file "~/org/refile.org")
+                 "* PHONE %? :PHONE:\nAdded: %U"
+                 :clock-in t :clock-resume t)
+                ("f" "Firewall request" entry (file+headline "~/org/nsb/dlh.org" "Firewall")
+                 "* TODO Firewall Reuqest, RT: %?\nAdded: %U"
+                 :clock-in t :clock-resume t)
+                ("i" "Ticket" entry (file+headline "~/org/nsb/dlh.org" "RT Ticket")
+                 "* TODO , RT: %?\nAdded: %U"
+                 :clock-in t :clock-resume t)
+                ("x" "Bookmark link" entry (file "~/org/refile.org")
+                 "* Bookmark: %c\n%i\nAdded: %U\n"
+                 :immediate-finish t)
+                ("h" "Habit" entry (file "~/org/refile.org")
+                 "* NEXT %?\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\nAdded: %U\nSCHEDULED: %t .+1d/3d\n")
+                )))
+  
+  ; Targets include this file and any file contributing to the agenda - up to 9 levels deep
+  (setq org-refile-targets (quote ((nil :maxlevel . 9)
+                                   (org-agenda-files :maxlevel . 9))))
+  
+  ; Use full outline paths for refile targets - we file directly with IDO
+  (setq org-refile-use-outline-path t)
+  
+  ; Targets complete directly with IDO
+  (setq org-outline-path-complete-in-steps nil)
+  
+  ; Allow refile to create parent tasks with confirmation
+  (setq org-refile-allow-creating-parent-nodes (quote confirm))
+  
+  ; Use IDO for both buffer and file completion and ido-everywhere to t
+  (setq org-completion-use-ido t)
+  (setq org-completion-use-iswitchb nil)
+  
+  ;;;; Refile settings
+  (setq org-refile-target-verify-function 'bh/verify-refile-target)
+  
+  ;; Do not dim blocked tasks
+  (setq org-agenda-dim-blocked-tasks nil)
+  ;; Compact the block agenda view
+  (setq org-agenda-compact-blocks t)
+  
+  
+  ;; disable the default org-mode stuck projects agenda view
+  (setq org-stuck-projects (quote ("" nil nil "")))
+  
+  ; force showing the next headline.
+  (setq org-show-entry-below (quote ((default))))
+  
+  (setq org-show-following-heading t)
+  (setq org-show-hierarchy-above t)
+  (setq org-show-siblings (quote ((default))))
+  
+  (setq org-special-ctrl-a/e 'reversed)
+  (setq org-special-ctrl-k t)
+  (setq org-yank-adjusted-subtrees t)
+  
+  
+  ;; Always hilight the current agenda line
+  (add-hook 'org-agenda-mode-hook
+            '(lambda () (hl-line-mode 1))
+            'append)
+  
+  ;; Keep tasks with dates on the global todo lists
+  (setq org-agenda-todo-ignore-with-date nil)
+  
+  ;; Keep tasks with deadlines on the global todo lists
+  (setq org-agenda-todo-ignore-deadlines nil)
+  
+  ;; Keep tasks with scheduled dates on the global todo lists
+  (setq org-agenda-todo-ignore-scheduled nil)
+  
+  ;; Keep tasks with timestamps on the global todo lists
+  (setq org-agenda-todo-ignore-timestamp nil)
+  
+  ;; Remove completed deadline tasks from the agenda view
+  (setq org-agenda-skip-deadline-if-done t)
+  
+  ;; Remove completed scheduled tasks from the agenda view
+  (setq org-agenda-skip-scheduled-if-done t)
+  
+  ;; Remove completed items from search results
+  (setq org-agenda-skip-timestamp-if-done t)
+  
+  ;; Include agenda archive files when searching for things
+  (setq org-agenda-text-search-extra-files (quote (agenda-archives)))
+  
+  ;; Show all future entries for repeating tasks
+  (setq org-agenda-repeating-timestamp-show-all t)
+  
+  ;; Show all agenda dates - even if they are empty
+  (setq org-agenda-show-all-dates t)
+  
+  ;; Sorting order for tasks on the agenda
+  (setq org-agenda-sorting-strategy
+        (quote ((agenda habit-down time-up user-defined-up priority-down effort-up category-keep)
+                (todo category-up priority-down effort-up)
+                (tags category-up priority-down effort-up)
+                (search category-up))))
+  
+  ;; Start the weekly agenda on Monday
+  (setq org-agenda-start-on-weekday 1)
+  
+  ;; Enable display of the time grid so we can see the marker for the current time
+  (setq org-agenda-time-grid (quote ((daily today remove-match)
+                                     #("----------------" 0 16 (org-heading t))
+                                     (0800 1000 1200 1400 1500 1700 1900 2100))))
+  
+  ;; Display tags farther right
+  (setq org-agenda-tags-column -102)
+  
+  ; position the habit graph on the agenda to the right of the default
+  (setq org-habit-graph-column 50)
+  
+  ; turn habits back on
+  (run-at-time "06:00" 86400 '(lambda () (setq org-habit-show-habits t)))
+  
+  ;;
+  ;; Agenda sorting functions
+  ;;
+  (setq org-agenda-cmp-user-defined 'bh/agenda-sort)
+  
+  
+  (setq org-deadline-warning-days 30)
+  
+  (setq org-table-export-default-format "orgtbl-to-csv")
+  
+  ;; Custom agenda command definitions
+  (setq org-agenda-custom-commands
+        (quote (("N" "Notes" tags "NOTE"
+                 ((org-agenda-overriding-header "Notes")
+                  (org-tags-match-list-sublevels t)))
+                ("h" "Habits" tags-todo "STYLE=\"habit\""
+                 ((org-agenda-overriding-header "Habits")
+                  (org-agenda-sorting-strategy
+                   '(todo-state-down effort-up category-keep))))
+                (" " "Agenda"
+                 ((agenda "" nil)
+                  (tags "REFILE"
+                        ((org-agenda-overriding-header "Tasks to Refile")
+                         (org-tags-match-list-sublevels nil)))
+                  (tags-todo "-HOLD-CANCELLED/!"
+                             ((org-agenda-overriding-header "Projects")
+                              (org-agenda-skip-function 'bh/skip-non-projects)
+                              (org-agenda-sorting-strategy
+                               '(category-keep))))
+                  (tags-todo "-CANCELLED/!"
+                             ((org-agenda-overriding-header "Stuck Projects")
+                              (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
+                  (tags-todo "-WAITING-CANCELLED/!NEXT"
+                             ((org-agenda-overriding-header "Next Tasks")
+                              (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
+                              (org-agenda-todo-ignore-scheduled t)
+                              (org-agenda-todo-ignore-deadlines t)
+                              (org-agenda-todo-ignore-with-date t)
+                              (org-tags-match-list-sublevels t)
+                              (org-agenda-sorting-strategy
+                               '(todo-state-down effort-up category-keep))))
+                  (tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
+                             ((org-agenda-overriding-header "Tasks")
+                              (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
+                              (org-agenda-todo-ignore-scheduled t)
+                              (org-agenda-todo-ignore-deadlines t)
+                              (org-agenda-todo-ignore-with-date t)
+                              (org-agenda-sorting-strategy
+                               '(category-keep))))
+                  (tags-todo "-CANCELLED/!WAITING|HOLD"
+                             ((org-agenda-overriding-header "Waiting and Postponed Tasks")
+                              (org-tags-match-list-sublevels nil)
+                              (org-agenda-todo-ignore-scheduled 'future)
+                              (org-agenda-todo-ignore-deadlines 'future)))
+                  (tags "-REFILE/"
+                        ((org-agenda-overriding-header "Tasks to Archive")
+                         (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
+                         (org-tags-match-list-sublevels nil))))
+                 nil)
+                ("r" "Tasks to Refile" tags "REFILE"
+                 ((org-agenda-overriding-header "Tasks to Refile")
+                  (org-tags-match-list-sublevels nil)))
+                ("#" "Stuck Projects" tags-todo "-CANCELLED/!"
+                 ((org-agenda-overriding-header "Stuck Projects")
+                  (org-agenda-skip-function 'bh/skip-non-stuck-projects)))
+                ("n" "Next Tasks" tags-todo "-WAITING-CANCELLED/!NEXT"
+                 ((org-agenda-overriding-header "Next Tasks")
+                  (org-agenda-skip-function 'bh/skip-projects-and-habits-and-single-tasks)
+                  (org-agenda-todo-ignore-scheduled t)
+                  (org-agenda-todo-ignore-deadlines t)
+                  (org-agenda-todo-ignore-with-date t)
+                  (org-tags-match-list-sublevels t)
+                  (org-agenda-sorting-strategy
+                   '(todo-state-down effort-up category-keep))))
+                ("R" "Tasks" tags-todo "-REFILE-CANCELLED/!-HOLD-WAITING"
+                 ((org-agenda-overriding-header "Tasks")
+                  (org-agenda-skip-function 'bh/skip-project-tasks-maybe)
+                  (org-agenda-sorting-strategy
+                   '(category-keep))))
+                ("p" "Projects" tags-todo "-HOLD-CANCELLED/!"
+                 ((org-agenda-overriding-header "Projects")
+                  (org-agenda-skip-function 'bh/skip-non-projects)
+                  (org-agenda-sorting-strategy
+                   '(category-keep))))
+                ("w" "Waiting Tasks" tags-todo "-CANCELLED/!WAITING|HOLD"
+                 ((org-agenda-overriding-header "Waiting and Postponed tasks"))
+                 (org-tags-match-list-sublevels nil))
+                ("A" "Tasks to Archive" tags "-REFILE/"
+                 ((org-agenda-overriding-header "Tasks to Archive")
+                  (org-agenda-skip-function 'bh/skip-non-archivable-tasks)
+                  (org-tags-match-list-sublevels nil))))))
+  
+  (setq org-archive-mark-done nil)
+  (setq org-archive-location "%s_archive::* Archived Tasks")
+  
+  (setq org-startup-folded 'content)
+  
+  (global-set-key (kbd "<f9> p") 'bh/phone-call)
+  
+  (setq org-remove-highlights-with-change nil)
+  
+  (setq org-list-demote-modify-bullet (quote (("+" . "-")
+      ("*" . "-")
+      ("1." . "-")
+      ("1)" . "-"))))
+  
+  (setq org-agenda-persistent-filter t)
+  
+  
+  (add-hook 'org-clock-out-hook 'bh/remove-empty-drawer-on-clock-out 'append)
+  (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp 'append)
+  
+  (add-hook 'org-agenda-mode-hook
+            '(lambda () (org-defkey org-agenda-mode-map "W" 'bh/widen))
+            'append)
+  
+  (add-hook 'org-agenda-mode-hook
+            '(lambda () (org-defkey org-agenda-mode-map "F" 'bh/restrict-to-file-or-follow))
+            'append)
+  
+  (add-hook 'org-agenda-mode-hook
+            '(lambda () (org-defkey org-agenda-mode-map "N" 'bh/narrow-to-subtree))
+            'append)
+  
+  (add-hook 'org-agenda-mode-hook
+            '(lambda () (org-defkey org-agenda-mode-map "U" 'bh/narrow-up-one-level))
+            'append)
+  
+  (add-hook 'org-agenda-mode-hook
+            '(lambda () (org-defkey org-agenda-mode-map "P" 'bh/narrow-to-project))
+            'append)
+  
+  ; Rebuild the reminders everytime the agenda is displayed
+  (add-hook 'org-finalize-agenda-hook 'bh/org-agenda-to-appt 'append)
+  
+  ; This is at the end of my .emacs - so appointments are set up when Emacs starts
+  (bh/org-agenda-to-appt)
+  
+  ; Activate appointments so we get notifications
+  (appt-activate t)
+  
+  ; If we leave Emacs running overnight - reset the appointments one minute after midnight
+  (run-at-time "24:01" nil 'bh/org-agenda-to-appt)
+  
+  
+  ;;
+  ;; Resume clocking task when emacs is restarted
+  (org-clock-persistence-insinuate)
+  ;;
+  ;; Show lot sof clocking history so it's easy to pick items off the C-F11 list
+  (setq org-clock-history-length 36)
+  ;; Resume clocking task on clock-in if the clock is open
+  (setq org-clock-in-resume t)
+  ;; Change tasks to NEXT when clocking in
+  (setq org-clock-in-switch-to-state 'bh/clock-in-to-next)
+  ;; Separate drawers for clocking and logs
+  (setq org-drawers (quote ("PROPERTIES" "LOGBOOK")))
+  ;; Save clock data and state changes and notes in the LOGBOOK drawer
+  (setq org-clock-into-drawer t)
+  ;; Sometimes I change tasks I'm clocking quickly - this removes clocked tasks with 0:00 duration
+  (setq org-clock-out-remove-zero-time-clocks t)
+  ;; Clock out when moving task to a done state
+  (setq org-clock-out-when-done (quote ("DONE" "WAITING" "DELEGATED" "CANCELLED")))
+  ;; Save the running clock and all clock history when exiting Emacs, load it on startup
+  (setq org-clock-persist t)
+  ;; Do not prompt to resume an active clock
+  (setq org-clock-persist-query-resume nil)
+  ;; Enable auto clock resolution for finding open clocks
+  (setq org-clock-auto-clock-resolution (quote when-no-clock-is-running))
+  ;; Include current clocking task in clock reports
+  (setq org-clock-report-include-clocking-task t)
+  
+  ; use discrete minute intervals (no rounding) increments
+  (setq org-time-stamp-rounding-minutes (quote (1 1)))
+  
+  (setq bh/keep-clock-running nil)
+  
+  (setq org-agenda-clock-consistency-checks
+        (quote (:max-duration "4:00"
+                :min-duration 0
+                :max-gap 0
+                :gap-ok-around ("4:00"))))
+  
+  ;; Agenda clock report parameters
+  (setq org-agenda-clockreport-parameter-plist
+        (quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80)))
+  
+  ; Set default column view headings: Task Effort Clock_Summary
+  (setq org-columns-default-format "%80ITEM(Task) %10Effort(Effort){:} %10CLOCKSUM")
+  
+  ; global Effort estimate values
+  ; global STYLE property values for completion
+  (setq org-global-properties (quote (("Effort_ALL" . "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00")
+                                      ("STYLE_ALL" . "habit"))))
+  
+  ;; Agenda log mode items to display (closed and state changes by default)
+  (setq org-agenda-log-mode-items (quote (state)))
+  
+  (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
+  
+  ;;; define categories that should be excluded
+  (setq org-export-exclude-category (list "google" "google"))
+  (setq org-icalendar-use-scheduled '(todo-start event-if-todo))
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+(setq org-publish-project-alist
+      '(
+        ("config-notes"
+         :base-directory "~/.emacs.d/config/"
+         :base-extension "org"
+         :publishing-directory "/develop/www/emacs"
+         :recursive t
+         :publishing-function org-publish-org-to-html
+         :headline-levels 4             ; Just the default for this project.
+         :auto-preamble t
+         )
+        ("config-static"
+         :base-directory "~/.emacs.d/config/"
+         :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
+         :publishing-directory "/develop/www/emacs"
+         :recursive t
+         :publishing-function org-publish-attachment
+         )
+        ("inherit-org-info-js"
+         :base-directory "/develop/vcs/org-info-js/"
+         :recursive t
+         :base-extension "js"
+         :publishing-directory "/develop/www/"
+         :publishing-function org-publish-attachment
+         )
+        ("config" :components ("inherit-org-info-js" "config-notes" "config-static")
+         )
+        )
+      )
+#+END_SRC
+#+BEGIN_SRC emacs-lisp
+  (setq org-latex-to-pdf-process 
+        '("xelatex -interaction nonstopmode %f"
+          "xelatex -interaction nonstopmode %f")) ;; for multiple passes
+  #+END_SRC
+#+BEGIN_SRC emacs-lisp
+  (require 'org-latex)
+  (setq org-export-latex-listings 'minted)
+  
+  ;; Originally taken from Bruno Tavernier: http://thread.gmane.org/gmane.emacs.orgmode/31150/focus=31432
+  ;; but adapted to use latexmk 4.20 or higher.
+  (defun my-auto-tex-cmd ()
+    "When exporting from .org with latex, automatically run latex,
+       pdflatex, or xelatex as appropriate, using latexmk."
+    (let ((texcmd)))
+    ;; default command: oldstyle latex via dvi
+    (setq texcmd "latexmk -dvi -pdfps -quiet %f")
+    ;; pdflatex -> .pdf
+    (if (string-match "LATEX_CMD: pdflatex" (buffer-string))
+        (setq texcmd "latexmk -pdf -quiet %f"))
+    ;; xelatex -> .pdf
+    (if (string-match "LATEX_CMD: xelatex" (buffer-string))
+        (setq texcmd "latexmk -pdflatex='xelatex -shell-escape' -pdf -quiet %f"))
+    ;; LaTeX compilation command
+    (setq org-latex-to-pdf-process (list texcmd)))
+  
+  (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-cmd)
+  
+  ;; Specify default packages to be included in every tex file, whether pdflatex or xelatex
+  (setq org-export-latex-packages-alist
+        '(("" "graphicx" t)
+          ("" "longtable" nil)
+          ("" "float" nil)
+          ("" "minted" nil)
+          ))
+  
+  (defun my-auto-tex-parameters ()
+        "Automatically select the tex packages to include."
+        ;; default packages for ordinary latex or pdflatex export
+        (setq org-export-latex-default-packages-alist
+              '(("AUTO" "inputenc" t)
+                ("T1"   "fontenc"   t)
+                (""     "fixltx2e"  nil)
+                (""     "wrapfig"   nil)
+                (""     "soul"      t)
+                (""     "textcomp"  t)
+                (""     "marvosym"  t)
+                (""     "wasysym"   t)
+                (""     "latexsym"  t)
+                (""     "amssymb"   t)
+                (""     "hyperref"  nil)))
+  
+        ;; Packages to include when xelatex is used
+        (if (string-match "LATEX_CMD: xelatex" (buffer-string))
+            (setq org-export-latex-default-packages-alist
+                  '(("" "fontspec" t)
+                    ("" "xunicode" t)
+                    ("" "url" t)
+                    ("" "rotating" t)
+                    ("german" "babel" t)
+                    ("babel" "csquotes" t)
+                    ("" "soul" t)
+                    ("xetex" "hyperref" nil)
+                    )))
+  
+        (if (string-match "LATEX_CMD: xelatex" (buffer-string))
+            (setq org-export-latex-classes
+                  (cons '("scrartcl"
+                          "\\documentclass[11pt,DIV=13,oneside]{scrartcl}"
+                          ("\\section{%s}" . "\\section*{%s}")
+                          ("\\subsection{%s}" . "\\subsection*{%s}")
+                          ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
+                          ("\\paragraph{%s}" . "\\paragraph*{%s}")
+                          ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
+                        org-export-latex-classes))))
+  
+  (add-hook 'org-export-latex-after-initial-vars-hook 'my-auto-tex-parameters)
+#+END_SRC
+#+BEGIN_SRC emacs-lisp
+(setq org-attach-directory "~/org/data/")
+#+END_SRC
+#+BEGIN_SRC emacs-lisp
+(setq org-agenda-sticky t)
+#+END_SRC
+** transient mark
+For some reason I prefer this mode more than the way without.
+#+BEGIN_SRC emacs-lisp
+(transient-mark-mode 1)
+#+END_SRC
+** cua
+I know that this lets it look "more like windows", but I don't much care
+about its paste/copy/cut keybindings, the really nice part is the great
+support for rectangular regions, which I started to use a lot since I
+know this mode. The normal keybindings for those are just to useless.
+
+#+BEGIN_SRC emacs-lisp
+(cua-mode t)
+(setq cua-enable-cua-keys (quote shift))
+#+END_SRC
+
+Luckily cua-mode easily supports this, with the following line I just
+get the CUA selection and rectangle stuff, not the keybindings. Yes,
+even though the above =cua-enable-cua-keys= setting would only enable
+them if the selection is done when the region was marked with a shifted
+movement keys.
+#+BEGIN_SRC emacs-lisp
+(cua-selection-mode t)
+#+END_SRC
+
+** mo-git-blame
+This is [[https://github.com/mbunkus/mo-git-blame][mo-git-blame -- An interactive, iterative 'git blame' mode for
+Emacs]].
+
+#+BEGIN_SRC emacs-lisp
+(autoload 'mo-git-blame-file "mo-git-blame" nil t)
+(autoload 'mo-git-blame-current "mo-git-blame" nil t)
+#+END_SRC
+
+** mingus
+[[https://github.com/pft/mingus][Mingus]] is a nice interface to mpd, the Music Player Daemon.
+
+I want to access it from anywhere using =F6=.
+#+BEGIN_SRC emacs-lisp
+(autoload 'mingus "mingus-stays-home" nil t)
+(global-set-key (kbd "<f6>") 'mingus)
+(setq mingus-dired-add-keys t)
+(setq mingus-mode-always-modeline nil)
+(setq mingus-mode-line-show-elapsed-percentage nil)
+(setq mingus-mode-line-show-volume nil)
+(setq mingus-mpd-config-file "/etc/mpd.conf")
+(setq mingus-mpd-playlist-dir "/var/lib/mpd/playlists")
+(setq mingus-mpd-root "/share/music/")
+#+END_SRC
+
+** saveplace
+Store at which point I have been in files.
+#+BEGIN_SRC emacs-lisp
+(require 'saveplace)
+(setq-default save-place t)
+(setq save-place-file "~/.emacs.d/saved-places")
+#+END_SRC
+** easypg
+EasyPG is a GnuPG interface for Emacs.
+
+#+BEGIN_SRC emacs-lisp
+(require 'epa-file)
+(epa-file-enable)
+#+END_SRC
+
+I took the following from [[http://www.emacswiki.org/emacs/EasyPG][EmacsWiki: Easy PG]]
+#+BEGIN_SRC emacs-lisp
+  (defadvice epg--start (around advice-epg-disable-agent disable)
+    "Don't allow epg--start to use gpg-agent in plain text
+      terminals."
+    (if (display-graphic-p)
+        ad-do-it
+      (let ((agent (getenv "GPG_AGENT_INFO")))
+        (setenv "GPG_AGENT_INFO" nil) ; give us a usable text password prompt
+        ad-do-it
+        (setenv "GPG_AGENT_INFO" agent))))
+  (ad-enable-advice 'epg--start 'around 'advice-epg-disable-agent)
+  (ad-activate 'epg--start)
+#+END_SRC
+** message
+#+BEGIN_SRC emacs-lisp
+  (require 'message)
+  (setq message-kill-buffer-on-exit t)
+  
+#+END_SRC
+** gnus
+Most of my gnus config is in an own file, [[file:gnus.org][gnus.org]], here I only have
+what I want every emacs to know.
+
+#+BEGIN_SRC emacs-lisp
+;;*** Keyboardmacros
+(global-unset-key "\M-n")
+(global-set-key "\M-n" 'gnus) ; Start gnus with M-n
+#+END_SRC
+
+** bbdb
+#+BEGIN_SRC emacs-lisp
+(setq bbdb-complete-name-allow-cycling t)
+(setq bbdb-hashtable-size 104729)
+#+END_SRC
+
+** tramp                                                             :FIXME:
+#+BEGIN_SRC emacs-lisp
+(setq tramp-auto-save-directory "~/emacs/autosave")
+(setq tramp-debug-buffer nil)
+(setq tramp-default-method "sshx")
+(setq tramp-verbose 5)
+#+END_SRC
+** url
+#+BEGIN_SRC emacs-lisp
+(setq url-mime-language-string "de,en")
+(setq url-privacy-level (quote (email os lastloc)))
+#+END_SRC
+** w3m
+
+
+* Customized variables
+:PROPERTIES:
+:ID: 0102208d-fdf6-4928-9e40-7e341bd3aa3a
+:END:
+Of course I want to be able to use the customize interface, and some
+things can only be set via it (or so they say). I usually prefer to put
+things I keep for a long while into statements somewhere else, not just
+custom-set here, but we need it anyways.
+
+#+BEGIN_SRC emacs-lisp
+(setq custom-file (concat dotfiles-dir "/customized.el"))
+(safe-load custom-file)
+#+END_SRC
+
+The source of this is:
+#+INCLUDE "~/.emacs.d/config/customized.el" src emacs-lisp
diff --git a/.emacs.d/config/gkar.ganneff.de.org b/.emacs.d/config/gkar.ganneff.de.org
new file mode 100644 (file)
index 0000000..3bb55f5
--- /dev/null
@@ -0,0 +1,67 @@
+#+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
+#+TITLE:     gkar.ganneff.de.org - Ganneffs configuration, host specific file for gkar
+#+DATE:      %Y-%m-%d
+#+SETUPFILE: ~/elisp/org-templates/level-0.org
+
+* Machine specific config
+** gnus
+*** Mail access
+First specific point is how I access my mail. I am using gnus, and I
+have two hosts to get data from.
+#+BEGIN_SRC emacs-lisp
+  (setq gnus-secondary-select-methods
+        '((nnml "")
+          (nnimap "gkar"
+                  (nnimap-address "localhost")
+                  (nnimap-server-port 993)
+                  (nnimap-nov-is-evil t)
+                  (nnimap-stream ssl)
+                  (nnimap-fetch-partial-articles "text/")
+                  ;(nnimap-stream shell)
+                  ;(nnir-search-engine imap)
+                      )
+          (nnimap "fry"
+                  (nnimap-address "fry.nsb-software.de")
+                  (nnimap-server-port 993)
+                  (nnimap-stream ssl)
+                  (nnimap-nov-is-evil t)
+                  (nnimap-fetch-partial-articles "text/")
+                  (nnir-search-engine imap)
+                  )
+          ))
+#+END_SRC
+
+Together with the above I do have a =~/.authinfo= file which has lines
+of the form
+#+BEGIN_EXAMPLE
+machine HOSTNAME login USERNAME password PASSWORD port XXX
+#+END_EXAMPLE
+where you obviously replace the placeholders. You should ensure that
+this file has mode 600 to not have others grab your passwords[fn:1]. Or
+leave it away entirely, then =gnus= will ask you every time you connect.
+
+*** Search
+On my desktop I have a notmuch instance running which I use instead of
+nnir or direct imap searches. It is much better, though for that it has
+its drawbacks - like building up an own database of mail. Which is the
+reason only my desktop uses it.
+#+BEGIN_SRC emacs-lisp
+  (require 'notmuch)
+  (add-hook 'gnus-group-mode-hook 'lld-notmuch-shortcut)
+  (define-key notmuch-show-mode-map (kbd "C-c C-c") 'lld-notmuch-goto-message-in-gnus)
+#+END_SRC
+
+*** Outgoing mail copies
+When I send a mail (or post to a newsgroup) I want copies of that.
+#+BEGIN_SRC emacs-lisp
+  (setq gnus-message-archive-group
+        '((if (message-news-p)
+              "nnfolder+archive:Sentnews"
+            "nnimap+gkar:Sentmail")))
+#+END_SRC
+
+* Footnotes
+
+[fn:1] And of course have different passwords for imap than for your login.
+
+
diff --git a/.emacs.d/config/gnus.org b/.emacs.d/config/gnus.org
new file mode 100644 (file)
index 0000000..226a049
--- /dev/null
@@ -0,0 +1,317 @@
+#+STARTUP: align fold nodlcheck hidestars oddeven lognotestate
+#+TITLE:     gnus.org - Ganneffs gnus configuration
+#+DATE:      %Y-%m-%d
+#+SETUPFILE: ~/elisp/org-templates/level-0.org
+
+* Preface
+:PROPERTIES:
+:ID: d7915b79-2c7b-4613-bfeb-552ded0580c0
+:END:
+Whatever. My gnus config.
+* Functions
+
+* Settings
+#+BEGIN_SRC emacs-lisp
+(setq gnus-init-file "~/.gnus")
+(require 'gnus-load)
+#+END_SRC
+
+
+* Interface
+** Language/i18n stuff
+In this day and age, we should be able to do utf8. Though whenever
+possible we should use the smallest encoding able to represent our
+stuff.
+
+#+BEGIN_SRC emacs-lisp
+(setq mm-coding-system-priorities '(iso-latin-1 iso-latin-9 utf-8))
+(unify-8859-on-encoding-mode 1)
+(unify-8859-on-decoding-mode 1)
+(prefer-coding-system 'latin-9)
+(prefer-coding-system 'latin-1)
+(prefer-coding-system 'utf-8)
+#+END_SRC
+
+** Display/Look&Feel/"Design" stuff
+*** Topic
+Topic mode lets me sort Groups into topics.
+#+BEGIN_SRC emacs-lisp
+(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
+#+END_SRC
+
+And we want a slightly different look too.
+#+BEGIN_SRC emacs-lisp
+(setq gnus-topic-line-format "%i[ %u&topic-line; ] %v\n")
+#+END_SRC
+*** Summary
+How to display summary lines
+#+BEGIN_SRC emacs-lisp
+(setq gnus-summary-line-format "%U%R%z (%4k) %uy%* %B%(%[ %-22,22f %]%) %s\n")
+#+END_SRC
+
+Use a fuzzy algorithm when comparing subjects while building up thread
+display.
+#+BEGIN_SRC emacs-lisp
+(setq gnus-summary-gather-subject-limit 'fuzzy)
+#+END_SRC
+
+Hilighting the full line of our position in the summary buffer
+#+BEGIN_SRC emacs-lisp
+(require 'highline)
+(add-hook 'gnus-summary-mode-hook 'highline-mode)
+#+END_SRC
+
+When a article (a mail) gets a score below this value, it is expunged
+without me needing to do anything. Or the need to see it.
+#+BEGIN_SRC emacs-lisp
+(setq gnus-summary-expunge-below -1000)
+#+END_SRC
+
+I can mark mail and move them to a spam/ham folder, from which my
+various spamassassins get trained later.
+#+BEGIN_SRC emacs-lisp
+(add-hook 'gnus-summary-mode-hook
+                 (lambda ()
+                       (local-set-key [C-f1] (quote jj-move-mail-spambox))))
+
+(add-hook 'gnus-summary-mode-hook
+                 (lambda ()
+                       (local-set-key [C-f2] (quote jj-copy-mail-hambox))))
+#+END_SRC
+
+**** Spam forward to some anti-spambot
+I know the following can be done with much nicer code, but meh.
+#+BEGIN_SRC emacs-lisp
+(add-hook 'gnus-summary-mode-hook
+         (lambda ()
+           (local-set-key (kbd "<f7> d") (quote jj-forward-ham-lists-debconf))))
+
+(add-hook 'gnus-summary-mode-hook
+         (lambda ()
+           (local-set-key (kbd "<f8> d") (quote jj-forward-spam-lists-debconf))))
+
+(add-hook 'gnus-summary-mode-hook
+         (lambda ()
+           (local-set-key (kbd "<f7> o") (quote jj-forward-ham-lists-oftc))))
+
+(add-hook 'gnus-summary-mode-hook
+         (lambda ()
+           (local-set-key (kbd "<f8> o") (quote jj-forward-spam-lists-oftc))))
+
+(add-hook 'gnus-summary-mode-hook
+         (lambda ()
+           (local-set-key (kbd "<f7> s") (quote jj-forward-ham-lists-spi))))
+
+(add-hook 'gnus-summary-mode-hook
+         (lambda ()
+           (local-set-key (kbd "<f8> s") (quote jj-forward-spam-lists-spi))))
+#+END_SRC
+
+
+*** Group lines
+I redefine the group-line-format to include a date when I last visited a
+group.
+#+BEGIN_SRC emacs-lisp
+(setq gnus-group-line-format
+      "%M%S%p%P %4y/%4i/%6t: %(%-45,45G%3O%)%l <%2,2~(cut 6)d.%2,2~(cut 4)d.%2,2~(cut 2)d>\n")
+#+END_SRC
+
+To have the data needed for the /%d/ format modifier we need to help it
+along and actually store this timestamp.
+#+BEGIN_SRC emacs-lisp
+(add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
+#+END_SRC
+
+** Keyboard changes without a better place to go to
+*** Miscellaneous
+
+* Mail config
+A part of this is done in my host specific config file, as the ways of
+accessing mail differ based on the host I am using.
+
+** General
+- How do I want to connect to ssl and shell based imap servers.
+  #+BEGIN_SRC emacs-lisp
+  (setq imap-ssl-program "openssl s_client -tls1 -connect %s:%p")
+  (setq imap-shell-program "MAIL=maildir:$HOME/Maildir /usr/lib/dovecot/imap")
+  #+END_SRC
+
+- Nowadays I am not really reading news - so I point it at a nondefined
+  place.
+  #+BEGIN_SRC emacs-lisp
+    (setq gnus-select-method (list 'nnspool (system-name)))
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+  (require 'org-gnus )
+     
+  (setq nnir-mail-backend (nth 1 gnus-secondary-select-methods))
+#+END_SRC
+
+* Encryption/Signature related
+#+BEGIN_SRC emacs-lisp
+(require 'mml-sec)
+(setq mm-verify-option 'always)
+;; Keine extra Signatur erzeugen.
+(mml-signencrypt-style "pgpmime" 'combined)
+(add-hook 'gnus-message-setup-hook 'sign-or-crypt)
+#+END_SRC
+
+
+* Extra packages
+The following packages add features I want to use with gnus. And while a
+number of them might be usable without gnus (think bbdb), I usually do
+not use them outside, so they are here. Otherwise, they would appear in
+[[file:emacs.org][emacs.org]]…
+
+** bbdb
+Load it.
+#+BEGIN_SRC emacs-lisp
+(require 'bbdb)
+(require 'bbdb-hooks)
+(require 'bbdb-gnus)
+(require 'bbdb-com)
+(require 'bbdb-autoloads)
+#+END_SRC
+
+And ensure it is active when we need it.
+#+BEGIN_SRC emacs-lisp
+(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)
+(add-hook 'message-setup-hook 'bbdb-define-all-aliases)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+  (setq bbdb-notice-hook 'bbdb-auto-notes-hook)
+  (setq bbdb-pop-up-target-lines 6)
+  (setq bbdb-use-pop-up t)
+  (setq bbdb-file-coding-system 'utf-8)
+  (setq bbdb-default-area-code 661)
+  (setq bbdb-dial-local-prefix "0")
+  (setq bbdb-canonicalize-redundant-nets-p t)
+  (setq bbdb-notice-auto-save-file t)
+  (setq bbdb-north-american-phone-numbers-p nil)
+  (setq bbdb-offer-save t)
+  (setq bbdb-always-add-addresses t)
+  (setq bbdb-new-nets-always-primary t)
+  (setq bbdb-complete-name-allow-cycling t)
+  (setq bbdb-user-mail-names "\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gnus\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\)")
+  (setq bbdb-ignore-most-messages-alist '(("To" . "\\(\\(\\(joerg\\)\\(\\.jaspert\\)?\\)\\|root\\|gnus\\)@\\(debian\\.org\\|ganneff\\.de\\|debconf\\.org\\|spi-inc\\.org\\)")))
+  (setq bbdb/news-auto-create-p 'bbdb-ignore-most-messages-hook)
+  (setq bbdb/gnus-summary-known-poster-mark "+")
+  (setq bbdb/gnus-summary-mark-known-posters t)
+  (setq bbdb/gnus-summary-prefer-real-names t)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+  (setq bbdb-auto-notes-alist
+        '(("user-agent" (".*" interface 0))
+          ("Organization"  (".*" company 0))
+          ("x-mailer" (".*" interface 0))
+          ("x-newsreader" (".*" interface 0))
+          ("X-URL"         (".*" url 0))
+          ("newsgroups" ("\\\\([^,]*\\\\),?" posted-to "\\\\1" t))
+          ("xref" ("\\\\b[^ ]+:[0-9]+.*" seen-in 0))))
+  (put 'seen-in 'field-separator "; ")
+  (put 'interface 'field-seperator "; ")
+#+END_SRC
+
+The following ensures that our bbdb entries have timestamps.
+#+BEGIN_SRC emacs-lisp
+(add-hook 'bbdb-create-hook 'bbdb-creation-date-hook)
+(add-hook 'bbdb-change-hook 'bbdb-timestamp-hook)
+#+END_SRC
+
+** message-utils, message-x
+#+BEGIN_SRC emacs-lisp
+(autoload 'message-mark-inserted-region "message-utils" nil t)
+(autoload 'message-mark-insert-file "message-utils" nil t)
+(autoload 'message-strip-subject-was "message-utils" nil t)
+(autoload 'message-change-subject "message-utils" nil t)
+(autoload 'message-xpost-fup2 "message-utils" nil t)
+(autoload 'message-add-archive-header "message-utils" nil t)
+(autoload 'message-reduce-to-to-cc "message-utils" nil t)
+(define-key message-mode-map '[(control c) m] 'message-mark-inserted-region)
+(define-key message-mode-map '[(control c) f] 'message-mark-insert-file)
+(define-key message-mode-map '[(control c) x] 'message-xpost-fup2)
+(define-key message-mode-map '[(control c) s] 'message-change-subject)
+(define-key message-mode-map '[(control c) a] 'message-add-archive-header)
+(define-key message-mode-map '[(control c) t] 'message-reduce-to-to-cc)
+(add-hook 'message-header-setup-hook 'message-strip-subject-was)
+(add-hook 'message-setup-hook 'message-utils-setup)
+#+END_SRC
+
+#+BEGIN_SRC emacs-lisp
+  (require 'message-x)
+  (setq message-x-body-function '(lambda () (interactive) (hippie-expand nil)))
+#+END_SRC
+** footnote                                                          :FIXME:
+This might be entirely replac(ed|able) by org-modes footnote handling.
+#+BEGIN_SRC emacs-lisp
+(require 'footnote)
+(setq footnote-body-tag-spacing 1
+      footnote-spaced-footnotes nil
+      footnote-style 'numeric-latin
+      footnote-section-tag "Fussnoten: ")
+(add-hook 'message-mode-hook 'footnote-mode)
+#+END_SRC
+
+** smiley
+#+BEGIN_SRC emacs-lisp
+(require 'smiley)
+(setq gnus-treat-display-smileys t)
+(setq smiley-flesh-color "Yellow")
+#+END_SRC
+** org-mode
+#+BEGIN_SRC emacs-lisp
+(add-hook 'message-mode-hook 'orgstruct++-mode 'append)
+(add-hook 'message-mode-hook 'orgtbl-mode 'append)
+;(require 'org-mime)
+;(add-hook 'message-mode-hook
+;          '(lambda () (local-set-key (kbd "C-c M-o") 'org-mime-htmlize))
+;          'append)
+#+END_SRC
+** random-sig
+#+BEGIN_SRC emacs-lisp
+(require 'randomsig)
+(define-key message-mode-map (kbd "C-c s") 'randomsig-replace-sig)
+(define-key message-mode-map (kbd "C-c S") 'randomsig-select-sig)
+(require 'gnus-sum) ; probably required for `gnus-summary-save-map'
+(define-key gnus-summary-save-map "-" 'gnus/randomsig-summary-read-sig)
+(setq randomsig-dir "/home/joerg/sigs")
+(setq message-signature 'randomsig-signature)
+#+END_SRC
+
+** sieve
+#+BEGIN_SRC emacs-lisp
+(require 'sieve)
+(setq auto-mode-alist (cons '("\\.siv\\'" . sieve-mode) auto-mode-alist))
+(require 'gnus-sieve)
+#+END_SRC
+
+** whatever
+#+BEGIN_SRC emacs-lisp
+(require 'gnus-BTS)
+#+END_SRC
+#+BEGIN_SRC emacs-lisp
+(require 'epg-config)
+(setq mml2015-use 'epg)
+(setq mml2015-cache-passphrase t)
+(setq mml2015-passphrase-cache-expiry '36000)
+(setq mml2015-sign-with-sender t)
+(setq gnus-message-replyencrypt t)
+(setq gnus-message-replysign t)
+(setq gnus-message-replysignencrypted t)
+(setq gnus-treat-x-pgp-sig t)
+(setq mm-verify-option 'always)
+(setq mm-decrypt-option 'always)
+(setq gnus-buttonized-mime-types '("multipart/alternative" "multipart/encrypted" "multipart/signed"))
+(setq epg-debug nil)
+
+(setq mml2015-encrypt-to-self t)
+(setq mml2015-passphrase-cache-expiry 600)
+(setq mml2015-signers (quote ("0xB12525C4")))
+(setq gnus-picon-databases (quote ("/usr/lib/picon" "/usr/local/faces" "/usr/share/picons")))
+(setq gnus-summary-muttprint-program "muttprint -x -l de -e local -2 -z 10 -c auto")
+#+END_SRC
+
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
new file mode 100644 (file)
index 0000000..a9ed1df
--- /dev/null
@@ -0,0 +1,60 @@
+;; I like to see how long it takes to "boot" emacs (usually one or two
+;; seconds), so safe the start time
+(setq emacs-load-start-time (current-time))
+
+;; Set path to (my, recent) Org-Mode version
+(add-to-list 'load-path "~/elisp/org/")
+
+;; Set up dotfiles-dir variable, for easier reference later
+(setq dotfiles-dir (expand-file-name "config" 
+                                     (file-name-directory 
+                                      (or load-file-name (buffer-file-name)))))
+
+;; I might have special configuration based on various states
+;; First we set an own variable, as system-type from emacs directly is
+;; useless. gnu/linux and gnu/kfreebsd have extra /, which is plenty annoying
+;; when you want to use them in a path entry.
+(defun jj-system-type ()
+  "Return a string depending on the OS we use"
+  (interactive)
+  (cond
+   ((eq system-type 'darwin) "macosx")
+   ((eq system-type 'gnu/linux) "linux")
+   ((eq system-type 'gnu/kfreebsd) "kfreebsd")
+   ((eq system-type 'cygwin) "cygwin")
+   ((eq system-type 'windows-nt) "windows")))
+
+;; Setup some variables for files I might want to load later.
+;; Those are config files that are specific to
+;; - the system my emacs runs on
+;; - the os emacs is on
+;; - the user name I have
+(setq jj-sys-config (concat dotfiles-dir "/" system-name ".org"))
+(setq jj-os-config (concat dotfiles-dir "/" (jj-system-type) ".org"))
+(setq jj-user-config (concat dotfiles-dir "/" user-login-name ".org"))
+
+;; As we use org-mode/org-babel/org-tangle to extract the real emacs
+;; config out of the org-mode files, we have to load that first.
+(setq org-modules (quote (org-bbdb org-bibtex org-crypt org-docview org-gnus org-id org-info org-jsinfo org-habit org-inlinetask org-irc org-protocol org-w3m org-mouse org-checklist org-notmuch icalendar)))
+(require 'org-install)
+(require 'ob-tangle)
+
+;; Now read my config
+;; Note that those files *can* include further files.
+
+;; The basic config is always loaded, no matter where we start emacs.
+(org-babel-load-file (expand-file-name "emacs.org" dotfiles-dir))
+
+;; All the others are optional We try the order of os, system, user
+;; specific files and load them, should they be there
+(if (file-exists-p jj-os-config)
+    (org-babel-load-file (expand-file-name jj-os-config dotfiles-dir)))
+(if (file-exists-p jj-sys-config)
+    (org-babel-load-file (expand-file-name jj-sys-config dotfiles-dir)))
+(if (file-exists-p jj-user-config)
+    (org-babel-load-file (expand-file-name jj-user-config dotfiles-dir)))
+
+;; Lets get a message about startup time out
+(when (require 'time-date nil t)
+  (message "Emacs startup time: %d seconds." (time-to-seconds (time-since emacs-load-start-time)))
+  )