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