;; Auteur : Dimitri Fontaine ;; ;; ce fichier permet de configurer emacs et xemacs ;; useful wrappers (setq chk:this-is-gnuemacs (string-match "GNU Emacs" (emacs-version))) (setq chk:this-is-xemacs (string-match "XEmacs" (emacs-version))) ;; if it is emacs 21, no toolbar (if (= emacs-major-version 21) (tool-bar-mode 0)) ;; On text mode (and while editing mail) I don't want the emacs menu (progn (if (not (eq window-system 'x)) (menu-bar-mode nil))) ;; set some options for emacs (progn (if chk:this-is-gnuemacs (progn ;; the colors (if (eq window-system 'x) (progn (set-foreground-color "Black") (set-background-color "lightgray") (set-cursor-color "Black") (set-border-color "DarkSlateBlue") ;; we don't want menu, we don't want scrollbar ... so ;; why xwindow ? note: the menu-bar-mode just want the ;; 0 (zero) argument ... (menu-bar-mode 1) (scroll-bar-mode nil))) ;; Syntax Highlight (setq font-lock-maximum-decoration t font-lock-maximum-size nil) (require 'font-lock) (global-font-lock-mode 1) ;;pour que la région sélectionnée soit mise en surbrillance (setq font-lock-maximum-size nil) (transient-mark-mode t) ;; some useful key bindings (global-set-key [home] (lambda () (interactive) (if (and (bolp) key-home-jump) (beginning-of-buffer) (beginning-of-line)))) (global-set-key [end] (lambda () (interactive) (if (and (eolp) key-home-jump) (end-of-buffer) (end-of-line)))) (global-set-key [delete] 'delete-char) (global-set-key [M-right] 'forward-word) (global-set-key [M-left] 'backward-word) (global-set-key [C-home] 'beginning-of-buffer) (global-set-key [C-end] 'end-of-buffer) ;; (global-set-key [M-g] 'goto-line) (global-set-key "\M-g" 'goto-line) ;; La molette, hop hop (global-set-key '[mouse-4] '(lambda () (interactive) (scroll-down 5))) (global-set-key '[mouse-5] '(lambda () (interactive) (scroll-up 5)))))) ;; set some options for xemacs (progn (if chk:this-is-xemacs ;; syntax highlight (font-lock-mode))) ;; pour les accents français, et tout ce qui s'en suit... (iso-accents-mode t) (require 'iso-insert) (standard-display-european 1) (set-input-mode nil nil 1) ;; Pour les accents français avec des deadkeys (load-file "~/.elisp/iso-francais.el") ;; Afficher l'heure dans la barre d'état (format 24 heures) (setq display-time-24hr-format t) (display-time) ;; Mutt mode ;; (load "/your/local/path/to/this/file/post") ;(server-start) (load "~/.elisp/post") ;; This is also needed to see the magic message. Set to a higher ;; number if you have a faster computer or read slower than me. '(font-lock-verbose 1000) ;; (setq server-temp-file-regexp "mutt-") (add-hook 'server-switch-hook (function (lambda() (cond ((string-match "Post" mode-name) (post-goto-body)))))) ;; Erlang mode (require 'erlang-start) ;; SGML mode indent (setq sgml-auto-activate-dtd t) (setq sgml-indent-data t sgml-indent-step 2 sgml-trace-entity-lookup t sgml-set-face t sgml-live-element-indicator t) ;; SGML syntax highlight colors defintion (make-face 'sgml-comment-face) (make-face 'sgml-doctype-face) (make-face 'sgml-end-tag-face) (make-face 'sgml-entity-face) (make-face 'sgml-ignored-face) (make-face 'sgml-ms-end-face) (make-face 'sgml-ms-start-face) (make-face 'sgml-pi-face) (make-face 'sgml-sgml-face) (make-face 'sgml-short-ref-face) (make-face 'sgml-start-tag-face) (set-face-foreground 'sgml-comment-face "dark green") (set-face-foreground 'sgml-doctype-face "maroon") (set-face-foreground 'sgml-end-tag-face "blue2") (set-face-foreground 'sgml-entity-face "red2") (set-face-foreground 'sgml-ignored-face "maroon") (set-face-background 'sgml-ignored-face "wheat") (set-face-foreground 'sgml-ms-end-face "maroon") (set-face-foreground 'sgml-ms-start-face "maroon") (set-face-foreground 'sgml-pi-face "maroon") (set-face-foreground 'sgml-sgml-face "maroon") (set-face-foreground 'sgml-short-ref-face "goldenrod") (set-face-foreground 'sgml-start-tag-face "blue2") (setq-default sgml-markup-faces '((comment . sgml-comment-face) (doctype . sgml-doctype-face) (end-tag . sgml-end-tag-face) (entity . sgml-entity-face) (ignored . sgml-ignored-face) (ms-end . sgml-ms-end-face) (ms-start . sgml-ms-start-face) (pi . sgml-pi-face) (sgml . sgml-sgml-face) (short-ref . sgml-short-ref-face) (start-tag . sgml-start-tag-face))) (put 'narrow-to-region 'disabled nil) ;; Mon adresse email (setq user-mail-address "dfontaine@CVF.fr") ;; Pour pouvoir poster dans les news :) (defun mm-mime-charset (charset) "Return the MIME charset corresponding to the MULE CHARSET." (if (and (fboundp 'coding-system-get) (fboundp 'get-charset-property)) ;; This exists in Emacs 20. (or (and (mm-preferred-coding-system charset) (coding-system-get (mm-preferred-coding-system charset) 'mime-charset)) (and (eq charset 'ascii) 'us-ascii) (mm-preferred-coding-system charset) (mm-mule-charset-to-mime-charset charset)) ;; This is for XEmacs. (mm-mule-charset-to-mime-charset charset))) ;; Mule specific initialization (cond ((featurep 'mule) (modify-coding-system-alist 'file "\\.euc-jp$" 'euc-jp) (modify-coding-system-alist 'file "\\.shift_jis$" 'shift_jis) (modify-coding-system-alist 'file "\\.iso-2022-jp$" 'iso-2022-jp) ; gotta do the next stuff so crypt++ doesn't lose in mule. (modify-coding-system-alist 'file "\\.pgp$" 'no-conversion) (modify-coding-system-alist 'file "\\.gpg$" 'no-conversion) ; TBD remove these at some point in the future when no longer ; referenced. (if (not (fboundp 'coding-system-get)) (defun coding-system-get (foo bar))) (if (not (fboundp 'get-charset-property)) (defun get-charset-property (a b))) (if (not (boundp 'coding-system-for-read)) (setq coding-system-for-read nil)) )) ;; Définition des fonctions utilisées pour faire défiler les tampons ;; (merci à Dominique Quatravaux) (if (not (fboundp 'switch-to-other-buffer)) (defun switch-to-other-buffer (arg) "Switch to the previous buffer. With a numeric arg, n, switch to the nth most recent buffer. With an arg of 0, buries the current buffer at the bottom of the buffer stack." (interactive "p") (if (eq arg 0) (bury-buffer (current-buffer)) ) (switch-to-buffer (if (<= arg 1) ; vrai (other-buffer (current-buffer)) ; faux (nth (1+ arg) (buffer-list)) ) ) ) ) ;; Cette fonction affiche le tampon suivant dans la liste (defun switch-to-next-buffer () "Switch to next buffer" (interactive) (switch-to-other-buffer 0) ) ;; Cette fonction affiche le tampon précédent dans la liste (defun switch-to-prev-buffer () "Switch to previous buffer" (interactive) (while (string-match "\\` " (buffer-name (switch-to-other-buffer (- (length (buffer-list)) 2)) ) ) ) ) ;; Touche « F3 » <=> « Basculer dans le tampon précédent » ;; Touche « F4 » <=> « Basculer dans le tampon suivant » (global-set-key [f3] 'switch-to-prev-buffer) (global-set-key [f4] 'switch-to-next-buffer)