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