emacs.el: activation du message-mode lors de l'ouverture de fichiers .mail
[dotfiles.git] / emacs / emacs.el
1 ;; -*- emacs-lisp -*-
2
3 ;; Author: Olivier Tetard <olivier.tetard@miskin.fr>
4 ;; URL : http://toutoune25.miskin.fr/
5
6 ;; This file is free software; you can redistribute it and/or modify it
7 ;; under the terms of the GNU General Public License as published by the
8 ;; Free Software Foundation; either version 2, or (at your option) any
9 ;; later version.
10
11 ;; This file is distributed in the hope that it will be useful, but
12 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ;; General Public License for more details.
15
16 ;; You should have received a copy of the GNU General Public License
17 ;; along with GNU Emacs; see the file COPYING. If not, write to the Free
18 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 ;; 02111-1307, USA.
20
21 ;; Inspiré par les fichiers de :
22 ;;   * Julien Danjou (julien.danjou.org)
23 ;;   * Mark Triggs (http://grapevine.net.au/)
24
25 ;; ,----
26 ;; | Extensions et paths
27 ;; `----
28
29 (push (expand-file-name "~/.elisp") load-path)
30
31 (require 'ido)
32 (require 'uniquify)
33 (require 'themes)
34
35
36 ;; ,----
37 ;; | Couleurs et apparence
38 ;; `----
39
40 (if window-system
41     (progn
42       (tool-bar-mode nil)
43       (tooltip-mode nil)
44       (scroll-bar-mode t)))
45
46 ;; font
47 (if (>= emacs-major-version 23)
48   (set-frame-font "DejaVu Sans Mono-10"))
49
50 ;; ,----
51 ;; | Comportement
52 ;; `----
53
54 (server-start)                          ; Multi-tty powa !
55 (ido-mode t)                            ; Utilisation du mode ido
56 (setq auto-save-interval 1200)          ; Autosave
57 (setq scroll-step 2)                    ; On se decale de 2 lignes quand on change de page
58 (delete-selection-mode t)               ; On peut supprimer une selection
59 (fset 'yes-or-no-p 'y-or-n-p)           ; yes == y
60 (show-paren-mode t)                     ; On affiche les parentheses liées
61 (setq display-time-24hr-format t)       ; Heure au format 24h
62 (display-time)                          ; On affiche l'heure dans la barre
63 (setq visible-bell t)                   ; On desactive les beeps
64 (setq inhibit-startup-screen t)         ; On désactive le splash screen
65 (setq use-file-dialog nil)              ; Désactivation des boites de
66 (setq use-dialog-box nil)               ; fichiers GTK+
67 (setq scroll-bar-mode 'right)
68 (column-number-mode 1)
69
70 ;; Configuration d'uniquify
71 (setq uniquify-buffer-name-style 'reverse)
72 (setq uniquify-separator "|")
73 (setq uniquify-after-kill-buffer-p t)
74 (setq uniquify-ignore-buffers-re "^\\*")
75
76 ;; Les copiers/coller doivent aller dans le clipboard de l'OS
77 (setq x-select-enable-clipboard t)
78 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
79
80 (setq auto-mode-alist (cons '(".mail" . message-mode) auto-mode-alist))
81
82 ;; Quand vous recevez un fichier .txt d'une machine dos/windows il est
83 ;; très énervant de voir les ^M a chaque fin de ligne, utiliser M-x
84 ;; dos-unix pour vous en débarrasser. (J. Danjou)
85 (defun dos-unix ()
86   (interactive)
87   (goto-char (point-min))
88   (while (search-forward "\r" nil t) (replace-match "")))
89
90 ;; Complétion
91 ;; (abbrev-mode t)
92 ;; (read-abbrev-file "~/.abbrev_defs")
93 (setq save-abbrevs t)
94 (global-set-key (quote [S-tab]) (quote dabbrev-expand))
95
96 ;; Auto fill mode
97 (set default-major-mode 'text-mode)
98 (add-hook 'text-mode-hook 'turn-on-auto-fill)
99
100 ;; Enable longlines-mode for LaTeX files
101 (add-hook 'latex-mode-hook 'longlines-mode)
102
103 ;; Impression
104 (setq lpr-command "/usr/bin/gtklp")
105 (setq ps-lpr-command "/usr/bin/gtklp")
106
107 ;; On utilise Mozilla Firefox
108 (defun browse-url-firefox-new-tab (url &optional new-window)
109   "Open URL in a new tab in Firefox."
110   ;; (interactive (browse-url-interactive-arg "URL: "))
111   (let ((cmd (shell-command-to-string
112               (concat "mozilla-firefox -a firefox -remote 'openURL("
113                       url ",new-tab)' > /dev/null"))))
114     (unless (string= "" cmd)
115       (message "Starting Firefox...")
116       (start-process (concat "firefox " url) nil "/bin/sh" "-c"
117                      (concat "mozilla-firefox " url "|| true"))
118       (message "Starting Firefox...done"))))
119
120 (setq browse-url-browser-function 'browse-url-firefox-new-tab)
121
122 ;; ,--------------
123 ;; | Les racourcis
124 ;; `--------------
125
126 (global-set-key "\C-cp" 'ps-print-buffer-with-faces)
127
128 ;; ,----
129 ;; | Configuration pour les différants modes
130 ;; `----
131
132 ;; Xtla
133 ;;(setq tla-arch-branch 'baz)
134 ;;(tla-insinuate-gnus)
135
136 ;; Ispell/Aspell
137 (setq ispell-program-name "aspell")
138 (setq ispell-dictionary "french")
139
140 ;; Pour JDE (Bug dans la sid)
141 (setq global-senator-minor-mode t)
142
143 ;; Pour TEX
144 (setq tex-dvi-view-command "evince")
145 (setq LaTeX-verbatim-environments (quote ("verbatim" "verbatim*" "lstlisting")))
146 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
147
148 ;; Pour dired
149 (setq find-file-run-dired t)
150 (setq dired-listing-switches "-l")
151 (setq dired-recursive-deletes 'top)
152
153 ;; Pour perl-mode
154 (defalias 'perl-mode 'cperl-mode)
155
156 ;; Indentation
157 (setq-default indent-tabs-mode nil)
158
159 ;; Toujours avoir nouvelle ligne en fin de fichier
160 (setq require-final-newline t)
161
162 ;; Configuration de debian-changelog
163 (setq debian-changelog-full-name "Olivier Tétard")
164 (setq debian-changelog-mailing-address "olivier.tetard@miskin.fr")
165
166 (setq safe-local-variable-values
167       (quote ((TeX-PDF-mode . PDF))))
168
169 ;; Stolen from http://xemacs.seanm.ca/lisp/dired-extras.el
170 (defun dired-do-apply-function (func)
171   "Apply an interactive lisp function to all the marked files.
172 The function is not passed any arguments. The function honours restrictions."
173   (interactive "aFunction: ")
174   (save-excursion
175     (dolist (file (dired-get-marked-files))
176       (message "Processing %s..." file)
177       (set-buffer (find-file-noselect file))
178       (goto-char (point-min))
179       (apply func nil))
180     (message "Done.")))
181
182 ;; -> END <-
183 (custom-set-variables
184   ;; custom-set-variables was added by Custom.
185   ;; If you edit it by hand, you could mess it up, so be careful.
186   ;; Your init file should contain only one such instance.
187   ;; If there is more than one, they won't work right.
188  '(TeX-output-view-style (quote (("^dvi$" ("^landscape$" "^pstricks$\\|^pst-\\|^psfrag$") "%(o?)dvips -t landscape %d -o && gv %f") ("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" "%(o?)dvips %d -o && gv %f") ("^dvi$" ("^\\(?:a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4\\)$" "^landscape$") "%(o?)xdvi %dS -paper a4r -s 0 %d") ("^dvi$" "^\\(?:a4\\(?:dutch\\|paper\\|wide\\)\\|sem-a4\\)$" "%(o?)xdvi %dS -paper a4 %d") ("^dvi$" ("^\\(?:a5\\(?:comb\\|paper\\)\\)$" "^landscape$") "%(o?)xdvi %dS -paper a5r -s 0 %d") ("^dvi$" "^\\(?:a5\\(?:comb\\|paper\\)\\)$" "%(o?)xdvi %dS -paper a5 %d") ("^dvi$" "^b5paper$" "%(o?)xdvi %dS -paper b5 %d") ("^dvi$" "^letterpaper$" "%(o?)xdvi %dS -paper us %d") ("^dvi$" "^legalpaper$" "%(o?)xdvi %dS -paper legal %d") ("^dvi$" "^executivepaper$" "%(o?)xdvi %dS -paper 7.25x10.5in %d") ("^dvi$" "." "%(o?)xdvi %dS %d") ("^pdf$" "." "evince %o %(outpage)") ("^html?$" "." "netscape %o"))))
189  '(canlock-password "a29a3189d5be23f38adc9d2627e77c898e00cde1")
190  '(display-time-24hr-format t)
191  '(inhibit-startup-screen t)
192  '(mail-yank-prefix "> ")
193  '(muse-file-extension "muse")
194  '(muse-html-charset-default "utf-8")
195  '(muse-html-encoding-default (quote utf-8))
196  '(muse-html-meta-content-encoding (quote utf-8))
197  '(muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/style.css\" />")
198  '(muse-mode-auto-p nil)
199  '(muse-publish-desc-transforms (quote (muse-wiki-publish-pretty-title muse-wiki-publish-pretty-interwiki muse-publish-escape-specials-in-string)))
200  '(muse-wiki-publish-small-title-words (quote ("the" "and" "at" "on" "of" "for" "in" "an" "a" "page" "anime")))
201  '(muse-xhtml-footer "~/documents/wiki/common/footer.html")
202  '(muse-xhtml-header "~/documents/wiki/common/header.html")
203  '(safe-local-variable-values (quote ((sh-indentation . 2) (TeX-PDF-mode . "PDF") (TeX-PDF-mode . PDF)))))
204 (custom-set-faces
205   ;; custom-set-faces was added by Custom.
206   ;; If you edit it by hand, you could mess it up, so be careful.
207   ;; Your init file should contain only one such instance.
208   ;; If there is more than one, they won't work right.
209  '(erc-current-nick-face ((t (:foreground "red" :slant oblique :background: "yellow"))))
210  '(highlight-current-line-face ((t (:background "#6699cc"))))
211  '(muse-bad-link-face ((t (:foreground "DeepPink" :underline "DeepPink" :weight bold))))
212  '(muse-link-face ((t (:foreground "blue" :underline "blue" :weight bold)))))