Adding .emacs.el
[dotfiles2.git] / emacs.el
diff --git a/emacs.el b/emacs.el
new file mode 100644 (file)
index 0000000..8042a2b
--- /dev/null
+++ b/emacs.el
@@ -0,0 +1,240 @@
+;; -*- emacs-lisp -*-
+
+;; Author: Olivier Tetard <olivier.tetard@miskin.fr>
+;; URL : http://toutoune25.miskin.fr/
+
+;; This file is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by the
+;; Free Software Foundation; either version 2, or (at your option) any
+;; later version.
+
+;; This file is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;; Inspiré par les fichiers de :
+;;   * Julien Danjou (julien.danjou.org)
+;;   * Mark Triggs (http://grapevine.net.au/)
+
+;; ,----
+;; | Extensions et paths
+;; `----
+
+(push (expand-file-name "~/.elisp") load-path)
+
+(require 'ido)
+(require 'uniquify)
+(require 'themes)
+
+;; ,----
+;; | Couleurs et apparence
+;; `----
+
+(if window-system
+    (progn
+      (tool-bar-mode nil)
+      (tooltip-mode nil)
+      (scroll-bar-mode t)))
+
+;; font
+(if (>= emacs-major-version 23)
+  (set-frame-font "DejaVu Sans Mono-10"))
+
+(require 'color-theme)
+;;(color-theme-initialize)
+(setq color-theme-is-global t)
+(setq color-theme-is-cumulative t)
+(setq color-theme-load-all-themes nil)
+
+(color-theme-tangotango)
+
+(add-hook 'message-mode-hook 'color-theme-tangotango)
+(add-hook 'gnus-article-mode-hook 'color-theme-tangotango)
+
+(add-hook 'after-make-frame-functions
+         (lambda (frame)
+           (set-variable 'color-theme-is-global nil)
+           (select-frame frame)
+           (if window-system
+               (color-theme-tangotango)
+             (color-theme-tty-dark))))
+
+;; ,----
+;; | Comportement
+;; `----
+
+(server-start)                          ; Multi-tty powa !
+(ido-mode t)                            ; Utilisation du mode ido
+(setq auto-save-interval 1200)          ; Autosave
+(setq scroll-step 2)                    ; On se decale de 2 lignes quand on change de page
+(delete-selection-mode t)              ; On peut supprimer une selection
+(fset 'yes-or-no-p 'y-or-n-p)          ; yes == y
+(show-paren-mode t)                    ; On affiche les parentheses liées
+(setq display-time-24hr-format t)       ; Heure au format 24h
+(display-time)                         ; On affiche l'heure dans la barre
+(setq visible-bell t)                  ; On desactive les beeps
+(setq inhibit-startup-screen t)         ; On désactive le splash screen
+(setq use-file-dialog nil)              ; Désactivation des boites de
+(setq use-dialog-box nil)               ; fichiers GTK+
+(setq scroll-bar-mode 'right)
+(column-number-mode 1)
+
+;; ;; Desktop-mode
+;; (desktop-save-mode t) ; remember which files were open
+;; (require 'midnight) ; Clear up unimportant buffers
+;; ;;(require 'savehist-20+)
+;; (savehist-mode 1)
+
+;; Configuration d'uniquify
+(setq uniquify-buffer-name-style 'reverse)
+(setq uniquify-separator "|")
+(setq uniquify-after-kill-buffer-p t)
+(setq uniquify-ignore-buffers-re "^\\*")
+
+;; Les copiers/coller doivent aller dans le clipboard de l'OS
+(setq x-select-enable-clipboard t)
+(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
+
+(setq auto-mode-alist (cons '(".mail" . message-mode) auto-mode-alist))
+
+;; Quand vous recevez un fichier .txt d'une machine dos/windows il est
+;; très énervant de voir les ^M a chaque fin de ligne, utiliser M-x
+;; dos-unix pour vous en débarrasser. (J. Danjou)
+(defun dos-unix ()
+  (interactive)
+  (goto-char (point-min))
+  (while (search-forward "\r" nil t) (replace-match "")))
+
+;; Complétion
+;; (abbrev-mode t)
+;; (read-abbrev-file "~/.abbrev_defs")
+(setq save-abbrevs t)
+(global-set-key (quote [S-tab]) (quote dabbrev-expand))
+
+;; Auto fill mode
+(set major-mode 'text-mode)
+(add-hook 'text-mode-hook 'turn-on-auto-fill)
+
+;; Enable longlines-mode for LaTeX files
+(add-hook 'latex-mode-hook 'longlines-mode)
+
+;; Impression
+(setq lpr-command "/usr/bin/gtklp")
+(setq ps-lpr-command "/usr/bin/gtklp")
+
+;; On utilise Mozilla Firefox
+(defun browse-url-firefox-new-tab (url &optional new-window)
+  "Open URL in a new tab in Firefox."
+  ;; (interactive (browse-url-interactive-arg "URL: "))
+  (let ((cmd (shell-command-to-string
+              (concat "mozilla-firefox -a firefox -remote 'openURL("
+                     url ",new-tab)' > /dev/null"))))
+    (unless (string= "" cmd)
+      (message "Starting Firefox...")
+      (start-process (concat "firefox " url) nil "/bin/sh" "-c"
+                    (concat "mozilla-firefox " url "|| true"))
+      (message "Starting Firefox...done"))))
+
+(setq browse-url-browser-function 'browse-url-firefox-new-tab)
+
+;; ,--------------
+;; | Les racourcis
+;; `--------------
+
+(global-set-key "\C-cp" 'ps-print-buffer-with-faces)
+
+;; ,----
+;; | Configuration pour les différants modes
+;; `----
+
+;; Xtla
+;;(setq tla-arch-branch 'baz)
+;;(tla-insinuate-gnus)
+
+;; Ispell/Aspell
+(setq ispell-program-name "aspell")
+(setq ispell-dictionary "french")
+
+;; Pour JDE (Bug dans la sid)
+(setq global-senator-minor-mode t)
+
+;; Pour TEX
+(setq tex-dvi-view-command "evince")
+(setq LaTeX-verbatim-environments (quote ("verbatim" "verbatim*" "lstlisting")))
+(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
+
+;; Pour dired
+(setq find-file-run-dired t)
+(setq dired-listing-switches "-l")
+(setq dired-recursive-deletes 'top)
+
+;; Pour perl-mode
+(defalias 'perl-mode 'cperl-mode)
+
+;; Indentation
+(setq-default indent-tabs-mode nil)
+
+;; Toujours avoir nouvelle ligne en fin de fichier
+(setq require-final-newline t)
+
+;; Configuration de debian-changelog
+(setq debian-changelog-full-name "Olivier Tétard")
+(setq debian-changelog-mailing-address "olivier.tetard@miskin.fr")
+
+(setq safe-local-variable-values
+      (quote ((TeX-PDF-mode . PDF))))
+
+;; Stolen from http://xemacs.seanm.ca/lisp/dired-extras.el
+(defun dired-do-apply-function (func)
+  "Apply an interactive lisp function to all the marked files.
+The function is not passed any arguments. The function honours restrictions."
+  (interactive "aFunction: ")
+  (save-excursion
+    (dolist (file (dired-get-marked-files))
+      (message "Processing %s..." file)
+      (set-buffer (find-file-noselect file))
+      (goto-char (point-min))
+      (apply func nil))
+    (message "Done.")))
+
+;; AMOSSYS
+(setq-default c-basic-offset 8)
+(setq-default indent-tabs-mode t)
+
+;; -> END <-
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(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"))))
+ '(canlock-password "a29a3189d5be23f38adc9d2627e77c898e00cde1")
+ '(display-time-24hr-format t)
+ '(inhibit-startup-screen t)
+ '(mail-yank-prefix "> ")
+ '(muse-file-extension "muse")
+ '(muse-html-charset-default "utf-8")
+ '(muse-html-encoding-default (quote utf-8))
+ '(muse-html-meta-content-encoding (quote utf-8))
+ '(muse-html-style-sheet "<link rel=\"stylesheet\" type=\"text/css\" charset=\"utf-8\" media=\"all\" href=\"/style.css\" />")
+ '(muse-mode-auto-p nil)
+ '(muse-publish-desc-transforms (quote (muse-wiki-publish-pretty-title muse-wiki-publish-pretty-interwiki muse-publish-escape-specials-in-string)))
+ '(muse-wiki-publish-small-title-words (quote ("the" "and" "at" "on" "of" "for" "in" "an" "a" "page" "anime")))
+ '(muse-xhtml-footer "~/documents/wiki/common/footer.html")
+ '(muse-xhtml-header "~/documents/wiki/common/header.html")
+ '(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)))))
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(erc-current-nick-face ((t (:foreground "red" :slant oblique :background: "yellow"))))
+ '(highlight-current-line-face ((t (:background "#6699cc"))))
+ '(muse-bad-link-face ((t (:foreground "DeepPink" :underline "DeepPink" :weight bold))))
+ '(muse-link-face ((t (:foreground "blue" :underline "blue" :weight bold)))))