Merge branch 'master' of ssh://miskin.fr/home/toutoune25/scm/git/dotfiles2
[dotfiles2.git] / 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     (color-theme-tango))
42
43 ;; font
44 (if (>= emacs-major-version 23)
45   (set-frame-font "DejaVu Sans Mono-10"))
46
47 ;; ,----
48 ;; | Comportement
49 ;; `----
50
51 (server-start)                          ; Multi-tty powa !
52 (ido-mode t)                            ; Utilisation du mode ido
53 (setq auto-save-interval 1200)          ; Autosave
54 (setq scroll-step 2)                    ; On se decale de 2 lignes quand on change de page
55 (delete-selection-mode t)               ; On peut supprimer une selection
56 (fset 'yes-or-no-p 'y-or-n-p)           ; yes == y
57 (show-paren-mode t)                     ; On affiche les parentheses liées
58 (setq display-time-24hr-format t)       ; Heure au format 24h
59 (display-time)                          ; On affiche l'heure dans la barre
60 (setq visible-bell t)                   ; On desactive les beeps
61 (setq inhibit-startup-screen t)         ; On désactive le splash screen
62 (setq use-file-dialog nil)              ; Désactivation des boites de
63 (setq use-dialog-box nil)               ; fichiers GTK+
64 (setq scroll-bar-mode 'right)
65 (column-number-mode 1)
66
67 ;; Configuration d'uniquify
68 (setq uniquify-buffer-name-style 'reverse)
69 (setq uniquify-separator "|")
70 (setq uniquify-after-kill-buffer-p t)
71 (setq uniquify-ignore-buffers-re "^\\*")
72
73 ;; Les copiers/coller doivent aller dans le clipboard de l'OS
74 (setq x-select-enable-clipboard t)
75 (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
76
77 (setq auto-mode-alist (cons '(".mail" . message-mode) auto-mode-alist))
78
79 ;; Quand vous recevez un fichier .txt d'une machine dos/windows il est
80 ;; très énervant de voir les ^M a chaque fin de ligne, utiliser M-x
81 ;; dos-unix pour vous en débarrasser. (J. Danjou)
82 (defun dos-unix ()
83   (interactive)
84   (goto-char (point-min))
85   (while (search-forward "\r" nil t) (replace-match "")))
86
87 ;; Complétion
88 ;; (abbrev-mode t)
89 ;; (read-abbrev-file "~/.abbrev_defs")
90 (setq save-abbrevs t)
91 (global-set-key (quote [S-tab]) (quote dabbrev-expand))
92
93 ;; Auto fill mode
94 (set major-mode 'text-mode)
95 (add-hook 'text-mode-hook 'turn-on-auto-fill)
96
97 ;; Enable longlines-mode for LaTeX files
98 (add-hook 'latex-mode-hook 'longlines-mode)
99
100 ;; ,--------------
101 ;; | Les racourcis
102 ;; `--------------
103
104 (global-set-key "\C-cp" 'ps-print-buffer-with-faces)
105
106 ;; ,----
107 ;; | Configuration pour les différants modes
108 ;; `----
109
110 ;; Ispell/Aspell
111 (setq ispell-program-name "aspell")
112 (setq ispell-dictionary "french")
113
114 ;; Pour TEX
115 (setq tex-dvi-view-command "evince")
116 (setq LaTeX-verbatim-environments (quote ("verbatim" "verbatim*" "lstlisting")))
117 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
118
119 ;; Pour dired
120 (setq find-file-run-dired t)
121 (setq dired-listing-switches "-l")
122 (setq dired-recursive-deletes 'top)
123
124 ;; Pour perl-mode
125 (defalias 'perl-mode 'cperl-mode)
126
127 ;; Indentation
128 (setq-default indent-tabs-mode nil)
129
130 ;; Toujours avoir nouvelle ligne en fin de fichier
131 (setq require-final-newline t)
132
133 ;; Configuration de debian-changelog
134 (setq debian-changelog-full-name "Olivier Tétard")
135 (setq debian-changelog-mailing-address "olivier.tetard@miskin.fr")
136
137 (setq safe-local-variable-values
138       (quote ((TeX-PDF-mode . PDF))))
139
140 ;; Stolen from http://xemacs.seanm.ca/lisp/dired-extras.el
141 (defun dired-do-apply-function (func)
142   "Apply an interactive lisp function to all the marked files.
143 The function is not passed any arguments. The function honours restrictions."
144   (interactive "aFunction: ")
145   (save-excursion
146     (dolist (file (dired-get-marked-files))
147       (message "Processing %s..." file)
148       (set-buffer (find-file-noselect file))
149       (goto-char (point-min))
150       (apply func nil))
151     (message "Done.")))
152
153 ;; AMOSSYS
154 (setq-default c-basic-offset 8)
155 (setq-default indent-tabs-mode t)
156
157 ;; Twitter !
158 (push (expand-file-name "~/.elisp/twittering-mode") load-path)
159 (require 'twittering-mode)
160 (setq twittering-use-master-password t)
161 (setq twittering-icon-mode t)
162 (setq twittering-scroll-mode t)
163 (setq twittering-timer-interval 300)
164 (setq twittering-url-show-status nil)
165 (add-hook 'twittering-new-tweets-hook
166           (lambda ()
167             (let ((n twittering-new-tweets-count))
168               (start-process "twittering-notify" nil "notify-send"
169                              "-i" "/usr/share/pixmaps/gnome-emacs.png"
170                              "--hint=int:transient:1"
171                              "New tweets"
172                              (format "You have %d new tweet%s"
173                                      n (if (> n 1) "s" ""))))))
174 (setq twittering-initial-timeline-spec-string
175       '(":home"
176         ":replies"
177         ":mentions"
178         ":direct_messages"))
179
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 ((sgml-local-ecat-files) (sgml-local-catalogs) (sgml-exposed-tags) (sgml-default-dtd-file) (sgml-parent-document) (sgml-indent-data . t) (sgml-indent-step . 2) (sgml-always-quote-attributes . t) (sgml-minimize-attributes) (sgml-shorttag . t) (sgml-omittag . t) (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)))))