emacs/emacs.el: ajout de nouvelles choses
[dotfiles.git] / emacs / emacs.el
1 ;; -*- emacs-lisp -*-
2
3 ;; Author: Olivier Tetard <olivier.tetard@miskin.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
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 ;; Impression
112 (setq lpr-command "/usr/bin/gtklp")
113 (setq ps-lpr-command "/usr/bin/gtklp")
114
115 ;; On utilise Mozilla Firefox
116 (defun browse-url-firefox-new-tab (url &optional new-window)
117   "Open URL in a new tab in Firefox."
118   ;; (interactive (browse-url-interactive-arg "URL: "))
119   (let ((cmd (shell-command-to-string
120               (concat "mozilla-firefox -a firefox -remote 'openURL("
121                       url ",new-tab)' > /dev/null"))))
122     (unless (string= "" cmd)
123       (message "Starting Firefox...")
124       (start-process (concat "firefox " url) nil "/bin/sh" "-c"
125                      (concat "mozilla-firefox " url "|| true"))
126       (message "Starting Firefox...done"))))
127
128 (setq browse-url-browser-function 'browse-url-firefox-new-tab)
129
130 ;; ,--------------
131 ;; | Les racourcis
132 ;; `--------------
133
134 (global-set-key "\C-cp" 'ps-print-buffer-with-faces)
135
136 ;; ,----
137 ;; | Configuration pour les différants modes
138 ;; `----
139
140 ;; Xtla
141 ;;(setq tla-arch-branch 'baz)
142 ;;(tla-insinuate-gnus)
143
144 ;; Ispell/Aspell
145 (setq ispell-program-name "aspell")
146 (setq ispell-dictionary "french")
147
148 ;; Pour JDE (Bug dans la sid)
149 (setq global-senator-minor-mode t)
150
151 ;; Pour TEX
152 (setq tex-dvi-view-command "evince")
153 (setq LaTeX-verbatim-environments (quote ("verbatim" "verbatim*" "lstlisting")))
154 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
155
156 ;; Pour dired
157 (setq find-file-run-dired t)
158 (setq dired-listing-switches "-l")
159 (setq dired-recursive-deletes 'top)
160
161 ;; Pour perl-mode
162 (defalias 'perl-mode 'cperl-mode)
163
164 ;; Indentation
165 (setq-default indent-tabs-mode nil)
166
167 ;; Toujours avoir nouvelle ligne en fin de fichier
168 (setq require-final-newline t)
169
170 ;; Configuration de debian-changelog
171 (setq debian-changelog-full-name "Olivier Tétard")
172 (setq debian-changelog-mailing-address "olivier.tetard@miskin.fr")
173
174 (setq safe-local-variable-values
175       (quote ((TeX-PDF-mode . PDF))))
176
177 ;; Stolen from http://xemacs.seanm.ca/lisp/dired-extras.el
178 (defun dired-do-apply-function (func)
179   "Apply an interactive lisp function to all the marked files.
180 The function is not passed any arguments. The function honours restrictions."
181   (interactive "aFunction: ")
182   (save-excursion
183     (dolist (file (dired-get-marked-files))
184       (message "Processing %s..." file)
185       (set-buffer (find-file-noselect file))
186       (goto-char (point-min))
187       (apply func nil))
188     (message "Done.")))
189
190 ;; -> END <-
191 (custom-set-variables
192   ;; custom-set-variables was added by Custom.
193   ;; If you edit it by hand, you could mess it up, so be careful.
194   ;; Your init file should contain only one such instance.
195   ;; If there is more than one, they won't work right.
196  '(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"))))
197  '(canlock-password "a29a3189d5be23f38adc9d2627e77c898e00cde1")
198  '(display-time-24hr-format t)
199  '(inhibit-startup-screen t)
200  '(mail-yank-prefix "> ")
201  '(muse-file-extension "muse")
202  '(muse-html-charset-default "utf-8")
203  '(muse-html-encoding-default (quote utf-8))
204  '(muse-html-meta-content-encoding (quote utf-8))
205  '(muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/style.css\" />")
206  '(muse-mode-auto-p nil)
207  '(muse-publish-desc-transforms (quote (muse-wiki-publish-pretty-title muse-wiki-publish-pretty-interwiki muse-publish-escape-specials-in-string)))
208  '(muse-wiki-publish-small-title-words (quote ("the" "and" "at" "on" "of" "for" "in" "an" "a" "page" "anime")))
209  '(muse-xhtml-footer "~/documents/wiki/common/footer.html")
210  '(muse-xhtml-header "~/documents/wiki/common/header.html")
211  '(safe-local-variable-values (quote ((TeX-PDF-mode . "PDF") (TeX-PDF-mode . PDF)))))
212 (custom-set-faces
213   ;; custom-set-faces was added by Custom.
214   ;; If you edit it by hand, you could mess it up, so be careful.
215   ;; Your init file should contain only one such instance.
216   ;; If there is more than one, they won't work right.
217  '(erc-current-nick-face ((t (:foreground "red" :slant oblique :background: "yellow"))))
218  '(highlight-current-line-face ((t (:background "#6699cc"))))
219  '(muse-bad-link-face ((t (:foreground "DeepPink" :underline "DeepPink" :weight bold))))
220  '(muse-link-face ((t (:foreground "blue" :underline "blue" :weight bold)))))