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