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