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