.emacs


;; .emacs 
;;
;; Alexandre Dulaunoy (adulau@foo.be) emacs startup file
;;
;; 
;; History :
;; 


(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(add-hook (quote news-reply-mode-hook) t)
 '(canlock-password "94f948cbae82689db601f9a33006856be84322f9")
 '(case-fold-search t)
 '(setq smtpmail-smtp-server t))

  (iso-accents-mode t)
					;(require 'iso-insert)
					;(standard-display-european 1)
					;(set-input-mode nil nil 1) 

;;; Cut-and-paste with the correct extensions
(setq selection-coding-system 'compound-text-with-extensions)
;; Europe
;(iso-accents-mode t)
;(standard-display-european 1)

;;; mailcrypt / GnuPG
(load-library "mailcrypt")
(mc-setversion "gpg")
(autoload 'mc-install-write-mode "mailcrypt" nil t)
(autoload 'mc-install-read-mode "mailcrypt" nil t)
;;(setq mc-gpg-user-id adulau)
(setq mc-gpg-user-id "adulau")
(setq mc-encrypt-for-me t)
(setq mc-gpg-comment "http://pgp.ael.be:11371/pks/lookup?op=get&search=0x44E6CBCD")
(setq mc-pgp-keyserver-address "pgp.ael.be")
(setq mc-pgp-keyserver-port 11371)
(setq mc-pgp-keyserver-url-template
      "/pks/lookup?op=get&search=%s")

;;(setq mc-pgp-keyserver-address "pgp.ael.be")
;;(setq mc-pgp-keyserver-port 11371)

(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 )

(load "emacs-wiki")

(setq emacs-wiki-publishing-footer "<lisp>(my-publishing-footer)</lisp>")

(defun my-publishing-footer ()
    (if (file-readable-p "footer.wiki")
        (ignore (insert-file-contents "footer.wiki"))
      "Copyrights (C) 2002,2003 Alexandre Dulaunoy - released under the GNU Free Documentation license without any options\n"))

;;; temp update 

;(require 'mule)
;(require 'un-define)

;(set-language-environment "Latin-1")
;;(set-input-method "latin-1-postfix") ;; or "latin-1-postfix"

;(set-language-environment "Latin-9")
;(set-default-coding-systems 'iso-8859-15)
;;(prefer-coding-system 'utf-8)

;; Add my nasty signature when composing in draft mode

(add-hook 'mew-draft-mode-hook
          (function
           (lambda ()
             (let ((p (point)))
               (goto-char (point-max))
               (insert-file ".signature")
               (goto-char p)))))

(setq mew-header-alist
      '(("X-fingerprint:" . "3B12 DCC2 82FA 2931 2F5B  709A 09E2 CD49 44E6 CBCD")
        ("X-URL:" . "http://www.foo.be/")
	("X-DMCA-EUCD:" . "False")))

;;

(autoload 'add-signature "c-sig" "c-sig" t)
(autoload 'delete-signature "c-sig" "c-sig" t)
(autoload 'insert-signature-eref "c-sig" "c-sig" t)         
(autoload 'insert-signature-automatically "c-sig" "c-sig" t) 
(autoload 'insert-signature-randomly "c-sig" "c-sig" t)  

;; Optional setup (Read Mail menu for Emacs 21):
(if (boundp 'read-mail-command)
    (setq read-mail-command 'mew))

(autoload 'mc-install-write-mode "mailcrypt" nil t)
(autoload 'mc-install-read-mode "mailcrypt" nil t)
(add-hook 'mail-mode-hook 'mc-install-write-mode)

(autoload 'w3m "w3m" "Interface for w3m on Emacs." t)
;;(require 'mime-w3m)

;; Optional setup (e.g. C-xm for sending a message):
;;(autoload 'mew-user-agent-compose "mew" nil t)
;;(if (boundp 'mail-user-agent)
;;    (setq mail-user-agent 'mew-user-agent))
;;(if (fboundp 'define-mail-user-agent)
;;    (define-mail-user-agent
;;      'mew-user-agent
;;      'mew-user-agent-compose
;;      'mew-draft-send-message
;;      'mew-draft-kill
;;      'mew-send-hook))


;; Dictionary

(autoload 'dictionary-search "dictionary"
  "Ask for a word and search it in all dictionaries" t)
(autoload 'dictionary-match-words "dictionary"
  "Ask for a word and search all matching words in the dictionaries" t)
(autoload 'dictionary-lookup-definition "dictionary"
  "Unconditionally lookup the word at point." t)
(autoload 'dictionary "dictionary"
  "Create a new dictionary buffer" t)
(autoload 'dictionary-mouse-popup-matching-words "dictionary"
  "Display entries matching the word at the cursor" t)
(autoload 'dictionary-popup-matching-words "dictionary"
  "Display entries matching the word at the point" t)
(autoload 'dictionary-tooltip-mode "dictionary"
  "Display tooltips for the current word" t)
(autoload 'global-dictionary-tooltip-mode "dictionary"
  "Enable/disable dictionary-tooltip-mode for all buffers" t)



;; Custom european stuff

(add-hook 'diary-display-hook 'fancy-diary-display)
(add-hook 'list-diary-entries-hook 'sort-diary-entries)
(setq mark-diary-entries-in-calendar t)
(setq european-calendar-style t)
(setq all-christian-calendar-holidays t)
(setq calendar-date-display-form 
      '((if dayname (concat dayname ", ")) day " " monthname " " year))
(setq calendar-time-display-form
      '(24-hours ":" minutes
		 (if time-zone " (") time-zone (if time-zone ")")))
(setq ps-paper-type 'a4)

;; Time set and display

(setq display-time-day-and-date t
      display-time-24hr-format t)
(display-time)

;; Theme load 

(require 'color-theme)
(global-font-lock-mode 1)
;(color-theme-WordPerfect)

;; set custom nntp value

(setq gnus-nntp-server "news.restena.lu")

;; Antiword plug

(add-to-list 'auto-mode-alist '("\\.doc\\'" . no-word))

(defun no-word ()
  "Run antiword on the entire buffer."
  (shell-command-on-region (point-min) (point-max) "antiword - " t t))


;; Perl 

(fset 'perl-mode 'cperl-mode)

(add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
;(add-hook 'cperl-mode-hook 'hide-body)
;(setq outline-minor-mode-prefix "\C-co")

;; Browse RFC via ERC button
;;(require 'erc-button)
(require 'erc)

;;(add-to-list 'erc-button-alist '("\\brfc[: ]\\([0-9]+\\)" 0 t rfc-browse 1))

;;(defun rfc-browse (rfc)
;;      "Browse RFC, where RFC is a string with several digits such as \"1958\"."
;;      (browse-url (format "http://www.faqs.org/rfcs/rfc%s.html" rfc)))

;; for PHP
;(load-library "php-mode-102")
;(add-hook 'php-mode-user-hook 'turn-on-font-lock)


;; for LaTeX 
;; ref: ftp://sunsite.dk/packages/auctex/auctex.tar.gz

(require 'tex-site)

;; for htmlize
;; ref: http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el

(require 'htmlize)

;; for semantic
;; ref: http://sourceforge.net/projects/cedet

;(add-to-list 'load-path "/usr/share/emacs/site-lisp/semantic-1.3.3") ; so Emacs can find semantic
;(require 'semantic-c) ; for C code integration
;(require 'semantic-el) ; for Emacs Lisp code integration
;(require 'semantic-make) ; for Makefile integration
;(require 'semantic-imenu) ; if you use imenu or wich-function
;(add-hook 'speedbar-load-hook (lambda () (require 'semantic-sb)))
			; for speedbar integration
;(autoload 'semantic-bnf-mode "semantic-bnf" "Mode for Bovine Normal Form." t)
;(add-to-list 'auto-mode-alist '("\\.bnf$" . semantic-bnf-mode))
			; for editing .bnf parser files.
;(autoload 'semantic-minor-mode "semantic-mode" "Mode managing semantic parsing." t)
			; for semantic-minor-mode

;; for data compression
;;

(auto-compression-mode 1)

;; for imaxima
;; ref: http://www.ifa.au.dk/~harder/imaxima.html
;;(require 'imaxima)

;; yatex
;;      (setq auto-mode-alist
;;           (cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
;;     (autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)


;; rfcr.el
;; (require 'rfcr)

;; for ansi-term & so on
;; 
(defun danl-ansi-term ()
  (interactive)
  (ansi-term "/bin/bash"))

(add-hook 'term-mode-hook
	  (function
	   (lambda ()
	     (set-face-foreground 'term-default-bg-inv "white")
	     (set-face-background 'term-default-bg-inv "gray60")
	     (set-face-foreground 'term-bold "orange")
	     (set-face-underline-p 'term-underline nil)
	     (set-face-foreground 'term-underline "lightslategrey")
	     (set-face-bold-p 'term-underline t)
	     (setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *\\|^[<]*[>]")
	     (make-local-variable 'mouse-yank-at-point)
	     (make-local-variable 'transient-mark-mode)

	     (setq transient-mark-mode nil)
	     (auto-fill-mode -1)
	     (setq tab-width 8 ))))
;; 	     (setq mode-line-format '((:eval (getenv "USER")) "@" 
;; 				      (:eval (getenv "HOSTNAME")) 
;; 				      ":" (:eval default-directory) ))
;;	     (define-key term-raw-map [?\M-x] 'execute-extended-command))))

;; Input high ascii in terminal

(set-input-mode (car (current-input-mode))
               (nth 1 (current-input-mode))
                0)

;; buffer navigation

;(require 'iswitchb)
;(iswitchb-default-keybindings) 

;; Auto fill

(add-hook 'text-mode-hook 
          (lambda ()
            (auto-fill-mode t)
            (setq default-justification 'full))
          )

(setq auto-mode-alist
      (append '(("\\.php.*$" . perl-mode)
		("\\.c$"     . c-mode)
		("\\.cc$"    . c++-mode)
                ("\\.pl$"    . cperl-mode)
		("\\.perl$"  . cperl-mode)
                ("\\.pm$"    . perl-mode)
		("\\.sql$"   . sql-mode)
		("\\.asc$"   . text-mode)
                ("\\.txt$"   . text-mode))
	            auto-mode-alist))

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

;; mgp
(autoload 'mgp-mode "mgp-mode-cd" "MGP mode." t)
(add-to-list 'auto-mode-alist '("\\.mgp$" . mgp-mode))


;; mutt & Emacs

(require 'mutt)


(defvar default-mail-user-agent 'mutt
  "Default MUA to use. Can be mutt or vm.")

(defun read-mail-with-mutt ()
  "Run mutt in gnome-terminal."
  (interactive)
  (call-process "gnome-terminal" nil 0 nil "-e" "mutt"))

Generated by GNU enscript 1.6.3.