Differences between revisions 13 and 14

Deletions are marked like this. Additions are marked like this.
Line 17: Line 17:
;; Thomas Krennwallner <tkren at nospam kr dot tuwien dot ac dot at>
;;

;;
;; setup ~/emacs/site-lisp/ as additional local elisp source for loading libs
;;
(setq load-path (cons (expand-file-name "~/emacs/site-lisp/") load-path))
;; Thomas Krennwallner <tkren at kr dot tuwien dot ac dot at>
;;

;;
;; setup PATH environment
;;
(setq exec-path (append exec-path (list "/opt/local/bin" "/usr/texbin")))
;; Beat the damn PATH into shape
(setq my-exec-path '("/opt/local/bin" "/usr/texbin"))
(map 'nil '(lambda (item) (setq exec-path (cons item exec-path))) my-exec-path)
(setenv "PATH" (mapconcat 'identity exec-path path-separator))
(setenv "DYLD_LIBRARY_PATH" (concat (getenv "HOME") "/local/lib"))


;;
;; setup ~/Documents/Emacs/site-lisp/ as additional local elisp source for loading libs
;;
(setq load-path (cons (expand-file-name "~/Documents/Emacs/site-lisp/") load-path))
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/doxymacs")
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/org-mode/lisp")
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/org-mode/contrib/lisp")
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/bbdb-2.35/lisp")
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/gnuplot-mode.0.6.0")
Line 30: Line 46:
;; owl mode
(add-to-list 'load-path "~/emacs/site-lisp/owl")
(autoload 'owl-mode "owl-mode" "OWL mode." t)
(push (cons "\\.owl" 'owl-mode) auto-mode-alist)
;; kill unused buffers after a few days
(require 'midnight)

;; Browse this kill-ring
(require 'browse-kill-ring)
(global-set-key (kbd "C-c k") 'browse-kill-ring)

;; GNU global
(autoload 'gtags-mode "gtags" "" t)

;; setup bbdb
(setq bbdb-file "~/Documents/Log/bbdb") ;; keep ~/ clean; set before loading
(require 'bbdb)
(bbdb-initialize)
(setq
 bbdb-north-american-phone-numbers-p nil ;; no strict american phone numbers
 bbdb-offer-save 1 ;; 1 means save-without-asking
 bbdb-use-pop-up t ;; allow popups for addresses
 bbdb-electric-p t ;; be disposable with SPC
 bbdb-popup-target-lines 1 ;; very small
 bbdb-dwim-net-address-allow-redundancy t ;; always use full name
 bbdb-quiet-about-name-mismatches 2 ;; show name-mismatches 2 secs
 bbdb-always-add-address t ;; add new addresses to existing...
 ;; ...contacts automatically
 bbdb-canonicalize-redundant-nets-p t ;; x@foo.bar.cx => x@bar.cx
 bbdb-completion-type nil ;; complete on anything
 bbdb-complete-name-allow-cycling t ;; cycle through matches
 ;; this only works partially
 bbbd-message-caching-enabled t ;; be fast
 bbdb-use-alternate-names t ;; use AKA
 bbdb-elided-display t ;; single-line addresses
 ;; auto-create addresses from mail
 bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook
 bbdb-ignore-some-messages-alist ;; don't ask about fake addresses
 ;; NOTE: there can be only one entry per header (such as To, From)
 ;; http://flex.ee.uec.ac.jp/texi/bbdb/bbdb_11.html
 '(( "From" . "no.?reply\\|DAEMON\\|daemon\\|facebookmail\\|twitter"))
 )


;; dired+
(require 'dired+)
(setq dired-listing-switches "-lt") ;; sort by date
;; reuse buffers
(put 'dired-find-alternate-file 'disabled nil)
(toggle-dired-find-file-reuse-dir 1)


;; automatic insertion of templates
(require 'autoinsert)
(auto-insert-mode) ;;; Adds hook to find-files-hook
(setq auto-insert-directory "~/Documents/Emacs/templates/") ;;; *NOTE* Trailing slash important
;;(setq auto-insert-query nil) ;;; If you don't want to be prompted before insertion
(define-auto-insert "\.tex" "my-latex-template.tex")
(define-auto-insert "\.cpp" "my-cpp-template.cpp")
(define-auto-insert "\.h" "my-cpp-template.h")

;; save my emacs session to .emacs.d
;;(require 'desktop)
;;(desktop-save-mode t)

;; replacement for find-file
(require 'ido)
(ido-mode t)

;; replacement for switch-buffer C-x b
(iswitchb-mode t)

(setq
 ido-ignore-buffers ; ignore these guys
 '("\\` " "^\*Mess" "^\*Back" ".*Completion" "^\*Ido")
 ido-work-directory-list '("~/" "~/Documents")
 ido-case-fold t ; be case-insensitive
 ido-use-filename-at-point nil ; don't use filename at point (annoying)
 ido-use-url-at-point nil ; don't use url at point (annoying)
 ido-enable-flex-matching t ; be flexible
 ido-max-prospects 6 ; don't spam my minibuffer
 ido-confirm-unique-completion t) ; wait for RET, even with unique completion


;; ibuffer
(require 'ibuffer)
(setq ibuffer-default-sorting-mode 'major-mode)
(setq ibuffer-always-show-last-buffer t)
(setq ibuffer-view-ibuffer t)
(global-set-key (kbd "C-x C-b") 'ibuffer-other-window)

;; setup calendar and diary
(setq european-calendar-style t)
(setq calendar-week-start-day 1)
(setq calendar-latitude 48.146) ;; 48.146N
(setq calendar-longitude -16.263) ;; 16.263E
(setq calendar-location-name "Vienna, AT")
(setq calendar-time-zone -60)
(setq calendar-standard-time-zone-name "CET")
(setq calendar-daylight-time-zone-name "CEST")
;;(setq diary-file "~/Documents/Log/diary")
;;(appt-activate 1)


;;
;; setup org and remember mode
;;

;; This line only if Org is not part of the X/Emacs distribution.
(require 'org-install)
(require 'org-track)
(require 'org)
(require 'org-habit)
;;(require 'remember)

(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)

;; load extra austrian holidays
(load "~/Documents/Log/AustrianHolidays.el" t)
;; (setq calendar-bahai-all-holidays-flag t)
;; (setq calendar-christian-all-holidays-flag t)
;; (setq calendar-hebrew-all-holidays-flag t)
;; (setq calendar-islamic-all-holidays-flag t)

;; (setq org-agenda-include-diary nil)
(setq org-log-done 'time)
(setq org-todo-keywords
       '((sequence "TODO" "STARTED" "DELEGATED" "WAITING" "|" "DONE")))
; OFFICE(o) HOME(h) MEETING(m) PROJECT(p) READING(r) TASKS(t) CONFERENCE(c) WP(w) MILESTONE(s) TRAVEL(T)
(setq org-tag-alist '(("OFFICE" . ?o)
        ("HOME" . ?h)
        ("MEETING" . ?m)
        ("PROJECT" . ?p)
        ("READING" . ?r)
        ("TASKS" . ?t)
        ("CONFERENCE" . ?c)
        ("WORKPACKAGE" . ?w)
        ("MILESTONE" . ?s)
        ("TRAVEL" . ?T)
        )
      )
(setq org-stuck-projects
      (quote ("+LEVEL=2/-DONE"
       ("TODO" "NEXT" "NEXTACTION")
       ("TRAVEL" "CONFERENCE" "LOG" "COURSE")
       ""
       )
      )
      )
(add-hook 'org-agenda-mode-hook '(lambda () (hl-line-mode 1)))
(setq org-agenda-time-grid
      '((weekly today require-timed remove-match)
 "----------------"
 (0400 0600 0800 1000 1200 1400 1600 1800 2000 2200 2359))
      )
(setq org-agenda-sorting-strategy
      '((agenda time-up priority-down) ;; agenda should ignore category
 (todo category-keep priority-down)
 (tags category-keep priority-down)
 (search category-keep))
      )
(setq org-agenda-to-appt t) ;; add appointments to the agenda view
(setq org-agenda-window-setup 'current-window) ;; don't kill my window setup
(setq org-agenda-skip-scheduled-if-deadline-is-shown t)
(setq org-agenda-ndays 1) ;; day mode
(setq org-agenda-skip-deadline-prewarning-if-scheduled t)
;;(setq org-agenda-include-all-todo t) ;; also include global TODO list
;;(setq org-agenda-todo-ignore-scheduled t)
;;(setq org-agenda-start-with-follow-mode t) ;; follow entry
;; files that show up in the agenda view (order matters)
(setq org-agenda-files (quote (
          "~/Documents/Log/Anniversary.org"
          "~/Documents/Log/Events.org"
          "~/Documents/Log/Travelling.org"
          "~/Documents/Log/Meetings.org"
          "~/Documents/Log/mygtd.org"
          "~/Documents/Log/ResearchLog.org"
          "~/Documents/Log/notes.org"
          "~/Documents/Log/todo.org")
         )
      )

(setq org-directory "~/Documents/Log/")
(setq org-default-notes-file (concat org-directory "/notes.org"))
(setq org-track-directory "~/Documents/Emacs/site-lisp/")
(setq org-reverse-note-order t)

;; setting up remember, see also <http://orgmode.org/manual/Remember.html>.
;; (org-remember-insinuate)
;; (define-key global-map "\C-cr" 'org-remember)
;; (define-key global-map [(control meta ?r)] 'remember)
;; (add-hook 'remember-mode-hook 'org-remember-apply-template)
;; (setq org-remember-templates
;; '(("Todo" ?t "* TODO %? %^T\n" "~/Documents/Log/notes.org" "")
;; ("Schedule" ?s "* TODO %?\n SCHEDULED: %^T\n" "~/Documents/Log/notes.org" "")
;; ("Meeting" ?m "* Meeting with %? %^T\n" "~/Documents/Log/Meetings.org" "Meetings")
;; ("Log" ?l "* %^{Title} %T\n %? %i\n %a" "~/Documents/Log/ResearchLog.org" "Research Log")
;; ("Event" ?e "* %^{Event} %T\n" "~/Documents/Log/Events.org" "Events")
;; )
;; )

;; setting up org-capture
(setq org-capture-templates
      '(
 ("t" "Todo" entry (file+headline "~/Documents/Log/notes.org" "") "* TODO %? %^T
" :prepend t)
 ("s" "Schedule" entry (file+headline "~/Documents/Log/notes.org" "") "* TODO %?
  SCHEDULED: %^T
" :prepend t)
 ("m" "Meeting" entry (file+headline "~/Documents/Log/Meetings.org" "Meetings") "* Meeting with %? %^T
" :prepend t)
 ("l" "Log" entry (file+headline "~/Documents/Log/ResearchLog.org" "Research Log") "* %^{Title} %T
  %? %i
 %a" :prepend t)
 ("e" "Event" entry (file+headline "~/Documents/Log/Events.org" "Events") "* %^{Event} %T
" :prepend t)
 )
      )
(define-key global-map "\C-cr" 'org-capture)


(setq org-habit-show-habits-only-for-today nil)
;; do timeclocking
;;(timeclock-modeline-display)




;;
;; gnuplot mode
;;
;; these lines enable the use of gnuplot mode
(autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t)

;; this line automatically causes all files with the .gp extension to
;; be loaded into gnuplot mode
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))


;;
;; nxml mode
;;
(add-to-list 'auto-mode-alist
      (cons (concat "\\." (regexp-opt '("xml" "xsd" "rng" "xslt" "svg" "rss") t) "\\'")
     'nxml-mode))
(fset 'xml-mode 'nxml-mode)
(fset 'html-mode 'nxml-mode)

;;(setq nxhtml-skip-welcome t) ;; don't show welcome message

;; python-mode
;;(require 'python-mode)
;;(setq py-python-command "python2.4")

;; we want the xquery mode
;;(require 'xquery-mode)

;; ;; owl mode
;; (add-to-list 'load-path "~/Documents/Emacs/site-lisp/owl")
;; (autoload 'owl-mode "owl-mode" "OWL mode." t)
;; (push (cons "\\.owl" 'owl-mode) auto-mode-alist)
Line 36: Line 309:
(require 'ecb)
;; (require 'ecb)
;; (setq ecb-tip-of-the-day nil)

;; cedet
;;(load-file "~/Documents/Emacs/site-lisp/cedet-1.0pre7/common/cedet.el")
(require 'cedet)
(require 'semantic)
(require 'ede)
(semantic-mode)
(setq semanticdb-default-save-directory "~/.semantic")
(global-ede-mode t) ; Enable the Project management system
;;(semantic-load-enable-code-helpers) ; Enable prototype help and smart completion
;;(global-srecode-minor-mode 1) ; Enable template insertion menu
;;(semantic-load-enable-minimum-features)
;;(semantic-load-enable-excessive-code-helpers)
;;(require 'semantic-ia)
;;(require 'semantic-gcc)
;;(require 'semanticdb)
;;(global-semanticdb-minor-mode 1)
;;(require 'semanticdb-global)
;;(semanticdb-enable-gnu-global-databases 'c-mode)
;;(semanticdb-enable-gnu-global-databases 'c++-mode)
;;(semantic-add-system-include "/usr/local/include" 'c++-mode)
;;(semantic-add-system-include "/opt/local/include" 'c++-mode)

;; ;; ede
;; (ede-cpp-root-project "DLVHEX"
;; :name "DLVHEX project"
;; :file "~/Documents/TUWien/KR/software/dlvhex-svn/dlvhex/trunk/CMakeLists.txt"
;; :include-path '("/include")
;; :spp-table '(("isUnix" . "")
;; ("BOOST_TEST_DYN_LINK" . "")))
;(ede-cpp-root-project "dsat" :file "~/Documents/TUWien/KR/Work/mhex-svn/dsat/README"
; :include-path '( "/" )
; :system-include-path '( "/opt/local/include" "/usr/local/include" )
; :spp-table '( ("MOOSE" . "")
; ("CONST" . "const") )
; :spp-files '( "include/config.h" )
; )


;; ecb
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/ecb-2.40/")
;;(require 'ecb)
(require 'ecb-autoloads)
(setq ecb-tip-of-the-day nil)
(setq ecb-source-path (quote (("~/Documents/TUWien/KR" "KR")
         ("~/Documents/Software" "Software")
         )
        )
      )


;;
Line 39: Line 364:
;;
(require 'psvn)
;;(setq svn-status-svn-executable "/opt/local/bin/svn") ;; temp. fix mac os x executable
;;(setq svn-status-svn-executable "svn") ;; temp. fix mac os x executable
Line 40: Line 369:
(setq svn-status-changelog-style 'changelog)
(setq svn-status-hide-unknown t)
(setq svn-bookmark-list '(("mhex" . "~/Documents/TUWien/KR/Work/mhex-svn")
     ("reviews" . "~/Documents/Reviews")
                          ("tkren-website" . "~/Documents/TUWien/KR/Work/tkren-website")
                          ("pub" . "~/Documents/Publications")
                          ("cv" . "~/Documents/Resume/cv")
                          ("log" . "~/Documents/Log")
     ("dmcs" . "~/Documents/Software/dmcs-svn")
                          ("dlvhex" . "~/Documents/Software/dlvhex-svn")
                          ("dlvhex-semweb" . "~/Documents/Software/dlvhex-semweb-svn")
     )
      )
(global-set-key "\C-cs" 'svn-status-via-bookmark)


;;
;; DVC support
;;
;;(load-file "~/Documents/Emacs/site-lisp/dvc/dvc-load.el")
Line 42: Line 391:
(require 'tabbar)
(tabbar-mode)

;; xquery
(require 'xquery-mode)

;; haskell-mode
(setq haskell-font-lock-symbols 'unicode)
;; (require 'tabbar)
;; (tabbar-mode)

;; ;; haskell-mode
;; (setq haskell-font-lock-symbols 'unicode)


;; C(++) mode
(require 'cc-mode)
(setq c-offsets-alist '((topmost-intro-cont . 0) (topmost-intro . 0)))
;; switch between header and implementation
(setq ff-search-directories
      '("."
 "../src/*"
 "../include/*"
 "../../src/*"
 "../../include/*"
 "/usr/local/*/src/*"
 "/opt/local/include/*")
      )
(add-hook 'c-mode-common-hook
   (lambda()
     (local-set-key (kbd "C-c o") 'ff-find-other-file)
     )
   )
(add-hook 'c-mode-common-hook
   (lambda () (c-subword-mode 1))
   )
(setq c-mode-hook
          '(lambda ()
              (gtags-mode 1)
      ))

;; compile mode
(require 'compile)
(setq compilation-disable-input nil)
(setq compilation-scroll-output t)
(setq mode-compile-always-save-buffer-p t)
;; bind M-x compile to C-c c
(global-set-key "\C-cc" 'compile)
Line 53: Line 435:
Line 61: Line 442:
;; load flyspell spellchecker ;; ;; load flyspell spellchecker
Line 63: Line 444:
(setq ispell-program-name "/opt/local/bin/aspell")
(ispell-change-dictionary "en")
Line 64: Line 447:

;; let skim display the particular line in the tex file by Shift-Cmd-Click
;;(load "/opt/local/share/Documents/Emacs/site-lisp/auctex.el")
(require 'tex-site)


;; old auctex preview definitions
;; (add-hook
;; 'TeX-mode-hook
;; (lambda ()
;; (add-to-list 'TeX-output-view-style
;; '("^pdf$" "."
;; "/Applications/MyApps/Skim.app/Contents/SharedSupport/displayline %n %o %b"
;; )
;; )
;; )
;; )

(add-hook 'LaTeX-mode-hook (lambda ()
        (add-to-list 'TeX-output-view-style
       '("^pdf$" "."
         "/Applications/MyApps/Skim.app/Contents/SharedSupport/displayline %n %o %b")
       )
        )
   )

(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)


;; setup RefTeX
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
(setq reftex-plug-into-AUCTeX t)
Line 73: Line 491:
;; bind M-x goto-line to C-x g
(global-set-key "\C-xg" 'goto-line)

;; bind M-x count-matches to C-x c m
(global-set-key "\C-xcm" 'count-matches)
;; control-f11 toggles fullscreen
(global-set-key [(control f11)]
  '(lambda ()
     (interactive)
     (set-frame-parameter nil 'fullscreen
     (if (frame-parameter nil 'fullscreen) nil 'fullboth)
     )
     )
  )

;; control-tab cycles buffers
(define-key org-mode-map [(control tab)] nil)
(org-defkey org-mode-map [(control shift tab)] 'org-force-cycle-archived)
(global-set-key [(control tab)] 'bury-buffer)


(defun wc ()
  (interactive)
  (message "Word count: %s" (how-many "\\w+" (point-min) (point-max))))


;; bind M-x count-matches to C-c m
(global-set-key "\C-cm" 'count-matches)

;; bind M-x count-words-region to C-c w
(global-set-key "\C-cw" 'count-words-region)
Line 102: Line 540:
  )          )
Line 106: Line 544:
  (global-set-key "\C-xcw" 'count-words-region)


;;
;; Some fine settings
;;

;; Automatic Display Of Matching Parentheses
(show-paren-mode)

;; save my emacs session to .emacs.d (only works with emacs 22?)
(require 'desktop)
(desktop-save-mode t)


;; my working dir
(defun workdir ()
  (interactive)
  (dired "~/Documents/TUWien/KR/Work/")
  )
(defun srcdir ()
  (interactive)
  (dired "~/Documents/Software/")
  )

;; my GTD file
(defun gtd ()
  (interactive)
  (find-file "~/Documents/Log/mygtd.org")
  )

;; my research log
(defun researchlog ()
  (interactive)
  (find-file "~/Documents/Log/ResearchLog.org")
  )



;;
;; Finetuning
;;

;; my default email address
(setq user-mail-address "tkren AT NOSPAM kr DOT tuwien DOT ac DOT at")

(setq make-backup-files t)

;; wrap at 72 chars
(setq fill-column 72)

;; highlight matches expressions in the grep result
(setq grep-highlight-matches 't)

;;
(setq read-buffer-completion-ignore-case t)
(setq read-file-name-completion-ignore-case t)

;; Confirm on exit :-)
(setq confirm-kill-emacs 'y-or-n-p)

;; Automatic display of matching parentheses
(setq show-paren-mode t)
(setq blink-matching-paren)
Line 124: Line 599:
;; name and email address used when editing ChangeLogs
(setq add-log-full-name "Thomas Krennwallner")
(setq add-log-mailing-address "tkren AT NOSPAM kr DOT tuwien DOT ac DOT at")
;; keep new entries for the same file together
(setq add-log-keep-changes-together t)

;; case insensitiv search
(setq case-fold-search t)

;; utf-8 settings
(setq current-language-environment "UTF-8")
(prefer-coding-system 'utf-8)

;; display time
(display-time)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-mail-file (quote none))
(setq display-time-mode t)

(setq zoneinfo-style-world-list
      '(
 ("America/Honolulu" "Honolulu")
 ("America/Los_Angeles" "Seattle")
 ("America/New_York" "New York")
 ("Europe/London" "London")
 ("Europe/Vienna" "Vienna")
 ("Europe/Athens" "Athens")
 ("Asia/Calcutta" "Bangalore")
 ("Asia/Hanoi" "Hanoi")
 ("Asia/Tokyo" "Tokyo")
 )
      )

;; display battery status
(setq display-battery-mode t)
Line 126: Line 637:

;; name and email address used when editing ChangeLogs
(setq add-log-full-name "Thomas Krennwallner")
(setq add-log-mailing-address "tkren AT NOSPAM kr dot tuwien dot ac dot at")
;; keep new entries for the same file together
(setq add-log-keep-changes-together t)

;; case insensitiv search
(setq case-fold-search t)

(setq current-language-environment "UTF-8")

;; display time
(display-time)
(setq display-time-24hr-format t)
(setq display-time-mail-file (quote none))
(setq display-time-mode t)
;; display line number
(line-number-mode 't)
;; display size indication
(size-indication-mode 't)
Line 154: Line 652:
(transient-mark-mode t) ; make the current 'selection' visible
(transient-mark-mode t)
; delete the selection area with a keypress
(delete-selection-mode t)
Line 164: Line 665:

;; truncate long lines and don't wrap, even when horizontally split windows
(set-default 'truncate-lines t)
(setq default-truncate-lines t)
(setq truncate-partial-width-windows nil)
(setq overflow-newline-into-fringe t)
(add-hook 'org-mode-hook (lambda () (setq truncate-lines t)))

;; do not open new frames in aquamacs
(one-buffer-one-frame-mode 0)

;;; Local Variables:
;;; mode: emacs-lisp
;;; fill-column: 72
;;; End:

Emacs: Escape-Meta-Alt-Control-Shift

Since I don't want to join the editor religious war I'm not going to tell you where you might find information about the sacred editor.

See http://www.emacswiki.org/ for more information about emacs.

This is my ~/.emacs for Emacs.

;;
;; ~/.emacs
;;
;; Thomas Krennwallner <tkren at kr dot tuwien dot ac dot at>
;;

;;
;; setup PATH environment
;;
(setq exec-path (append exec-path (list "/opt/local/bin" "/usr/texbin")))
;; Beat the damn PATH into shape
(setq my-exec-path '("/opt/local/bin" "/usr/texbin"))
(map 'nil '(lambda (item) (setq exec-path (cons item exec-path))) my-exec-path)
(setenv "PATH" (mapconcat 'identity exec-path path-separator))
(setenv "DYLD_LIBRARY_PATH" (concat (getenv "HOME") "/local/lib"))


;;
;; setup ~/Documents/Emacs/site-lisp/ as additional local elisp source for loading libs
;;
(setq load-path (cons (expand-file-name "~/Documents/Emacs/site-lisp/") load-path))
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/doxymacs")
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/org-mode/lisp")
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/org-mode/contrib/lisp")
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/bbdb-2.35/lisp")
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/gnuplot-mode.0.6.0")


;;
;; setup additional packages
;;

;; kill unused buffers after a few days
(require 'midnight)

;; Browse this kill-ring
(require 'browse-kill-ring)
(global-set-key (kbd "C-c k") 'browse-kill-ring)

;; GNU global
(autoload 'gtags-mode "gtags" "" t)

;; setup bbdb
(setq bbdb-file "~/Documents/Log/bbdb")           ;; keep ~/ clean; set before loading
(require 'bbdb)
(bbdb-initialize)
(setq 
 bbdb-north-american-phone-numbers-p nil  ;; no strict american phone numbers
 bbdb-offer-save 1                        ;; 1 means save-without-asking
 bbdb-use-pop-up t                        ;; allow popups for addresses
 bbdb-electric-p t                        ;; be disposable with SPC
 bbdb-popup-target-lines  1               ;; very small
 bbdb-dwim-net-address-allow-redundancy t ;; always use full name
 bbdb-quiet-about-name-mismatches 2       ;; show name-mismatches 2 secs
 bbdb-always-add-address t                ;; add new addresses to existing...
 ;; ...contacts automatically
 bbdb-canonicalize-redundant-nets-p t     ;; x@foo.bar.cx => x@bar.cx
 bbdb-completion-type nil                 ;; complete on anything
 bbdb-complete-name-allow-cycling t       ;; cycle through matches
 ;; this only works partially
 bbbd-message-caching-enabled t           ;; be fast
 bbdb-use-alternate-names t               ;; use AKA
 bbdb-elided-display t                    ;; single-line addresses
 ;; auto-create addresses from mail
 bbdb/mail-auto-create-p 'bbdb-ignore-some-messages-hook   
 bbdb-ignore-some-messages-alist ;; don't ask about fake addresses
 ;; NOTE: there can be only one entry per header (such as To, From)
 ;; http://flex.ee.uec.ac.jp/texi/bbdb/bbdb_11.html
 '(( "From" . "no.?reply\\|DAEMON\\|daemon\\|facebookmail\\|twitter"))
 )


;; dired+
(require 'dired+)
(setq dired-listing-switches "-lt") ;; sort by date
;; reuse buffers
(put 'dired-find-alternate-file 'disabled nil)
(toggle-dired-find-file-reuse-dir 1)


;; automatic insertion of templates
(require 'autoinsert)
(auto-insert-mode)  ;;; Adds hook to find-files-hook
(setq auto-insert-directory "~/Documents/Emacs/templates/") ;;; *NOTE* Trailing slash important
;;(setq auto-insert-query nil) ;;; If you don't want to be prompted before insertion
(define-auto-insert "\.tex" "my-latex-template.tex")
(define-auto-insert "\.cpp" "my-cpp-template.cpp")
(define-auto-insert "\.h" "my-cpp-template.h")

;; save my emacs session to .emacs.d
;;(require 'desktop)
;;(desktop-save-mode t)

;; replacement for find-file
(require 'ido)
(ido-mode t)

;; replacement for switch-buffer C-x b
(iswitchb-mode t)

(setq 
 ido-ignore-buffers               ; ignore these guys
 '("\\` " "^\*Mess" "^\*Back" ".*Completion" "^\*Ido")
 ido-work-directory-list '("~/" "~/Documents")
 ido-case-fold  t                 ; be case-insensitive
 ido-use-filename-at-point nil    ; don't use filename at point (annoying)
 ido-use-url-at-point nil         ; don't use url at point (annoying)
 ido-enable-flex-matching t       ; be flexible
 ido-max-prospects 6              ; don't spam my minibuffer
 ido-confirm-unique-completion t) ; wait for RET, even with unique completion


;; ibuffer
(require 'ibuffer)
(setq ibuffer-default-sorting-mode 'major-mode)
(setq ibuffer-always-show-last-buffer t)
(setq ibuffer-view-ibuffer t)
(global-set-key (kbd "C-x C-b") 'ibuffer-other-window)

;; setup calendar and diary
(setq european-calendar-style t)
(setq calendar-week-start-day 1)
(setq calendar-latitude 48.146) ;; 48.146N
(setq calendar-longitude -16.263) ;; 16.263E
(setq calendar-location-name "Vienna, AT")
(setq calendar-time-zone -60)
(setq calendar-standard-time-zone-name "CET")
(setq calendar-daylight-time-zone-name "CEST")
;;(setq diary-file "~/Documents/Log/diary")
;;(appt-activate 1)


;;
;; setup org and remember mode
;;

;; This line only if Org is not part of the X/Emacs distribution.
(require 'org-install)
(require 'org-track)
(require 'org)
(require 'org-habit)
;;(require 'remember)

(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)

;; load extra austrian holidays
(load "~/Documents/Log/AustrianHolidays.el" t)
;; (setq calendar-bahai-all-holidays-flag t)
;; (setq calendar-christian-all-holidays-flag t)
;; (setq calendar-hebrew-all-holidays-flag t)
;; (setq calendar-islamic-all-holidays-flag t)

;; (setq org-agenda-include-diary nil)
(setq org-log-done 'time)
(setq org-todo-keywords
       '((sequence "TODO" "STARTED" "DELEGATED" "WAITING" "|" "DONE")))
; OFFICE(o) HOME(h) MEETING(m) PROJECT(p) READING(r) TASKS(t) CONFERENCE(c) WP(w) MILESTONE(s) TRAVEL(T)
(setq org-tag-alist '(("OFFICE" . ?o)
                      ("HOME" . ?h)
                      ("MEETING" . ?m)
                      ("PROJECT" . ?p)
                      ("READING" . ?r)
                      ("TASKS" . ?t)
                      ("CONFERENCE" . ?c)
                      ("WORKPACKAGE" . ?w)
                      ("MILESTONE" . ?s)
                      ("TRAVEL" . ?T)
                      )
      )
(setq org-stuck-projects
      (quote ("+LEVEL=2/-DONE"
              ("TODO" "NEXT" "NEXTACTION")
              ("TRAVEL" "CONFERENCE" "LOG" "COURSE")
              ""
              )
             )
      )
(add-hook 'org-agenda-mode-hook '(lambda () (hl-line-mode 1)))
(setq org-agenda-time-grid
      '((weekly today require-timed remove-match)
        "----------------"
        (0400 0600 0800 1000 1200 1400 1600 1800 2000 2200 2359))
      )
(setq org-agenda-sorting-strategy
      '((agenda time-up priority-down) ;; agenda should ignore category
        (todo category-keep priority-down)
        (tags category-keep priority-down)
        (search category-keep))
      )
(setq org-agenda-to-appt t) ;; add appointments to the agenda view
(setq org-agenda-window-setup 'current-window) ;; don't kill my window setup
(setq org-agenda-skip-scheduled-if-deadline-is-shown t)
(setq org-agenda-ndays 1) ;; day mode
(setq org-agenda-skip-deadline-prewarning-if-scheduled t)
;;(setq org-agenda-include-all-todo t) ;; also include global TODO list
;;(setq org-agenda-todo-ignore-scheduled t)
;;(setq org-agenda-start-with-follow-mode t) ;; follow entry
;; files that show up in the agenda view (order matters)
(setq org-agenda-files (quote (
                               "~/Documents/Log/Anniversary.org"
                               "~/Documents/Log/Events.org"
                               "~/Documents/Log/Travelling.org"
                               "~/Documents/Log/Meetings.org"
                               "~/Documents/Log/mygtd.org"
                               "~/Documents/Log/ResearchLog.org"
                               "~/Documents/Log/notes.org"
                               "~/Documents/Log/todo.org")
                              )
      )

(setq org-directory "~/Documents/Log/")
(setq org-default-notes-file (concat org-directory "/notes.org"))
(setq org-track-directory "~/Documents/Emacs/site-lisp/")
(setq org-reverse-note-order t)

;; setting up remember, see also <http://orgmode.org/manual/Remember.html>.
;; (org-remember-insinuate)
;; (define-key global-map "\C-cr" 'org-remember)
;; (define-key global-map [(control meta ?r)] 'remember)
;; (add-hook 'remember-mode-hook 'org-remember-apply-template)
;; (setq org-remember-templates
;;       '(("Todo" ?t "* TODO %? %^T\n" "~/Documents/Log/notes.org" "")
;;      ("Schedule" ?s "* TODO %?\n  SCHEDULED: %^T\n" "~/Documents/Log/notes.org" "")
;;      ("Meeting" ?m "* Meeting with %? %^T\n" "~/Documents/Log/Meetings.org" "Meetings")
;;      ("Log" ?l "* %^{Title} %T\n  %? %i\n %a" "~/Documents/Log/ResearchLog.org" "Research Log")
;;      ("Event" ?e "* %^{Event} %T\n" "~/Documents/Log/Events.org" "Events")
;;      )
;;       )

;; setting up org-capture
(setq org-capture-templates
      '(
        ("t" "Todo" entry (file+headline "~/Documents/Log/notes.org" "") "* TODO %? %^T
" :prepend t) 
        ("s" "Schedule" entry (file+headline "~/Documents/Log/notes.org" "") "* TODO %?
  SCHEDULED: %^T
" :prepend t)
        ("m" "Meeting" entry (file+headline "~/Documents/Log/Meetings.org" "Meetings") "* Meeting with %? %^T
" :prepend t)
        ("l" "Log" entry (file+headline "~/Documents/Log/ResearchLog.org" "Research Log") "* %^{Title} %T
  %? %i
 %a" :prepend t)
        ("e" "Event" entry (file+headline "~/Documents/Log/Events.org" "Events") "* %^{Event} %T
" :prepend t)
        )
      )
(define-key global-map "\C-cr" 'org-capture)


(setq org-habit-show-habits-only-for-today nil)
;; do timeclocking
;;(timeclock-modeline-display)




;;
;; gnuplot mode
;;
;; these lines enable the use of gnuplot mode
(autoload 'gnuplot-mode "gnuplot" "gnuplot major mode" t)
(autoload 'gnuplot-make-buffer "gnuplot" "open a buffer in gnuplot mode" t)

;; this line automatically causes all files with the .gp extension to
;; be loaded into gnuplot mode
(setq auto-mode-alist (append '(("\\.gp$" . gnuplot-mode)) auto-mode-alist))


;;
;; nxml mode
;;
(add-to-list 'auto-mode-alist
             (cons (concat "\\." (regexp-opt '("xml" "xsd" "rng" "xslt" "svg" "rss") t) "\\'")
                   'nxml-mode))
(fset 'xml-mode 'nxml-mode)
(fset 'html-mode 'nxml-mode)

;;(setq nxhtml-skip-welcome t) ;; don't show welcome message

;; python-mode
;;(require 'python-mode)
;;(setq py-python-command "python2.4")

;; we want the xquery mode
;;(require 'xquery-mode)

;; ;; owl mode
;; (add-to-list 'load-path "~/Documents/Emacs/site-lisp/owl")
;; (autoload 'owl-mode "owl-mode" "OWL mode." t)
;; (push (cons "\\.owl" 'owl-mode) auto-mode-alist)

;; emacs code browser
;; (require 'ecb)
;; (setq ecb-tip-of-the-day nil)

;; cedet
;;(load-file "~/Documents/Emacs/site-lisp/cedet-1.0pre7/common/cedet.el")
(require 'cedet)
(require 'semantic)
(require 'ede)
(semantic-mode)
(setq semanticdb-default-save-directory "~/.semantic")
(global-ede-mode t)                      ; Enable the Project management system
;;(semantic-load-enable-code-helpers)      ; Enable prototype help and smart completion 
;;(global-srecode-minor-mode 1)            ; Enable template insertion menu
;;(semantic-load-enable-minimum-features)
;;(semantic-load-enable-excessive-code-helpers)
;;(require 'semantic-ia)
;;(require 'semantic-gcc)
;;(require 'semanticdb)
;;(global-semanticdb-minor-mode 1)
;;(require 'semanticdb-global)
;;(semanticdb-enable-gnu-global-databases 'c-mode)
;;(semanticdb-enable-gnu-global-databases 'c++-mode)
;;(semantic-add-system-include "/usr/local/include" 'c++-mode)
;;(semantic-add-system-include "/opt/local/include" 'c++-mode)

;; ;; ede
;; (ede-cpp-root-project "DLVHEX"
;;                 :name "DLVHEX project"
;;                 :file "~/Documents/TUWien/KR/software/dlvhex-svn/dlvhex/trunk/CMakeLists.txt"
;;                 :include-path '("/include")
;;                 :spp-table '(("isUnix" . "")
;;                              ("BOOST_TEST_DYN_LINK" . "")))
;(ede-cpp-root-project "dsat" :file "~/Documents/TUWien/KR/Work/mhex-svn/dsat/README"
;     :include-path '( "/" )
;     :system-include-path '( "/opt/local/include" "/usr/local/include"  )
;     :spp-table '( ("MOOSE" . "")
;                   ("CONST" . "const") )
;     :spp-files '( "include/config.h" )
;     ) 


;; ecb
(add-to-list 'load-path "~/Documents/Emacs/site-lisp/ecb-2.40/")
;;(require 'ecb)
(require 'ecb-autoloads)
(setq ecb-tip-of-the-day nil)
(setq ecb-source-path (quote (("~/Documents/TUWien/KR" "KR")
                              ("~/Documents/Software" "Software")
                              )
                             )
      )


;;
;; subversion support
;;
(require 'psvn)
;;(setq svn-status-svn-executable "/opt/local/bin/svn") ;; temp. fix mac os x executable
;;(setq svn-status-svn-executable "svn") ;; temp. fix mac os x executable
(require 'vc-svn)
(setq svn-status-changelog-style 'changelog)
(setq svn-status-hide-unknown t)
(setq svn-bookmark-list '(("mhex" . "~/Documents/TUWien/KR/Work/mhex-svn")
                          ("reviews" . "~/Documents/Reviews")
                          ("tkren-website" . "~/Documents/TUWien/KR/Work/tkren-website")
                          ("pub" . "~/Documents/Publications")
                          ("cv" . "~/Documents/Resume/cv")
                          ("log" . "~/Documents/Log")
                          ("dmcs" . "~/Documents/Software/dmcs-svn")
                          ("dlvhex" . "~/Documents/Software/dlvhex-svn")
                          ("dlvhex-semweb" . "~/Documents/Software/dlvhex-semweb-svn")
                          )
      )
(global-set-key "\C-cs" 'svn-status-via-bookmark)


;;
;; DVC support
;;
;;(load-file "~/Documents/Emacs/site-lisp/dvc/dvc-load.el")

;; tabs for buffers
;; (require 'tabbar)
;; (tabbar-mode)

;; ;; haskell-mode
;; (setq haskell-font-lock-symbols 'unicode)


;; C(++) mode
(require 'cc-mode)
(setq c-offsets-alist '((topmost-intro-cont . 0) (topmost-intro . 0)))
;; switch between header and implementation
(setq ff-search-directories 
      '("."
        "../src/*"
        "../include/*"
        "../../src/*"
        "../../include/*"
        "/usr/local/*/src/*"
        "/opt/local/include/*")
      )
(add-hook 'c-mode-common-hook
          (lambda() 
            (local-set-key  (kbd "C-c o") 'ff-find-other-file)
            )
          )
(add-hook 'c-mode-common-hook
          (lambda () (c-subword-mode 1))
          )
(setq c-mode-hook
          '(lambda ()
              (gtags-mode 1)
      ))

;; compile mode
(require 'compile)
(setq compilation-disable-input nil)
(setq compilation-scroll-output t)
(setq mode-compile-always-save-buffer-p t)
;; bind M-x compile to C-c c
(global-set-key "\C-cc" 'compile)


;; doxymacs font highlightning
(require 'doxymacs)
(add-hook 'c-mode-common-hook 'doxymacs-mode)

(defun my-doxymacs-font-lock-hook ()
  (if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))
      (doxymacs-font-lock)))
(add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook)

;; ;; load flyspell spellchecker
(require 'ispell)
(setq ispell-program-name "/opt/local/bin/aspell")
(ispell-change-dictionary "en")
(add-hook 'text-mode-hook '(lambda() (flyspell-mode)))

;; let skim display the particular line in the tex file by Shift-Cmd-Click
;;(load "/opt/local/share/Documents/Emacs/site-lisp/auctex.el")
(require 'tex-site)


;; old auctex preview definitions
;; (add-hook
;;  'TeX-mode-hook
;;  (lambda ()
;;    (add-to-list 'TeX-output-view-style
;;              '("^pdf$" "."
;;                "/Applications/MyApps/Skim.app/Contents/SharedSupport/displayline %n %o %b"
;;                )
;;              )
;;    )
;;  )

(add-hook 'LaTeX-mode-hook (lambda ()
                             (add-to-list 'TeX-output-view-style 
                                          '("^pdf$" "." 
                                            "/Applications/MyApps/Skim.app/Contents/SharedSupport/displayline %n %o %b")
                                          )
                             )
          )

(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)


;; setup RefTeX
(require 'reftex)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(setq reftex-plug-into-AUCTeX t)


;; start emacsserver for emacsclient
(server-start)


;;
;; set some convinient keybindings
;;

;; control-f11 toggles fullscreen
(global-set-key [(control f11)]
                '(lambda ()
                   (interactive)
                   (set-frame-parameter nil 'fullscreen
                                        (if (frame-parameter nil 'fullscreen) nil 'fullboth)
                                        )
                   )
                )

;; control-tab cycles buffers
(define-key org-mode-map [(control tab)] nil)
(org-defkey org-mode-map [(control shift tab)] 'org-force-cycle-archived)
(global-set-key [(control tab)] 'bury-buffer)


(defun wc ()
  (interactive)
  (message "Word count: %s" (how-many "\\w+" (point-min) (point-max))))


;; bind M-x count-matches to C-c m
(global-set-key "\C-cm" 'count-matches)

;; bind M-x count-words-region to C-c w
(global-set-key "\C-cw" 'count-words-region)

;;; counts the words in a region
;;; from "Programming in Emacs Lisp"
;;; http://www.gnu.org/software/emacs/emacs-lisp-intro/
(defun count-words-region (beginning end)
  "Print number of words in the region."
  (interactive "r")
  (message "Counting words in region ... ")
;;; 1. Set up appropriate conditions.
  (save-excursion
    (let ((count 0))
      (goto-char beginning)
;;; 2. Run the while loop.
      (while (and (< (point) end)
                  (re-search-forward "\\w+\\W*" end t))
        (setq count (1+ count)))
;;; 3. Send a message to the user.
      (cond ((zerop count)
             (message "The region does NOT have any words."))
            ((= 1 count)
             (message "The region has 1 word."))
            (t
             (message "The region has %d words." count))
            )
      )
    )
  )


;; my working dir
(defun workdir ()
  (interactive)
  (dired "~/Documents/TUWien/KR/Work/")
  )
(defun srcdir ()
  (interactive)
  (dired "~/Documents/Software/")
  )

;; my GTD file
(defun gtd ()
  (interactive)
  (find-file "~/Documents/Log/mygtd.org")
  )

;; my research log
(defun researchlog ()
  (interactive)
  (find-file "~/Documents/Log/ResearchLog.org")
  )



;;
;; Finetuning
;;

;; my default email address
(setq user-mail-address "tkren AT NOSPAM kr DOT tuwien DOT ac DOT at")

(setq make-backup-files t)

;; wrap at 72 chars
(setq fill-column 72)

;; highlight matches expressions in the grep result
(setq grep-highlight-matches 't)

;; 
(setq read-buffer-completion-ignore-case t)
(setq read-file-name-completion-ignore-case t)

;; Confirm on exit :-)
(setq confirm-kill-emacs 'y-or-n-p)

;; Automatic display of matching parentheses
(setq show-paren-mode t)
(setq blink-matching-paren)

;; Changes all yes/no questions to y/n type
(fset 'yes-or-no-p 'y-or-n-p)

;; name and email address used when editing ChangeLogs
(setq add-log-full-name "Thomas Krennwallner")
(setq add-log-mailing-address "tkren AT NOSPAM kr DOT tuwien DOT ac DOT at")
;; keep new entries for the same file together
(setq add-log-keep-changes-together t)

;; case insensitiv search
(setq case-fold-search t)

;; utf-8 settings
(setq current-language-environment "UTF-8")
(prefer-coding-system 'utf-8)

;; display time 
(display-time)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-mail-file (quote none))
(setq display-time-mode t)

(setq zoneinfo-style-world-list
      '(
        ("America/Honolulu" "Honolulu")
        ("America/Los_Angeles" "Seattle")
        ("America/New_York" "New York")
        ("Europe/London" "London")
        ("Europe/Vienna" "Vienna")
        ("Europe/Athens" "Athens")
        ("Asia/Calcutta" "Bangalore")
        ("Asia/Hanoi" "Hanoi")
        ("Asia/Tokyo" "Tokyo")
        )
      )

;; display battery status
(setq display-battery-mode t)
;; display column numbers
(column-number-mode 't)
;; display line number
(line-number-mode 't)
;; display size indication
(size-indication-mode 't)

;; syntax highlightning on
(global-font-lock-mode t)

;; scroll with wheel-mice
(mouse-wheel-mode t)

;; don't save emacs session
(setq save-place nil)

;; region highlightning for marks
; make the current 'selection' visible
(transient-mark-mode t)         
; delete the selection area with a keypress
(delete-selection-mode t)

;; don't append <N> on buffer names
(setq uniquify-buffer-name-style t)

;; visible bell on
(setq visible-bell t)

;; automatic file de/compression
(auto-compression-mode t)

;; truncate long lines and don't wrap, even when horizontally split windows
(set-default 'truncate-lines t)
(setq default-truncate-lines t)
(setq truncate-partial-width-windows nil)
(setq overflow-newline-into-fringe t)
(add-hook 'org-mode-hook (lambda () (setq truncate-lines t)))

;; do not open new frames in aquamacs
(one-buffer-one-frame-mode 0)

;;; Local Variables:
;;; mode: emacs-lisp
;;; fill-column: 72
;;; End:


CategoryConfig

MyConfig/Emacs (last edited 2010-07-30 05:49:01 by ThomasKrennwallner)