Created
September 30, 2023 17:21
-
-
Save zdimension/74961c0fd8574d87882219bfe185d5a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;============================================================================== | |
; | |
; Fichier d'initialisation Emacs | |
; | |
; Creation date: Quelque part en 1984 !!! | |
; Last file update: 10-Sep-2001 21:36 (eg) | |
; | |
;============================================================================== | |
;============================================================================== | |
; DETERMINATION DU TYPE D'EMACS | |
;============================================================================== | |
(defun running-emacs () | |
(string-match "Emacs" (emacs-version))) | |
(defun running-xemacs () | |
(string-match "Xemacs" (emacs-version))) | |
(defun compile-current-file () | |
(write-region (point-min) (point-max) buffer-file-name nil 't) | |
(byte-compile-file buffer-file-name t)) | |
;============================================================================== | |
; MISE A JOUR DES VARIABLES GLOBALES | |
;============================================================================== | |
(setq inhibit-startup-message t) ; pour eviter le blabla initial | |
(setq default-major-mode 'indented-text-mode) | |
(setq load-path (cons (expand-file-name "~/emacs") | |
load-path)) | |
(setq auto-mode-alist | |
(append '(("\\.tex$" . latex-mode) | |
("\\.jl$" . sawfish-mode)) | |
auto-mode-alist)) | |
;============================================================================== | |
; FICHIERS A CHARGER | |
;============================================================================== | |
(defvar coding-system-for-read ; A VIRER: n�cessaire pour XEmacs 21.1.7 | |
'binary) ; pour que la d�compression automatique marche | |
(load-library "jka-compr") ; Lecture des fichiers compress�s | |
(load-library "tar-mode") ; Mode dired pour tar | |
(when (running-xemacs) | |
(require 'iso8859-1) ; consid�rer les accents comme des lettres | |
(set-standard-case-table iso8859/1-case-table) | |
(add-hook 'find-file-hooks (lambda () (set-case-table iso8859/1-case-table)))) | |
(require 'dabbrev) ; Peut-on vivre sans �a? | |
(when (running-xemacs) | |
(load-library "mic-paren") ; et �a? | |
(load-library "scroll-in-place"); pour un scroll moins chaotique | |
(load-library "eg-mouse")) ; Souris ImWheel | |
(load-library "stk") ; Mode STk | |
(auto-compression-mode) ; Se mettre en mode compression par d�faut | |
;(toggle-auto-compression 1 t) ; obsol�te | |
;============================================================================= | |
; GNUSERV | |
;============================================================================= | |
;(load-library "gnuserv") | |
;(gnuserv-start) | |
;============================================================================== | |
; FLYSPELL | |
;============================================================================== | |
(autoload 'flyspell-mode "flyspell" "On-the-fly ispell." t) | |
(autoload 'flyspell-prog-mode "flyspell" "On-the-fly ispell." t) | |
(autoload 'flyspell-mode-on "flyspell" "On-the-fly ispell." t) | |
(autoload 'flyspell-mode-off "flyspell" "On-the-fly ispell." t) | |
(setq flyspell-auto-correct-binding nil) | |
(setq *flyspell-mode* '("american" "francais" "none")) | |
(defun flyspell-change-mode () | |
(interactive) | |
(let ((new (car *flyspell-mode*))) | |
(if (equal new "none") | |
(flyspell-mode -1) | |
(progn | |
(flyspell-mode 1) | |
(ispell-change-dictionary new))) | |
(setq *flyspell-mode* (append (cdr *flyspell-mode*) (list new))) | |
(message (concat "Flyspell: " new)))) | |
(add-hook 'mail-send-hook 'flyspell-mode-off) | |
;============================================================================== | |
; TEXT MODE | |
;============================================================================== | |
;(add-hook 'text-mode-hook 'flyspell-mode) | |
;============================================================================== | |
; LaTeX MODE | |
;============================================================================== | |
(autoload 'latex-mode "latex") | |
(add-hook 'LaTeX-mode-hook #'(lambda() | |
(require 'eg-latex) | |
(setq tex-dvi-view-command "xdvi") | |
(auto-fill-mode 1) | |
(outl-mouse-minor-mode) | |
(setq default-fill-column 75) | |
(setq TeX-master nil) ; pour demander le master-file | |
(local-set-key "'" 'accent-aigu) | |
(local-set-key "`" 'accent-grave) | |
(local-set-key "^" 'accent-circonflexe))) | |
;============================================================================== | |
; GDB MODE | |
;============================================================================== | |
(add-hook 'gdb-mode '(lambda () | |
(require 'gdbsrc))) | |
;============================================================================== | |
; C MODE | |
;============================================================================== | |
(add-hook 'c-mode-hook | |
'(lambda () | |
(setq c-style-alist | |
(cons '("eg" | |
(c-basic-offset . 2) | |
(c-comment-only-line-offset . (0 . 0)) | |
(c-offsets-alist . ((statement-block-intro . +) | |
(knr-argdecl-intro . 5) | |
(substatement-open . +) | |
(label . 0) | |
(case-label . +) | |
(statement-case-open . +) | |
(statement-cont . +))) | |
(c-hanging-colons-alist . ((member-init-intro before) | |
(inher-intro) | |
(case-label after) | |
(label after) | |
(access-label after)))) | |
c-style-alist)) | |
(c-set-style "eg"))) | |
;============================================================================== | |
; INFO | |
;============================================================================== | |
;; Accepter les fichiers compress�s par bzip | |
(require 'info) | |
(setq Info-suffix-list | |
(append '((".info.bz2" . "bzip2 -dc %s") | |
(".bz2" . "bzip2 -dc %s")) | |
Info-suffix-list)) | |
;(set-face-foreground 'info-xref "blue") | |
;(set-face-foreground 'info-node "firebrick") | |
(defface info-heading '((t (:bold t))) | |
"Face used for headings in info." | |
:group 'info-faces) | |
(set-face-foreground 'info-heading "red") | |
(defadvice Info-fontify-node (after Info-fontify-node-extra activate) | |
(save-excursion | |
(let ((case-fold-search nil) | |
p) | |
;;; ** hide xref `dressing' ** | |
;; -- there seems 4 types of xref info links -- | |
;; 1. *note <node>:: | |
;; 2. *note <label>: <node>[,.] | |
;; 3. *note (<infofile>)<node>:: | |
;; 4. *note <label>: (<infofile>)<node>[,.] | |
(goto-char (point-min)) | |
(while (re-search-forward "\\(*[Nn]ote[ \t\n]*\\)\\(([^()]*)\\)?\\([^:]+\\)\\(:[^:;.,]*[:;.,]\\)" nil t) | |
(set-extent-property (make-extent (match-beginning 1) (match-end 1)) | |
'invisible t) | |
(set-extent-property (make-extent (match-beginning 4) (match-end 4)) | |
'invisible t) | |
(and (match-beginning 2) | |
(null (equal (match-string 3) "Top")) | |
(set-extent-property (make-extent (match-beginning 2) (match-end 2)) | |
'invisible t))) | |
;; hilite lines of CAP-letters | |
(goto-char (point-min)) | |
(while (re-search-forward "\n\\([A-Z][A-Z0-9 _]+\\)\n" nil t) | |
(set-extent-property (make-extent (match-beginning 1) (match-end 1)) | |
'face 'info-heading)) | |
;; hilite 'underlined' lines: | |
(goto-char (point-min)) | |
(while (re-search-forward "\n\\(-+\\|=+\\|\\*+\\)\n" nil t) | |
(setq p (point)) | |
(save-excursion | |
(next-line -2) | |
(beginning-of-line) | |
(set-extent-property (make-extent (point) p) | |
'face 'info-heading)))))) | |
;============================================================================= | |
; W3 | |
; | |
; C'est juste un peu mieux, mais pas g�nial tout de m�me (l� je l'avoue). | |
;============================================================================= | |
(setq-default url-be-asynchronous t) | |
(setq w3-delay-image-loads t | |
w3-user-fonts-take-precedence t | |
w3-honor-stylesheets nil | |
w3-do-incremental-display t) | |
;============================================================================== | |
; DIVERS | |
;============================================================================== | |
(setq compile-command "make ") ; mieux que make -k | |
(setq compilation-window-height 15) | |
(setq minibuffer-max-depth nil) ; Edition recursives dans le mini-buffer | |
(resize-minibuffer-mode 1) ; Le minibuffer se retaille automatiquement | |
;(setq minibuffer-confirm-incomplete t) ; Demande confirmation si fichier inexistant | |
(put 'eval-expression 'disabled nil) | |
(custom-set-variables '(display-time-24hr-format t) | |
'(ps-print-color-p t) | |
'(query-user-mail-address nil)) | |
(setq options-save-faces t) | |
(setq require-final-newline nil) | |
(add-hook 'find-file-hooks 'font-lock-fontify-buffer) ; Toujours font-lock | |
(setq highlight-headers-follow-url-function ; Netscape pour les URL | |
'highlight-headers-follow-url-netscape) | |
(setq-default buffers-menu-sort-function | |
'sort-buffers-menu-by-mode-then-alphabetically | |
buffers-menu-grouping-function | |
'group-buffers-menu-by-mode-then-alphabetically | |
buffers-menu-submenus-for-groups-p t) | |
;============================================================================= | |
; X11 | |
;============================================================================= | |
(when (and (running-xemacs) (equal (device-type) 'x)) | |
;;; Touche compose | |
(load-library "x-compose") | |
;;; Function menu | |
(load-library "func-menu") | |
(define-key global-map 'f9 'function-menu) | |
(define-key global-map '[(control c) (l)] 'fume-list-functions) | |
(define-key global-map '(shift button3) 'mouse-function-menu) | |
;;; Cl�s mortes | |
(global-set-key [dead-circumflex] compose-circumflex-map) | |
(global-set-key [dead-diaeresis] compose-diaeresis-map) | |
;;; Bricoles | |
;(load-default-sounds) ; C'est plus rigolo | |
;(display-time) ; Heure et charge | |
;(load-library "bbdb-frame") ; BBDB dans une frame | |
;; Gestion de la Toolbar | |
(global-set-key '[(control x) (t)] | |
'(lambda () | |
(interactive) | |
(set-specifier default-toolbar-visible-p | |
(not (specifier-instance default-toolbar-visible-p))))) | |
(if (featurep 'xpm) | |
(set-glyph-image gc-pointer-glyph | |
(expand-file-name "recycle.xpm" data-directory))) | |
; (when (featurep 'menubar) | |
; ;; Add `dired' to the File menu | |
; (add-menu-button '("File") ["Edit Directory" dired t]) | |
; | |
; ;; Here's a way to add scrollbar-like buttons to the menubar | |
; (add-menu-button nil ["Top" beginning-of-buffer t]) | |
; (add-menu-button nil ["<<<" scroll-down t]) | |
; (add-menu-button nil [" . " recenter t]) | |
; (add-menu-button nil [">>>" scroll-up t]) | |
; (add-menu-button nil ["Bot" end-of-buffer t])) | |
(custom-set-faces | |
'(excerpt ((t (:bold t :foreground "gray30")))) | |
'(zmacs-region ((t (:foreground "Ivory3" :background "SlateBlue2"))) t)) | |
;;; Recent files | |
(load-library "recent-files") | |
(recent-files-initialize) | |
;;; Buffer toujours mis dans des frames s�par�es | |
(setq special-display-buffer-names | |
'(("*compilation*" (width . 80) (height . 15) ;; (minibuffer . nil) | |
(has-modeline-p . nil) (menubar-visible-p . nil) | |
(default-toolbar-visible-p . nil)) | |
("*run*" (width . 80) (height . 10)) | |
("*ielm" (width . 80) (height . 24)) | |
"*shell*")) | |
(setq same-window-buffer-names | |
'("*inferior-lisp*")) | |
(setq special-display-frame-alist ;; La valeur par d�fault | |
'((width . 80) (height . 40))) | |
(add-hook 'compilation-mode-hook '(lambda () (raise-frame))) | |
(when (equal (user-uid) 0) | |
;; Changer la couleur de fond d'emacs si on est root (coral2). C'est laid | |
;; mais c'est fait expr�s | |
(let ((def (color-name (face-background 'default))) | |
(faces (face-list))) | |
(while faces | |
(let ((obg (face-background (car faces)))) | |
(if (and obg (equal def (color-name obg))) | |
(set-face-background (car faces) "coral2"))) | |
(setq faces (cdr faces)))))) | |
;============================================================================== | |
; RE-ASSOCIATIONS DE TOUCHES | |
;============================================================================== | |
(defun start-or-end-kbd-macro () | |
(interactive) | |
(if defining-kbd-macro | |
(end-kbd-macro) | |
(start-kbd-macro nil))) | |
;; L�, on ne d�finit pas grand chose pour les utilisateurs de Emacs. | |
;; Tant pis pour eux, ils n'ont qu'� passer � Xemacs ;-) | |
(when (running-xemacs) | |
(define-key global-map 'f1 'help-command) | |
(define-key global-map 'f2 'undo) | |
(define-key global-map 'f3 'find-file-other-frame) | |
(define-key global-map 'f4 'font-lock-mode) | |
(define-key global-map 'f5 'flyspell-change-mode) | |
(define-key global-map 'f10 'recompile) | |
(define-key global-map '(control f10) 'compile) | |
(define-key global-map 'f11 'next-error) | |
(define-key global-map '(control f11) 'previous-error) | |
(define-key global-map 'f12 'call-last-kbd-macro) | |
(define-key global-map '(control f12) 'start-or-end-kbd-macro) | |
;(define-key global-map '(control tab) 'bury-buffer) | |
(define-key global-map '(shift tab) 'self-insert-command) ; pas de ^Q | |
(define-key global-map '[iso-left-tab] 'self-insert-command) ; XFree 4.0 | |
;(define-key global-map [(control x) (b)] 'iswitchb-buffer) ; mieux | |
(define-key global-map 'delete 'backward-delete-char-untabify) | |
(define-key global-map 'backspace 'backward-delete-char-untabify) | |
(define-key global-map [(control x) (return)] 'shell) ; � la Epsilon | |
(define-key global-map '(meta g) 'goto-line) ; � la Epsilon | |
(define-key global-map '(meta *) 'font-lock-fontify-buffer) | |
(define-key global-map [(control x) (m)] 'vm-mail) | |
(define-key global-map '(control meta $) | |
'(lambda () | |
(interactive) | |
(ispell-change-dictionary "francais"))) | |
(define-key global-map '(super d) ; Enlever ces !!??!@@!#?%$�� de C-m de DOS | |
'(lambda () | |
(interactive) | |
(save-excursion | |
(goto-char 0) | |
(replace-string " | |
" "")))) | |
(define-key global-map '(control return) 'dabbrev-expand)) | |
;; R�pondre toujours avec y/n. A ne pas mettre entre toutes les mains | |
;(fset 'yes-or-no-p 'y-or-n-p) | |
;; Gestion du focus | |
;(setq focus-follows-mouse t) | |
;============================================================================= | |
; On termine en affichant la version dans le mini-buffer (ce qui permet de | |
; voir que l'on est arriv� au bout) | |
;============================================================================= | |
(message (emacs-version)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment