;; -*- emacs-lisp -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; $Id: emacs_testing.el,v 1.21 2006-11-06 21:02:42 rscholz Exp $
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; noch zu testende Einstellungen
;;
;; Die offizielle Quelle dieser Datei ist
;;   <http://www.zonix.de/projects/emacs/config>
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


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


;; auto-insert
;(add-hook 'find-file-hooks 'auto-insert)
;(setq auto-insert-directory (expand-file-name "~/tmp/autoinsert/"))

(setq ps-print-color-p nil)

;; (require 'time)
;; (setq display-time-interval 5)
;; (setq display-time-24hr-format t)
;; (setq display-time-day-and-date t)
;; (setq display-time-form-list '(date time-text mail load))
;; (display-time)


;; Greg Hill in geh
(defun zoom-in () (interactive)
  (window-configuration-to-register ?z)
  (delete-other-windows)
  (global-set-key [?\C-+] 'zoom-out))

(defun zoom-out () (interactive)
  (jump-to-register ?z)
  (global-set-key [?\C-+] 'zoom-in))

(global-set-key [?\C-+] 'zoom-in)


;; From: storm@cua.dk (Kim F. Storm)
;; Subject: fringe-mode (was Re: scroll-bar-mode and &optional?)
;; Newsgroups: gmane.emacs.devel
;; Date: Mon Jan 21 01:11:57 2002 +0100
;; Message-ID: <5x665w7eb6.fsf_-_@kfs2.cua.dk>
(defun fringe-mode ()  ;; this version toggles only
   (interactive)
   (let ((fp (frame-parameters nil)))
     (modify-frame-parameters nil
       (if (and (= (cdr (assoc 'left-fringe fp)) 0) (= (cdr (assoc 'right-fringe fp)) 0))
           '((left-fringe . nil) (right-fringe . nil))               
         '((left-fringe . 0) (right-fringe . 0))))))

;; (add-to-list 'ispell-dictionary-alist
;;  '("german8" "[a-zA-Z\304\326\334\344\366\337\374]" "[^a-zA-Z\304\326\334\344\366\337\374]" "[']" t
;;   ("-C" "-d" "german")
;;   "~latin9" iso-8859-15))


;(global-set-key (kbd "<EuroSign>") "EUR")
;(global-set-key (kbd "<EuroSign>") [342604])

;; fly
(global-set-key (kbd "<EuroSign>") [3876])

;;     (global-set-key (kbd "<EuroSign>")
;;              (lambda () 
;;                (interactive)
;;                (insert (make-char 'latin-iso8859-15 #xA4))))


;(require 'utf-16)


;(codepage-setup 1251)
;(define-coding-system-alias 'windows-1251 'cp1251)


(setq mouse-yank-at-point t)

(defun bell-function ()
  (call-process "/usr/bin/esdplay" nil 0 nil
                (expand-file-name "~/xxx/share/wave/Diverse/boing.wav")))

;(setq ring-bell-function 'bell-function)

(setq sentence-end-double-space t)
(setq colon-double-space t)


;(setq ffap-file-finder 'ido-find-file)



;; From:  Julien Oster <usenet-vaio-90210@usenet.frodoid.org>
;; Subject: [emacs goodie] mouse-avoidance mit headerline
;; Newsgroups: de.comp.editoren
;; Date: Sun May 19 01:04:46 2002 +0200
;; X-Sent: 1 day, 16 hours, 5 minutes, 52 seconds ago
;; Organization: FRODOID.ORG
;; Message-ID: <frodoid.vaio.87vg9lvz01.fsf@usenet.frodoid.org>
;; User-Agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2 (i386-debian-linux-gnu)

;(mouse-avoidance-mode 'banish)         ; avoid mouse when typing

; redefine this function to move mouse to the 2nd line in the buffer
; when a header-line is present

;; (defun mouse-avoidance-banish-destination ()
;;   (let ((mline 0))
;;     (if header-line-format
;;      (setq mline 1))
;;     (cons (window-width) mline)))



;(set-selection-coding-system compound-text-with-extensions)


;; CVS book
(add-to-list 'Info-default-directory-list
             (expand-file-name (concat zonix-elisp-dir "cvsbook")))


;; (require 'latin1-disp)
;; (latin1-display 'latin-9)

;C-h f hide-ifdef-mode

;; From: Gerald Wildgruber <gwil.remove.this.phrase@lrz.uni-muenchen.de>
;; Subject: auto-recognize utf-8 encoded files upon visiting: solved (sort of...)
;; Newsgroups: gnu.emacs.help
;; Date: Tue Sep 24 13:45:22 2002 +0200
;; Message-ID: <m3u1kfipbh.fsf@lrz.uni-muenchen.de>

(prefer-coding-system 'utf-8)
(prefer-coding-system 'latin-1)

;; From: Jesper Harder <harder@ifa.au.dk>
;; Subject: Re: Postings with UTF-8 characters are mangled
;; Newsgroups: gnus.ding
;; Date: Sun Dec 29 23:13:38 2002 +0100
;; X-Sent: 1 hour, 32 minutes, 6 seconds ago
;; Message-ID: <m34r8wlbhp.fsf@defun.localdomain>
;; User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

(when (fboundp 'sort-coding-systems)
  (delq 'mule-utf-16-le 
        (delq 'mule-utf-16-be 
              (sort-coding-systems (coding-system-list t)))))


;; css-mode


(autoload 'css-mode "css-mode")
(setq auto-mode-alist       
     (cons '("\\.css\\'" . css-mode) auto-mode-alist))
(setq cssm-indent-function #'cssm-c-style-indenter)
(setq cssm-indent-level 4)



;(setq scroll-up-aggressively 1.0)
;(setq scroll-down-aggressively 1.0)



(autoload 'todo-mode "todo-mode"
  "Major mode for editing TODO lists." t)
(autoload 'todo-show "todo-mode"
  "Show TODO items." t)
(autoload 'todo-insert-item "todo-mode"
  "Add TODO item." t)

;;          (global-set-key "\C-ct" 'todo-show) ;; switch to TODO buffer
;;          (global-set-key "\C-ci" 'todo-insert-item) ;; insert new item


;(setq ecb-source-path '("~/tmp/a318/"))
(setq ecb-show-sources-in-directories-buffer t)

(setq ecb-show-sources-in-directories-buffer '("left7" "left13" "left14" "left15"))
(setq ecb-source-path (quote ("~/tmp/a318/")))


;(add-to-list 'load-path (expand-file-name (concat zonix-elisp-dir "EDE")))
;(require 'ede)
;(global-ede-mode t)


;; From:  Oliver Scholz <alkibiades@gmx.de>
;; Subject: Re: Syntax Highlighting bzw. Analyse
;; Newsgroups: de.comp.editoren
;; Date: Mon Mar 10 23:08:19 2003 +0100
;; X-Sent: 3 weeks, 5 days, 13 hours, 10 minutes, 12 seconds ago
;; Message-ID: <uheaaoox8.fsf@ID-87814.user.dfncis.de>
;; User-Agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50

;; Andreas Volz <andreas@brachttal.net> writes:
;; [...]
;; > Ich möchte eine Datei öffnen und darin bestimmte Angaben in einer
;; > bestimmten Farbe erscheinen lassen. Beispiel:
;; >
;; > Komando bla color #efefef
;; >
;; > Ich möchte dabei dass "#efefef" in der entprechenden Farbe des
;; > Hex-Triplets gesetzt wird. Ein Klick darauf soll ein Programm starten
;; > und dessen Rückgabewert an dieser Stelle wieder einfügen. (Zur
;; > Neuauswahl einer Farbe)
;; >
;; > Es nervt mich einfach, wenn ich Dateien (z.B. Themes) bearbeite und die
;; > Farben natürlich nie sehe. Es ist extrem mühsam immer alles in ein
;; > externen Programm einfügen, Farbe auswählen, zurück einfügen, etc...

;; Klasse Idee! Das folgende liefert für Emacs die Farbe. Den Text
;; mousable zu machen, dass er ein Programm startet ist nur eine Zeile
;; mehr. Dass dann auch der Rückgabewert eingefügt wird ist um zwei oder
;; drei Zeilen aufwändiger. Außerdem hängt es vom verwendeten Programm
;; ab. Wozu braucht es das eigentlich noch, wenn man die Farbe sofort
;; sieht?

(defvar egoge-colour-keywords
  '(("#[abcdef[:digit:]]\\{6\\}"
     (0 (put-text-property (match-beginning 0)
                           (match-end 0)
                           'face (list :background (match-string-no-properties 0)))))))

;; Aktivieren für einen major mode (setzt voraus, dass der major mode
;; bereits font-lock unterstützt).
(add-hook 'foo-bar-hook
          (lambda ()
            (font-lock-add-keywords nil egoge-colour-keywords)))


(utf-translate-cjk-mode 1)

;(server-start)

(setq ispell-program-name "/usr/bin/ispell")
(ispell-change-dictionary zonix-german-ispell-dictionary)

;; Oliver Scholz in <u1y0muooo.fsf@ID-87814.user.dfncis.de>
;; --------------------------------------------------------------------
;; dt. Quotation Marks (UTF-8)
(defun egoge-insert-quotation-mark (&optional prefix)
  "Insert quotation marks (German typography) depending on context.
With prefix, use the alternative style allowed by Duden."
  (interactive "P")
  (if (or (bobp)
          (let ((syntax (char-syntax (char-before))))
            (memq syntax '(?\  ?\- ?\())))
      ;; After whitespace etc.: Opening quotation mark.
      (if prefix
          (insert ?\273)
        (insert (make-char 'mule-unicode-0100-24ff 114 126)))
    ;; Everywhere else: Closing quotation mark.
    (if prefix
        (insert ?\253)
      (insert (make-char 'mule-unicode-0100-24ff 114 124)))))

;(define-key text-mode-map [?\"] 'egoge-insert-quotation-mark)

;; Xrefactory configuration part ;;
;; some Xrefactory defaults can be set here
;(defvar xref-current-project nil) ;; can be also "my_project_name"
;(defvar xref-key-binding 'global) ;; can be also 'local or 'none
;(setq load-path (cons "/home/rscholz/tmp/x/emacs" load-path))
;(setq exec-path (cons "/home/rscholz/tmp/x" exec-path))
;(load "xrefactory")
;; end of Xrefactory configuration part ;;
;(message "xrefactory loaded")



;; *** Now speedbar can be used not only as replacement for the
;;     ECB-directory-browser in the directory-window but also instead of the
;;     sources- or the methods-buffer/window. See new option
;;     `ecb-use-speedbar-instead-native-tree-buffer' which replaces the old
;;     option `ecb-use-speedbar-for-directories'.

;; *** There are some new options like `ecb-process-non-semantic-files',
;;     `ecb-non-semantic-parsing-function' and `ecb-method-non-semantic-face' and
;;     one new face `ecb-method-non-semantic-face'. See new customize group
;;     "ecb-non-semantic"!


;; *** Now speedbar can be integrated into an arbitrary layout in the same way as
;;     the other four special buffers (directories, sources, methods and
;;     history). See new example layout with name "left-dir-plus-speedbar".

;; *** New option `ecb-directories-update-speedbar' which helps you
;;     to update a speedbar-window to the current selected directory of the
;;     ECB-directories-window.

;; ** New option `ecb-compilation-predicates' for better specifying which buffers
;;    should be treated as compilation-buffers and therefore be displayed in the
;;    compile-window of ECB - if th

(unless window-system
  (global-set-key "\C-h" 'delete-backward-char))


(define-skeleton my-skeleton-c-if
   "Insert a c if statement" nil
   "if (" > _ ")" \n
   "{" '(indent-for-tab-command) \n
   \n
   "}" '(indent-for-tab-command))

(defun my-c-mode-common-hook ()
(define-abbrev local-abbrev-table "ifx" "" 'my-skeleton-c-if))
;(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)


;; RTT 6.x

(add-to-list 'auto-mode-alist
             '("\\.rtt$" . shell-script-mode))

(add-to-list 'auto-mode-alist
             '("\\.rts$" . c-mode))
(add-to-list 'auto-mode-alist
             '("\\.cnl$" . c-mode))
(add-to-list 'auto-mode-alist
             '("\\.stubs$" . c-mode))

(setq vc-cvs-stay-local nil)


(add-to-list 'auto-mode-alist '("/Makefile\\.[^/]*\\'" . makefile-mode))


;; (eval-after-load "tex"
;;   '(progn
;;      (setq TeX-command-list
;;         (remove (assoc "File" TeX-command-list) TeX-command-list))
;;      (add-to-list 'TeX-command-list
;;                '("File" "was-auch-immer" TeX-run-command t t) t)))



(toggle-uniquify-buffer-names)

;; crypt++
(setq crypt-encryption-type 'gpg)
(require 'crypt++)
(modify-coding-system-alist 'file "\\.bz\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.bz2\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.gpg\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.gz\\'" 'no-conversion)
(modify-coding-system-alist 'file "\\.Z\\'" 'no-conversion)

(diary)


; epg

;; (add-to-list 'load-path (expand-file-name (concat zonix-elisp-dir "epg")))
;; (require 'epa-setup)


;; Local Variables:
;; no-byte-compile: t
;; End: