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