Initial commit
[dotfiles.git] / emacs / emacs.el
1 ;; -*- emacs-lisp -*-
2
3 ;; Author: Olivier Tetard <toutoune25@free.fr>
4 ;; URL : http://www.miskin.be/
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 (push (expand-file-name "~/.elisp/bbdb/lisp") load-path)
31 (push (expand-file-name "~/.elisp/erc") load-path)
32
33 ;; Mozmail is available in XEmacs CVS :
34 ;; http://cvs.xemacs.org/viewcvs.cgi/XEmacs/packages/xemacs-packages/net-utils/mozmail.el
35 (require 'mozmail)
36 (require 'tt25-passwords)
37 (require 'tt25-muse)
38 (require 'tt25-erc)
39 (require 'color-theme)
40 (require 'erc)                          ; Installé dans ~/.elisp/erc/
41 (require 'ido)
42
43 ;; Pour Wikipedia
44 (require 'wikipedia-mode)
45 (autoload 'longlines-mode "longlines.el"
46      "Minor mode for editing long lines." t)
47 (add-to-list 'auto-mode-alist '("mozex.\\.*" . wikipedia-mode))
48
49 ;; ,----
50 ;; | Couleurs et apparence
51 ;; `----
52
53 (if window-system
54     (color-theme-resolve)
55   (color-theme-dark-laptop))
56
57 (set-face-background 'default "black")
58
59 (if window-system
60     (progn 
61       (tool-bar-mode nil)
62       (tooltip-mode nil)
63       (scroll-bar-mode t)))
64
65 ;; ,----
66 ;; | Comportement
67 ;; `----
68
69 (gnuserv-start)                         ; Utilisation de gnuserv
70 (ido-mode t)                            ; Utilisation du mode ido
71 (setq auto-save-interval 1200)          ; Autosave
72 (setq scroll-step 2)                    ; On se decale de 2 lignes quand on change de page
73 (delete-selection-mode t)               ; On peut supprimer une selection
74 (fset 'yes-or-no-p 'y-or-n-p)           ; yes == y
75 (show-paren-mode t)                     ; On affiche les parentheses liées
76 (setq display-time-24hr-format t)       ; Heure au format 24h
77 (display-time)                          ; On affiche l'heure dans la barre
78 (setq visible-bell t)                   ; On desactive les beeps
79
80 ;; Quand vous recevez un fichier .txt d'une machine dos/windows il est
81 ;; très énervant de voir les ^M a chaque fin de ligne, utiliser M-x
82 ;; dos-unix pour vous en débarrasser. (J. Danjou)
83 (defun dos-unix ()
84   (interactive)
85   (goto-char (point-min))
86   (while (search-forward "\r" nil t) (replace-match "")))
87
88 ;; Complétion
89 (setq save-abbrevs t)
90 (global-set-key (quote [S-tab]) (quote dabbrev-expand))
91
92 ;; Auto fill mode
93 (set default-major-mode 'text-mode)
94 (add-hook 'text-mode-hook 'turn-on-auto-fill)
95
96 ;; Impression
97 (setq lpr-command "/usr/bin/gtklp")
98 (setq ps-lpr-command "/usr/bin/gtklp")
99
100 ;; On utilise Mozilla Firefox
101 (defun browse-url-firefox-new-tab (url &optional new-window)
102   "Open URL in a new tab in Firefox."
103   ;; (interactive (browse-url-interactive-arg "URL: "))
104   (let ((cmd (shell-command-to-string
105               (concat "mozilla-firefox -a firefox -remote 'openURL("
106                       url ",new-tab)' > /dev/null"))))
107     (unless (string= "" cmd)
108       (message "Starting Firefox...")
109       (start-process (concat "firefox " url) nil "/bin/sh" "-c"
110                      (concat "mozilla-firefox " url "|| true"))
111       (message "Starting Firefox...done"))))
112
113 (setq browse-url-browser-function 'browse-url-firefox-new-tab)
114
115 ;; ,--------------
116 ;; | Les racourcis
117 ;; `--------------
118
119 (global-set-key "\C-cp" 'ps-print-buffer-with-faces)
120
121 ;; ,----
122 ;; | Configuration pour les différants modes
123 ;; `----
124
125 ;; Xtla
126 ;;(setq tla-arch-branch 'baz)
127 ;;(tla-insinuate-gnus)
128
129 ;; Ispell/Aspell
130 (setq ispell-program-name "aspell")
131 (setq ispell-dictionary "french")
132
133 ;; Pour JDE (Bug dans la sid)
134 (setq global-senator-minor-mode t)
135
136 ;; Pour TEX
137 (setq tex-dvi-view-command "evince")
138 (setq LaTeX-verbatim-environments (quote ("verbatim" "verbatim*" "lstlisting")))
139 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
140
141 ;; Pour dired
142 (setq find-file-run-dired t)
143 (setq dired-listing-switches "-l")
144 (setq dired-recursive-deletes 'top)
145
146 ;; Pour perl-mode
147 (defalias 'perl-mode 'cperl-mode)
148
149 ;; Indentation
150 (setq-default indent-tabs-mode nil)
151
152 ;; Toujours avoir nouvelle ligne en fin de fichier
153 (setq require-final-newline t)
154
155 ;; Configuration de debian-changelog
156 (setq debian-changelog-full-name "Olivier Tétard")
157 (setq debian-changelog-mailing-address "toutoune25@free.fr")
158
159 (setq safe-local-variable-values 
160       (quote ((TeX-PDF-mode . PDF))))
161
162 ;; Stolen from http://xemacs.seanm.ca/lisp/dired-extras.el
163 (defun dired-do-apply-function (func)
164   "Apply an interactive lisp function to all the marked files.
165 The function is not passed any arguments. The function honours restrictions."
166   (interactive "aFunction: ")
167   (save-excursion
168     (dolist (file (dired-get-marked-files))
169       (message "Processing %s..." file)
170       (set-buffer (find-file-noselect file))
171       (goto-char (point-min))
172       (apply func nil))
173     (message "Done.")))
174
175 ;; -> END <-
176 (custom-set-variables
177   ;; custom-set-variables was added by Custom.
178   ;; If you edit it by hand, you could mess it up, so be careful.
179   ;; Your init file should contain only one such instance.
180   ;; If there is more than one, they won't work right.
181  '(display-time-24hr-format t)
182  '(mail-yank-prefix "> ")
183  '(muse-file-extension "muse")
184  '(muse-html-charset-default "utf-8")
185  '(muse-html-encoding-default (quote utf-8))
186  '(muse-html-meta-content-encoding (quote utf-8))
187  '(muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/style.css\" />")
188  '(muse-mode-auto-p nil)
189  '(muse-mode-hook (quote (footnote-mode muse-wiki-update-custom-values)))
190  '(muse-publish-desc-transforms (quote (muse-wiki-publish-pretty-title muse-wiki-publish-pretty-interwiki muse-publish-escape-specials-in-string)))
191  '(muse-wiki-publish-small-title-words (quote ("the" "and" "at" "on" "of" "for" "in" "an" "a" "page" "anime")))
192  '(muse-xhtml-footer "~/documents/wiki/common/footer.html")
193  '(muse-xhtml-header "~/documents/wiki/common/header.html")
194  '(safe-local-variable-values (quote ((TeX-PDF-mode . PDF)))))
195 (custom-set-faces
196   ;; custom-set-faces was added by Custom.
197   ;; If you edit it by hand, you could mess it up, so be careful.
198   ;; Your init file should contain only one such instance.
199   ;; If there is more than one, they won't work right.
200  '(erc-current-nick-face ((t (:foreground "red" :slant oblique :background: "yellow"))))
201  '(highlight-current-line-face ((t (:background "#6699cc"))))
202  '(muse-bad-link-face ((t (:foreground "DeepPink" :underline "DeepPink" :weight bold))))
203  '(muse-link-face ((t (:foreground "blue" :underline "blue" :weight bold)))))