]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
some modifications to fix issues with emacs 23.1
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 22 Oct 2014 14:05:05 +0000 (14:05 +0000)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 22 Oct 2014 14:05:05 +0000 (14:05 +0000)
Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
bba.org

diff --git a/bba.org b/bba.org
index 55b5ddfd6f3c5abac7a0fe346abbc4d807507cd5..76c3edb599dca79339cee7350a84125502fa2621 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -49,7 +49,7 @@ To be precise, this is what's in the first part of my =~/.emacs.d/init.el= (what
 If you are in need enable debugging:
 
 #+BEGIN_SRC emacs-lisp :tangle no
-;; (setq debug-on-error t)
+(setq debug-on-error t)
 #+END_SRC
 
 *** run in servermode
@@ -88,11 +88,19 @@ If you are in need enable debugging:
 *** [[http://www.emacswiki.org/emacs/ELPA][ELPA]]
 
 #+BEGIN_SRC emacs-lisp
-  (add-to-list 'load-path "~/.emacs.d/elpa")
-  (add-to-list 'load-path "~/.emacs.d/elpa/popup-20140207.1702")
-  (require 'package)
-  (package-initialize)
+    (if (= emacs-major-version 24)
+        (progn
+          (add-to-list 'load-path "~/.emacs.d/elpa")
+          (add-to-list 'load-path "~/.emacs.d/elpa/popup-20140207.1702")
+          (require 'package)
+          (package-initialize)
+          )
+      (progn
+        (add-to-list 'load-path "~/.emacs.d/elpa/magit-1.2.0")
+        (require 'magit)
+        )
 
+      )
 #+END_SRC
 
 *** smartparens-mode
@@ -100,10 +108,13 @@ Enable smart parens in all modes.
 See [[https://github.com/toctan/smartparens][Smartparens on github]].
 
 #+BEGIN_SRC emacs-lisp
-  (add-to-list 'load-path "~/.emacs.d/elpa/smartparens-20140819.203")
-  (add-to-list 'load-path "~/.emacs.d/elpa/dash-20140811.523")
-  (require 'smartparens)
-  (smartparens-global-mode 1)
+  (if (= emacs-major-version 24)
+      (progn
+        (add-to-list 'load-path "~/.emacs.d/elpa/smartparens-20140819.203")
+        (add-to-list 'load-path "~/.emacs.d/elpa/dash-20140811.523")
+        (require 'smartparens)
+        (smartparens-global-mode 1)
+        ))
 #+END_SRC
 *** yasnippet
 
@@ -245,325 +256,335 @@ javascript:location.href='org-protocol://capture:/l/'%20+%20encodeURIComponent(l
 
 
 #+BEGIN_SRC emacs-lisp
-  (require 'org-protocol)
-
-  (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
-  (define-key global-map "\C-cl" 'org-store-link)
-  (define-key global-map "\C-ca" 'org-agenda)
-  (setq org-log-done t)
-  (setq org-id-method (quote uuidgen))
-
-  (if (equal "work" (getenv "SYSENV"))
-  (setq org-agenda-files (list "~/workorg/work.org"
-                               "~/org/notes.org"
-                               "~/org/emacs.org"
-                               "~/org/private.org"
-                               "~/org/it.org"
-                               "~/org/refile.org"
-                               "~/org/workhours.org"
-                               ))
-  (setq org-agenda-files (list "~/org/work.org"
-                               "~/org/notes.org"
-                               "~/org/emacs.org"
-                               "~/org/private.org"
-                               "~/org/it.org"
-                               "~/org/refile.org"
-                               "~/org/workhours.org"
-                               ))
-  )
+    (require 'org-protocol)
 
-  ; Some initial languages we want org-babel to support
-  (org-babel-do-load-languages
-   'org-babel-load-languages
-   '(
-     (sh . t)
-     (python . t)
-     (R . t)
-     (ruby . t)
-     (ditaa . t)
-     (dot . t)
-     (octave . t)
-     (sqlite . t)
-     (perl . t)
-     ))
-
-  ;;(setq org-html-preamble nil
-  ;;     org-html-postamble nil
-  ;;      org-html-head "")
-
-  ;; (setq org-html-preamble nil
-  ;;       org-html-postamble nil
-  ;;       org-html-include-default-style nil
-  ;;       org-html-head ""
-  ;;       org-export-html-with-timestamp nil
-  ;;       org-export-html-style "body-only"
-  ;; )
-  ;; body-only option ?
+    (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
+    (define-key global-map "\C-cl" 'org-store-link)
+    (define-key global-map "\C-ca" 'org-agenda)
+    (setq org-log-done t)
+    (setq org-id-method (quote uuidgen))
+
+    (if (equal "work" (getenv "SYSENV"))
+    (setq org-agenda-files (list "~/workorg/work.org"
+                                 "~/org/notes.org"
+                                 "~/org/emacs.org"
+                                 "~/org/private.org"
+                                 "~/org/it.org"
+                                 "~/org/refile.org"
+                                 "~/org/workhours.org"
+                                 ))
+    (setq org-agenda-files (list "~/org/work.org"
+                                 "~/org/notes.org"
+                                 "~/org/emacs.org"
+                                 "~/org/private.org"
+                                 "~/org/it.org"
+                                 "~/org/refile.org"
+                                 "~/org/workhours.org"
+                                 ))
+    )
+
+    ; Some initial languages we want org-babel to support
+    (org-babel-do-load-languages
+     'org-babel-load-languages
+     '(
+       (sh . t)
+       (python . t)
+       (R . t)
+       (ruby . t)
+       (ditaa . t)
+       (dot . t)
+       (octave . t)
+       (sqlite . t)
+       (perl . t)
+       ))
+
+    ;;(setq org-html-preamble nil
+    ;;     org-html-postamble nil
+    ;;      org-html-head "")
+
+    ;; (setq org-html-preamble nil
+    ;;       org-html-postamble nil
+    ;;       org-html-include-default-style nil
+    ;;       org-html-head ""
+    ;;       org-export-html-with-timestamp nil
+    ;;       org-export-html-style "body-only"
+    ;; )
+    ;; body-only option ?
 
-  ;; (setq html (org-export-as-html 3 nil nil 1))
+    ;; (setq html (org-export-as-html 3 nil nil 1))
 
 
 
-  (global-set-key (kbd "C-c <f5>") '(lambda () (interactive) (find-file "~/org/notes.org")))
+    (global-set-key (kbd "C-c <f5>") '(lambda () (interactive) (find-file "~/org/notes.org")))
 
-  (global-set-key (kbd "C-c <f7>") '(lambda () (interactive) (find-file "~/org/private.org")))
+    (global-set-key (kbd "C-c <f7>") '(lambda () (interactive) (find-file "~/org/private.org")))
 
-  (if (equal "work" (getenv "SYSENV"))
+    (if (equal "work" (getenv "SYSENV"))
+        (progn
+          (global-set-key (kbd "C-c <f6>") '(lambda () (interactive) (find-file "~/workorg/work.org")))
+          (global-set-key (kbd "C-c <f8>") '(lambda () (interactive) (find-file "~/workorg/workhours.org")))
+          )
       (progn
-        (global-set-key (kbd "C-c <f6>") '(lambda () (interactive) (find-file "~/workorg/work.org")))
-        (global-set-key (kbd "C-c <f8>") '(lambda () (interactive) (find-file "~/workorg/workhours.org")))
-        )
-    (progn
-      (global-set-key (kbd "C-c <f6>") '(lambda () (interactive) (find-file "~/org/work.org")))
-      (global-set-key (kbd "C-c <f8>") '(lambda () (interactive) (find-file "~/org/workhours.org")))))
-
-
-
-
-  (global-set-key (kbd "C-c <f9>") '(lambda () (interactive) (find-file "~/org/emacs.org")))
-
-  ;; (setq org-clock-persist 'history)
-  (org-clock-persistence-insinuate)
-  (setq org-clock-persist t)
-  (setq org-default-notes-file (concat org-directory "/refile.org"))
-  (define-key global-map "\C-cc" 'org-capture)
-
-  (setq org-capture-templates
-
-  '(("t" "todo" entry (file+headline "~/org/refile.org" "Tasks")
-  "* TODO %?\n%U\n
-
-  %i\n
-  %a")
-
-    ("m" "Meeting" entry (file "~/git/org/refile.org")
-     "* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
-
-    ("n" "note" entry (file+headline "~/org/refile.org" "Note")
-     "* NOTE %?\n%U\n
-
-  %i\n
-  %a")
-
-  ("j" "Journal" entry (file+datetree "~/git/org/diary.org")
-   "* %?\n%U\n" :clock-in t :clock-resume t)
-
-  ("l" "Links (it)" entry (file+headline "~/org/refile.org" "Links")
-  "** %c\n\n  %u\n  %i"
-           :empty-lines 1)
-
-  ))
-
-  (setq org-link-abbrev-alist '(
-  ("bing" . "http://www.bing.com/search?q=%sform=OSDSRC")
-  ("cpan" . "http://search.cpan.org/search?query=%s&mode=all")
-  ("google" . "http://www.google.com/search?q=")
-  ("gmap" . "http://maps.google.com/maps?q=%s")
-  ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
-  ("bmap" . "http://www.bing.com/maps/default.aspx?q=%s&mkt=en&FORM=HDRSC4")
-  ("wiki" . "http://en.wikipedia.org/wiki/")
-  ("rfc" . "http://tools.ietf.org/rfc/rfc%s.txt")
-  ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")
-  ))
-  ;; example: [[bmap:space needle]]
-
-
-  ;; taken from http://doc.norang.ca/org-mode.org :
-
-  ;;
-  ;; Resume clocking task when emacs is restarted
-  (org-clock-persistence-insinuate)
-  ;;
-  ;; Show lot of clocking history so it's easy to pick items off the C-F11 list
-  (setq org-clock-history-length 23)
-  ;; 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 t)
-  ;; 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)
-  (setq org-time-clocksum-format
-        '(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
-  (setq bh/keep-clock-running nil)
-
-  (defun bh/clock-in-to-next (kw)
-    "Switch a task from TODO to NEXT when clocking in.
-  Skips capture tasks, projects, and subprojects.
-  Switch projects and subprojects from NEXT back to TODO"
-    (when (not (and (boundp 'org-capture-mode) org-capture-mode))
-      (cond
-       ((and (member (org-get-todo-state) (list "TODO"))
-             (bh/is-task-p))
-        "NEXT")
-       ((and (member (org-get-todo-state) (list "NEXT"))
-             (bh/is-project-p))
-        "TODO"))))
-
-  (defun bh/find-project-task ()
-    "Move point to the parent (project) task if any"
-    (save-restriction
-      (widen)
-      (let ((parent-task (save-excursion (org-back-to-heading 'invisible-ok) (point))))
-        (while (org-up-heading-safe)
-          (when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
-            (setq parent-task (point))))
-        (goto-char parent-task)
-        parent-task)))
-
-  (defun bh/punch-in (arg)
-    "Start continuous clocking and set the default task to the
-  selected task.  If no task is selected set the Organization task
-  as the default task."
-    (interactive "p")
-    (setq bh/keep-clock-running t)
-    (if (equal major-mode 'org-agenda-mode)
-        ;;
-        ;; We're in the agenda
-        ;;
-        (let* ((marker (org-get-at-bol 'org-hd-marker))
-               (tags (org-with-point-at marker (org-get-tags-at))))
-          (if (and (eq arg 4) tags)
-              (org-agenda-clock-in '(16))
-            (bh/clock-in-organization-task-as-default)))
-      ;;
-      ;; We are not in the agenda
-      ;;
-      (save-restriction
-        (widen)
-        ; Find the tags on the current task
-        (if (and (equal major-mode 'org-mode) (not (org-before-first-heading-p)) (eq arg 4))
-            (org-clock-in '(16))
-          (bh/clock-in-organization-task-as-default)))))
+        (global-set-key (kbd "C-c <f6>") '(lambda () (interactive) (find-file "~/org/work.org")))
+        (global-set-key (kbd "C-c <f8>") '(lambda () (interactive) (find-file "~/org/workhours.org")))))
 
-  (defun bh/punch-out ()
-    (interactive)
+
+
+
+    (global-set-key (kbd "C-c <f9>") '(lambda () (interactive) (find-file "~/org/emacs.org")))
+
+    ;; (setq org-clock-persist 'history)
+    (org-clock-persistence-insinuate)
+    (setq org-clock-persist t)
+    (setq org-default-notes-file (concat org-directory "/refile.org"))
+    (define-key global-map "\C-cc" 'org-capture)
+
+    (setq org-capture-templates
+
+    '(("t" "todo" entry (file+headline "~/org/refile.org" "Tasks")
+    "* TODO %?\n%U\n
+
+    %i\n
+    %a")
+
+      ("m" "Meeting" entry (file "~/git/org/refile.org")
+       "* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
+
+      ("n" "note" entry (file+headline "~/org/refile.org" "Note")
+       "* NOTE %?\n%U\n
+
+    %i\n
+    %a")
+
+    ("j" "Journal" entry (file+datetree "~/git/org/diary.org")
+     "* %?\n%U\n" :clock-in t :clock-resume t)
+
+    ("l" "Links (it)" entry (file+headline "~/org/refile.org" "Links")
+    "** %c\n\n  %u\n  %i"
+             :empty-lines 1)
+
+    ))
+
+    (setq org-link-abbrev-alist '(
+    ("bing" . "http://www.bing.com/search?q=%sform=OSDSRC")
+    ("cpan" . "http://search.cpan.org/search?query=%s&mode=all")
+    ("google" . "http://www.google.com/search?q=")
+    ("gmap" . "http://maps.google.com/maps?q=%s")
+    ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
+    ("bmap" . "http://www.bing.com/maps/default.aspx?q=%s&mkt=en&FORM=HDRSC4")
+    ("wiki" . "http://en.wikipedia.org/wiki/")
+    ("rfc" . "http://tools.ietf.org/rfc/rfc%s.txt")
+    ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")
+    ))
+    ;; example: [[bmap:space needle]]
+
+
+    ;; taken from http://doc.norang.ca/org-mode.org :
+
+    ;;
+    ;; Resume clocking task when emacs is restarted
+    (org-clock-persistence-insinuate)
+    ;;
+    ;; Show lot of clocking history so it's easy to pick items off the C-F11 list
+    (setq org-clock-history-length 23)
+    ;; 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 t)
+    ;; 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)
+    (setq org-time-clocksum-format
+          '(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
     (setq bh/keep-clock-running nil)
-    (when (org-clock-is-active)
-      (org-clock-out))
-    (org-agenda-remove-restriction-lock))
-
-  (defun bh/clock-in-default-task ()
-    (save-excursion
-      (org-with-point-at org-clock-default-task
-        (org-clock-in))))
-
-  (defun bh/clock-in-parent-task ()
-    "Move point to the parent (project) task if any and clock in"
-    (let ((parent-task))
-      (save-excursion
-        (save-restriction
-          (widen)
-          (while (and (not parent-task) (org-up-heading-safe))
+
+    (defun bh/clock-in-to-next (kw)
+      "Switch a task from TODO to NEXT when clocking in.
+    Skips capture tasks, projects, and subprojects.
+    Switch projects and subprojects from NEXT back to TODO"
+      (when (not (and (boundp 'org-capture-mode) org-capture-mode))
+        (cond
+         ((and (member (org-get-todo-state) (list "TODO"))
+               (bh/is-task-p))
+          "NEXT")
+         ((and (member (org-get-todo-state) (list "NEXT"))
+               (bh/is-project-p))
+          "TODO"))))
+
+    (defun bh/find-project-task ()
+      "Move point to the parent (project) task if any"
+      (save-restriction
+        (widen)
+        (let ((parent-task (save-excursion (org-back-to-heading 'invisible-ok) (point))))
+          (while (org-up-heading-safe)
             (when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
               (setq parent-task (point))))
-          (if parent-task
-              (org-with-point-at parent-task
-                (org-clock-in))
-            (when bh/keep-clock-running
-              (bh/clock-in-default-task)))))))
+          (goto-char parent-task)
+          parent-task)))
+
+    (defun bh/punch-in (arg)
+      "Start continuous clocking and set the default task to the
+    selected task.  If no task is selected set the Organization task
+    as the default task."
+      (interactive "p")
+      (setq bh/keep-clock-running t)
+      (if (equal major-mode 'org-agenda-mode)
+          ;;
+          ;; We're in the agenda
+          ;;
+          (let* ((marker (org-get-at-bol 'org-hd-marker))
+                 (tags (org-with-point-at marker (org-get-tags-at))))
+            (if (and (eq arg 4) tags)
+                (org-agenda-clock-in '(16))
+              (bh/clock-in-organization-task-as-default)))
+        ;;
+        ;; We are not in the agenda
+        ;;
+        (save-restriction
+          (widen)
+          ; Find the tags on the current task
+          (if (and (equal major-mode 'org-mode) (not (org-before-first-heading-p)) (eq arg 4))
+              (org-clock-in '(16))
+            (bh/clock-in-organization-task-as-default)))))
 
-  ;; (defvar bh/organization-task-id "eb155a82-92b2-4f25-a3c6-0304591af2f9")
-  (defvar bh/organization-task-id "20140625-424242-424242")
+    (defun bh/punch-out ()
+      (interactive)
+      (setq bh/keep-clock-running nil)
+      (when (org-clock-is-active)
+        (org-clock-out))
+      (org-agenda-remove-restriction-lock))
 
-  (defun bh/clock-in-organization-task-as-default ()
-    (interactive)
-    (org-with-point-at (org-id-find bh/organization-task-id 'marker)
-      (org-clock-in '(16))))
+    (defun bh/clock-in-default-task ()
+      (save-excursion
+        (org-with-point-at org-clock-default-task
+          (org-clock-in))))
+
+    (defun bh/clock-in-parent-task ()
+      "Move point to the parent (project) task if any and clock in"
+      (let ((parent-task))
+        (save-excursion
+          (save-restriction
+            (widen)
+            (while (and (not parent-task) (org-up-heading-safe))
+              (when (member (nth 2 (org-heading-components)) org-todo-keywords-1)
+                (setq parent-task (point))))
+            (if parent-task
+                (org-with-point-at parent-task
+                  (org-clock-in))
+              (when bh/keep-clock-running
+                (bh/clock-in-default-task)))))))
+
+    ;; (defvar bh/organization-task-id "eb155a82-92b2-4f25-a3c6-0304591af2f9")
+    (defvar bh/organization-task-id "20140625-424242-424242")
+
+    (defun bh/clock-in-organization-task-as-default ()
+      (interactive)
+      (org-with-point-at (org-id-find bh/organization-task-id 'marker)
+        (org-clock-in '(16))))
 
-  (defun bh/clock-out-maybe ()
-    (when (and bh/keep-clock-running
-               (not org-clock-clocking-in)
-               (marker-buffer org-clock-default-task)
-               (not org-clock-resolving-clocks-due-to-idleness))
-      (bh/clock-in-parent-task)))
+    (defun bh/clock-out-maybe ()
+      (when (and bh/keep-clock-running
+                 (not org-clock-clocking-in)
+                 (marker-buffer org-clock-default-task)
+                 (not org-clock-resolving-clocks-due-to-idleness))
+        (bh/clock-in-parent-task)))
 
-  (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
+    (add-hook 'org-clock-out-hook 'bh/clock-out-maybe 'append)
 
-  (defvar bh/insert-inactive-timestamp t)
+    (defvar bh/insert-inactive-timestamp t)
 
-  (defun bh/toggle-insert-inactive-timestamp ()
-    (interactive)
-    (setq bh/insert-inactive-timestamp (not bh/insert-inactive-timestamp))
-    (message "Heading timestamps are %s" (if bh/insert-inactive-timestamp "ON" "OFF")))
+    (defun bh/toggle-insert-inactive-timestamp ()
+      (interactive)
+      (setq bh/insert-inactive-timestamp (not bh/insert-inactive-timestamp))
+      (message "Heading timestamps are %s" (if bh/insert-inactive-timestamp "ON" "OFF")))
 
-  (defun bh/insert-inactive-timestamp ()
-    (interactive)
-    (org-insert-time-stamp nil t t nil nil nil))
+    (defun bh/insert-inactive-timestamp ()
+      (interactive)
+      (org-insert-time-stamp nil t t nil nil nil))
 
-  (defun bh/insert-heading-inactive-timestamp ()
-    (save-excursion
-      (when bh/insert-inactive-timestamp
-        (org-return)
-        (org-cycle)
-        (bh/insert-inactive-timestamp))))
+    (defun bh/insert-heading-inactive-timestamp ()
+      (save-excursion
+        (when bh/insert-inactive-timestamp
+          (org-return)
+          (org-cycle)
+          (bh/insert-inactive-timestamp))))
 
-  (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp 'append)
+    (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp 'append)
 
-  ; 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))))
+    ; 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)
+    ; 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)
+    ; 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))
+    ; 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 ido-everywhere t)
-  (setq ido-max-directory-size 100000)
-  (ido-mode (quote both))
-  ; Use the current window when visiting files and buffers with ido
-  (setq ido-default-file-method 'selected-window)
-  (setq ido-default-buffer-method 'selected-window)
-  ; Use the current window for indirect buffer display
-  (setq org-indirect-buffer-display 'current-window)
+    ; Use IDO for both buffer and file completion and ido-everywhere to t
+    (setq org-completion-use-ido t)
+    (setq ido-everywhere t)
+    (setq ido-max-directory-size 100000)
+    (ido-mode (quote both))
+    ; Use the current window when visiting files and buffers with ido
+    (setq ido-default-file-method 'selected-window)
+    (setq ido-default-buffer-method 'selected-window)
+    ; Use the current window for indirect buffer display
+    (setq org-indirect-buffer-display 'current-window)
 
-  ;;;; Refile settings
-  ; Exclude DONE state tasks from refile targets
-  (defun bh/verify-refile-target ()
-    "Exclude todo keywords with a done state from refile targets"
-    (not (member (nth 2 (org-heading-components)) org-done-keywords)))
+    ;;;; Refile settings
+    ; Exclude DONE state tasks from refile targets
+    (defun bh/verify-refile-target ()
+      "Exclude todo keywords with a done state from refile targets"
+      (not (member (nth 2 (org-heading-components)) org-done-keywords)))
 
-  (setq org-refile-target-verify-function 'bh/verify-refile-target)
+    (setq org-refile-target-verify-function 'bh/verify-refile-target)
 
 
-  (global-set-key (kbd "<f12>") 'org-agenda)
-  (global-set-key (kbd "<f9> c") 'calendar)
-  (global-set-key (kbd "<f9> I") 'bh/punch-in)
-  (global-set-key (kbd "<f9> O") 'bh/punch-out)
-  (global-set-key (kbd "<f9> t") 'bh/insert-inactive-timestamp)
-  (global-set-key (kbd "<f9> T") 'bh/toggle-insert-inactive-timestamp)
-  (global-set-key (kbd "C-<f9>") 'previous-buffer)
-  (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 "<f12>") 'org-agenda)
+    (global-set-key (kbd "<f9> c") 'calendar)
+    (global-set-key (kbd "<f9> I") 'bh/punch-in)
+    (global-set-key (kbd "<f9> O") 'bh/punch-out)
+    (global-set-key (kbd "<f9> t") 'bh/insert-inactive-timestamp)
+    (global-set-key (kbd "<f9> T") 'bh/toggle-insert-inactive-timestamp)
+    (global-set-key (kbd "C-<f9>") 'previous-buffer)
+    (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)
 
 
 
-  (add-hook 'org-mode-hook
-    (lambda ()
-      (auto-fill-mode)
-      (flyspell-mode)
-      ))
+  (if (= emacs-major-version 24)
+      (progn
+        (add-hook 'org-mode-hook
+                  (lambda ()
+                    (auto-fill-mode)
+                    (flyspell-mode)
+                    ))
+        )
+    (progn
+      (add-hook 'org-mode-hook
+                (lambda ()
+                  (auto-fill-mode))
+                ))
+
+    )
 
 
 #+END_SRC