C
Back - Home

Richard Riley's web site (inprogress)

Dotorg

My Org-Mode configuration

This is pending a clean out and better commenting.

;;;;;
;************************************************
; rgr-org.el
;
; org-mode config
; Richard Riley.
;************************************************

(setq load-path
      (append (list nil
                    "~/.emacs.d/lisp/org-mode/lisp"
                    )
              load-path))

(require 'org-install)
(require 'org-annotation-helper)

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cr" 'org-remember)
(global-set-key "\C-cb" 'org-iswitchb)


(setq diary-file "~/.emacs.d/.diary"
      appt-display-diary nil
      calendar-view-diary-initially-flag nil
      mark-diary-entries-incalendar t
      diary-number-of-entries 7
)

(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))

(global-font-lock-mode 1)                     ; for all buffers
(add-hook 'org-mode-hook 'turn-on-font-lock)  ; Org buffers only

(setq org-directory "~/.emacs.d/org-files"
      org-agenda-show-inherited-tags t
      org-agenda-files (quote ("~/.emacs.d/org-files"))
      org-publish-timestamp-directory "~/.emacs.d/org-files/.org-timestamps/"
      org-publish-use-timestamps-flag nil
      org-agenda-start-with-follow-mode nil
      org-startup-folded nil
      org-clock-in-switch-to-state "STARTED"
      org-agenda-include-diary nil
      org-combined-agenda-icalendar-file "~/webs/richardriley/sync/org.ics"
      org-icalendar-include-todo t
      org-icalendar-combined-name (quote "Richard Riley ORG")
      org-icalendar-use-scheduled '(todo-due  event-if-todo event-if-not-todo)
      org-icalendar-use-deadline '(todo-due event-if-todo event-if-not-todo)
      org-icalendar-timezone "Europe/Berlin"
      org-icalendar-include-bbdb-anniversaries t
      org-icalendar-store-UID t
      org-use-property-inheritance t
      org-log-done '(state)
      org-tab-follows-link t
      org-return-follows-link t
      org-tags-match-list-sublevels t
      org-default-notes-file "refile.org"
      org-remember-store-without-prompt t
      org-agenda-ndays 7
      org-deadline-warning-days 14
      org-completion-use-ido t
      org-agenda-show-all-dates t
      org-agenda-skip-deadline-if-done t
      org-agenda-skip-scheduled-if-done t
      org-agenda-start-on-weekday nil
      org-reverse-note-order t
      org-refile-targets (quote ((org-agenda-files :maxlevel . 5) (nil :maxlevel . 5)))
      org-refile-use-outline-path (quote file)
      org-outline-path-complete-in-steps t
      org-use-fast-todo-selection t
      org-fast-tag-selection-single-key (quote expert)

      org-tag-alist '(
                      (:startgroup . nil) ("@Shamrock" . ?S) ("@Home" . ?H) ("@Dublin" . ?D) (:endgroup . nil) 
                      (:startgroup . nil) ("Online" . ?O) ("Offline" . ?F) (:endgroup . nil) 
                      (:startgroup . nil) ("Business" . ?B) ("Personal" . ?P) (:endgroup . nil) 
                      ("shopping" . ?s) ("general" . ?g) 
                      ("emacs" . ?e)("VOCAB" . ?v)("coding" . ?c) ("webs". ?w) ("idea" . ?i) ("leisure" . ?l)
                      )

      org-agenda-custom-commands 
      (quote (("P" "Projects" tags "PROJECT" ((org-use-tag-inheritance nil)))
              ("s" "Started Tasks" todo "STARTED" ((org-agenda-todo-ignore-with-date nil)))
              ("w" "Tasks waiting on something" tags "WAITING" ((org-use-tag-inheritance nil)))
              ("r" "Refile New Notes and Tasks" tags "REFILE" ((org-agenda-todo-ignore-with-date nil)))
              ("v" "Vocab" tags "VOCAB" ((org-agenda-filter-preset '("+VOCAB"))(org-agenda-todo-ignore-with-date nil)))
              ("j" "Journal" tags "JOURNAL" ((org-use-tag-inheritance t)))
              ("n" "Notes" tags "NOTE" nil)))

      org-remember-templates
      (quote (
              ("todo" ?t "* TODO %?\n  %u\n  %a" nil bottom nil)
              ("vocab" ?v "** TODO Learn %(rgr/orig-word)\t:VOCAB:\n:TRANSLATION:\n:orig:\t%(rgr/orig-word)\n:trans:\t%(rgr/trans-word)\n:from:\t%(rgr/from-lang)\n:to:\t%(rgr/to-lang)\n:END:\n%!" "vocab.org" bottom)
              ("note" ?n "* %?                                        :NOTE:\n  %u\n  %a" nil bottom nil)
              ("phone" ?p "* PHONE Name:%^{name} - Company:%^{company} -                :PHONE:\n  Contact Info: %a\n  %u\n  :CLOCK-IN:\n  %?" nil bottom nil)
              ("register" ?r "* %U Register %^{Firm}p %^{Link} %^{Description}p\n  %^C" nil bottom nil)
              ("Journal" ?j "* %U %?" "journal.org")          
              )
             )
      )

;;(setq org-agenda-filter-preset '("-VOCAB"))

(setq org-clock-persist t)
(org-clock-persistence-insinuate)

(setq org-todo-keywords (quote ((sequence "TODO(t)" "STARTED(s)" "|" "DONE(d!/!)")
 (sequence "WAITING(w@/!)" "SOMEDAY(S!)" "PROJECT(P@)" "OPEN(O@)" "|" "CANCELLED(c@/!)")
 (sequence "QUOTE(q!)" "QUOTED(Q!)" "|" "APPROVED(A@)" "EXPIRED(E@)" "REJECTED(R@)"))))
(setq org-todo-keyword-faces (quote (("TODO" :foreground "red" :weight bold)
 ("STARTED" :foreground "blue" :weight bold)
 ("DONE" :foreground "forest green" :weight bold)
 ("WAITING" :foreground "orange" :weight bold)
 ("SOMEDAY" :foreground "magenta" :weight bold)
 ("CANCELLED" :foreground "forest green" :weight bold)
 ("QUOTE" :foreground "red" :weight bold)
 ("QUOTED" :foreground "magenta" :weight bold)
 ("APPROVED" :foreground "forest green" :weight bold)
 ("EXPIRED" :foreground "forest green" :weight bold)
 ("REJECTED" :foreground "forest green" :weight bold)
 ("OPEN" :foreground "blue" :weight bold)
 ("PROJECT" :foreground "red" :weight bold))))

(setq org-todo-state-tags-triggers
      (quote (("CANCELLED" ("CANCELLED" . t))
              ("WAITING" ("WAITING" . t) ("NEXT"))
              ("SOMEDAY" ("WAITING" . t))
              (done ("NEXT") ("WAITING"))
              ("TODO" ("WAITING") ("CANCELLED"))
              ("STARTED" ("WAITING"))
              ("PROJECT" ("CANCELLED") ("PROJECT" . t)))))

(setq org-export-run-in-background nil)

(load-file "~/.emacs.d/.webvars")

(setq org-publish-project-alist
      `(
        ("web-org"
         :base-directory ,"~/webs/richardriley"
         :publishing-directory ,"~/webs/richardriley"
         :recursive t
         :base-extension "org"
         :publishing-function org-publish-org-to-html
         :section-numbers nil
         :style "<link rel='stylesheet'
                     href=\"./style.css\"
                     type=\"text/css\"/>"
         :auto-preamble t
         :auto-postamble t
         :preamble "<div id='photo'><a href='http://splash-of-open-sauce.blogspot.com'><img src='http://richardriley.net/images/me.gif' alt='C'est Moi'/></a></div><a href='../'>Back</a> - <a href='http://www.richardriley.net'>Home</a><p>Richard Riley's web site (inprogress)</p>"
         :postamble "<div id='hosted'><table><tr><td><img src='http://richardriley.net/images/debian-logo' title='Hosted on Debian Linux' alt='Hosted On Debian Linux' style='width:48px;'/></td><td><img src='http://richardriley.net/images/apache-logo' alt='Served Using Apache2' title ='Served Using Apache2' style='width:48px;'/></td></tr></table></div>"
         :author nil
         ) 
        ("rgrweb"
         :components("web-org")
         :base-directory ,"~/webs/richardriley"
         :publishing-directory ,"~/webs/richardriley"
         :recursive t
         )
        )
      )

(org-remember-insinuate)
(add-hook 'remember-mode-hook 'org-remember-apply-template)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; For org appointment reminders

;;;###autoload
(defun zenity-display (min-to-app new-time msg)      
  "modal display dialog using zenity"
  (interactive "MInput string to display using Zenity:")
  (save-window-excursion (shell-command (concat 
    "/usr/bin/zenity --info --title='Appointment' --text='" msg "' &"
    ) nil nil)
))

; 5 minute warnings
(setq appt-message-warning-time '15)
(setq appt-display-interval '10)

; Update appt each time agenda opened.
(add-hook 'org-finalize-agenda-hook 'org-agenda-to-appt)

(when window-system

  (setq appt-display-format 'window)
  
;;;###autoload
  (defun rgr/org-display (min-to-app new-time msg)
          (shell-command (concat "notify-send"
                                 " -i " "~/images/clock.png"
                                 " -t " (int-to-string 20000)
                                 " " msg)))
  
  (setq appt-disp-window-function (function rgr/org-display)))

(require 'diary-lib)
(setq  diary-display-function 'fancy-diary-display)

;; ;; Run once, activate and schedule refresh
;; (run-at-time nil 300 'org-agenda-to-appt)
;; (appt-activate t)

;; inline images in org files
;;iimage
(require 'iimage)
(setq iimage-mode-image-search-path (expand-file-name "~/"))
;;Match org file: links
(add-to-list 'iimage-mode-image-regex-alist
            (cons (concat "\\[\\[file:\\(~?" iimage-mode-image-filename-regex
                          "\\)\\]")  1))

(eval-after-load "org"
'(progn
   (define-key org-mode-map [(control c) ?i] 'iimage-mode)
   (define-key org-mode-map "\C-r" 'org-smart-reschedule)))

(eval-after-load "org-agenda"
'(progn
   (define-key org-agenda-mode-map "\C-r" 'org-agenda-smart-reschedule)))

(defface org-canceled ;; originally copied from font-lock-type-face
  (org-compatible-face nil
    '((((class color) (min-colors 16) (background light)) (:foreground "darkgrey" :bold t))
      (((class color) (min-colors 16) (background dark)) (:foreground "grey" :bold t))
      (((class color) (min-colors 8)) (:foreground "grey"))
      (t (:bold t))))
  "Face used for todo keywords that indicate DONE items."
  :group 'org-faces)

(defface org-wait ;; originally copied from font-lock-type-face
  (org-compatible-face nil
    '((((class color) (min-colors 16) (background light)) (:foreground "darkgrey" :bold t))
      (((class color) (min-colors 16) (background dark)) (:foreground "grey" :bold t))
      (((class color) (min-colors 8)) (:foreground "grey"))
      (t (:bold t))))
  "Face used for todo keywords that indicate DONE items."
  :group 'org-faces)

(defun org-bbdb-anniv-export-ical ()
 "Extract anniversaries from BBDB and convert them to icalendar format."
 (require 'bbdb)
 (require 'diary-lib)
 (unless (hash-table-p org-bbdb-anniv-hash)
   (setq org-bbdb-anniv-hash
          (make-hash-table :test 'equal :size 366)))
 (when (or org-bbdb-updated-p
           (= 0 (hash-table-count org-bbdb-anniv-hash)))
   (org-bbdb-make-anniv-hash))
 
 (defun org-bbdb-format-vevent (key recs)
   (while (setq rec (pop recs))
     (setq categ (or (nth 2 rec) org-bbdb-default-anniversary-format))
     (princ (format "BEGIN:VEVENT
UID: ANNIV-%4i%02i%02i-%s
DTSTART:%4i%02i%02i
SUMMARY:%s
DESCRIPTION:%s
CATEGORIES:%s
RRULE:FREQ=YEARLY
END:VEVENT\n"
                      (nth 0 rec) (nth 0 key) (nth 1 key)
                      (mapconcat 'identity
                                 (org-split-string (nth 1 rec) "[^a-zA-Z0-90]+")
                                 "-")
                      (nth 0 rec) (nth 0 key) (nth 1 key)
                      (concat (capitalize categ) " " (nth 1 rec))
                      (concat (capitalize categ) " " (nth 1 rec))
                      categ))))

 (maphash 'org-bbdb-format-vevent org-bbdb-anniv-hash))

(require 'org-learn)

(provide 'rgr-org)

Date: 2009-12-08 17:33:42 CET

HTML generated by org-mode 6.33trans in emacs 23

Hosted On Debian LinuxServed Using Apache2