1 |
;; Mandrakelinux Configuration |
2 |
; Chmouel Boudjnah <chmouel@mandrakesoft.com>. |
3 |
; Pixel <pixel@mandrakesoft.com>. |
4 |
; Thanks to Eric Marsden <emarsden@mail.dotcom.fr>. |
5 |
|
6 |
;; Some macros. |
7 |
(defmacro GNUEmacs (&rest x) |
8 |
(list 'if (string-match "GNU Emacs 20" (version)) (cons 'progn x))) |
9 |
(defmacro XEmacs (&rest x) |
10 |
(list 'if (string-match "XEmacs 21" (version)) (cons 'progn x))) |
11 |
(defmacro Xlaunch (&rest x) |
12 |
(list 'if (eq window-system 'x)(cons 'progn x))) |
13 |
|
14 |
|
15 |
(GNUEmacs |
16 |
(Xlaunch |
17 |
(define-key global-map [(delete)] "\C-d") |
18 |
)) |
19 |
|
20 |
(GNUEmacs |
21 |
; XEmacs compatibility |
22 |
(global-set-key [(control tab)] `other-window) |
23 |
(global-set-key [(meta g)] `goto-line) |
24 |
(defun switch-to-other-buffer () (interactive) (switch-to-buffer (other-buffer))) |
25 |
(global-set-key [(meta control ?l)] `switch-to-other-buffer) |
26 |
|
27 |
(global-set-key [(meta O) ?H] 'beginning-of-line) |
28 |
(global-set-key [home] 'beginning-of-line) |
29 |
(global-set-key [(meta O) ?F] 'end-of-line) |
30 |
(global-set-key [end] 'end-of-line) |
31 |
(setq next-line-add-newlines nil)) |
32 |
|
33 |
; X selection manipulation |
34 |
(GNUEmacs (defun x-own-selection (s) (x-set-selection `PRIMARY s))) |
35 |
(global-set-key [(shift insert)] '(lambda () (interactive) (insert (x-get-selection)))) |
36 |
(global-set-key [(control insert)] '(lambda () (interactive) (x-own-selection (buffer-substring (point) (mark))))) |
37 |
|
38 |
; Shift-arrows a la windows... |
39 |
(GNUEmacs (custom-set-variables |
40 |
'(pc-select-meta-moves-sexps t) |
41 |
'(pc-select-selection-keys-only t) |
42 |
'(pc-selection-mode t nil (pc-select)))) |
43 |
|
44 |
(XEmacs |
45 |
(if (eq window-system 'x) |
46 |
(global-set-key (read-kbd-macro "DEL") 'delete-char) |
47 |
(or (global-set-key "[3~" 'delete-char)) |
48 |
)) |
49 |
|
50 |
;; By default we starting in text mode. |
51 |
(setq initial-major-mode |
52 |
(lambda () |
53 |
(text-mode) |
54 |
(turn-on-auto-fill) |
55 |
(font-lock-mode) |
56 |
)) |
57 |
|
58 |
(GNUEmacs (setq revert-without-query (cons "TAGS" revert-without-query))) |
59 |
|
60 |
; Use the following for i18n |
61 |
;(standard-display-european t) |
62 |
;(GNUEmacs (set-language-environment "latin-1")) |
63 |
;(XEmacs (require 'x-compose)) |
64 |
|
65 |
; Some new Colors for Font-lock. |
66 |
(setq font-lock-mode-maximum-decoration t) |
67 |
(require 'font-lock) |
68 |
(setq font-lock-use-default-fonts nil) |
69 |
(setq font-lock-use-default-colors nil) |
70 |
(copy-face 'default 'font-lock-string-face) |
71 |
(set-face-foreground 'font-lock-string-face "Sienna") |
72 |
(copy-face 'italic 'font-lock-comment-face) |
73 |
(set-face-foreground 'font-lock-comment-face "Red") |
74 |
(copy-face 'bold 'font-lock-function-name-face) |
75 |
(set-face-foreground 'font-lock-function-name-face "MediumBlue") |
76 |
(copy-face 'default 'font-lock-keyword-face) |
77 |
(set-face-foreground 'font-lock-keyword-face "SteelBlue") |
78 |
(copy-face 'default 'font-lock-type-face) |
79 |
(set-face-foreground 'font-lock-type-face "DarkOliveGreen") |
80 |
(GNUEmacs (set-face-foreground 'modeline "red") |
81 |
(set-face-background 'modeline "lemonchiffon")) |
82 |
|
83 |
(GNUEmacs |
84 |
(setq transient-mark-mode 't) |
85 |
) |
86 |
|
87 |
(XEmacs |
88 |
(set-face-foreground 'bold-italic "Blue") |
89 |
) |
90 |
|
91 |
(GNUEmacs |
92 |
(Xlaunch |
93 |
(make-face-bold 'bold-italic) |
94 |
)) |
95 |
|
96 |
(set-face-foreground 'bold-italic "Blue") |
97 |
|
98 |
(setq default-frame-alist |
99 |
'( |
100 |
;;; Define here the default geometry or via ~/.Xdefaults. |
101 |
;; (width . 84) (height . 46) |
102 |
(cursor-color . "red") |
103 |
(cursor-type . box) |
104 |
(foreground-color . "black") |
105 |
(background-color . "honeydew"))) |
106 |
|
107 |
;; A small exemples to show how Emacs is powerfull. |
108 |
; Define function to match a parenthesis otherwise insert a % |
109 |
|
110 |
(global-set-key "%" 'match-paren) |
111 |
(defun match-paren (arg) |
112 |
"Go to the matching parenthesis if on parenthesis otherwise insert %." |
113 |
(interactive "p") |
114 |
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1)) |
115 |
((looking-at "\\s\)") (forward-char 1) (backward-list 1)) |
116 |
(t (self-insert-command (or arg 1))))) |
117 |
|
118 |
;; By default turn on colorization. |
119 |
(if (fboundp 'global-font-lock-mode) |
120 |
(global-font-lock-mode t) |
121 |
) |
122 |
|
123 |
;; Add bzip2 suffixes to info reader. |
124 |
(XEmacs |
125 |
(require 'info) |
126 |
(setq Info-suffix-list |
127 |
(append '( |
128 |
(".info.bz2" . "bzip2 -dc %s") |
129 |
(".bz2" . "bzip2 -dc %s") |
130 |
) |
131 |
Info-suffix-list)) |
132 |
) |
133 |
|
134 |
;; More information with the info file (Control-h i) |