summaryrefslogtreecommitdiffstats
path: root/emacs
blob: 17bf781fae17456ed8dc2e5a91c1c7432501ebca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
;; Linux-Mandrake Configuration
; Chmouel Boudjnah <chmouel@mandrakesoft.com>.
; Pixel <pixel@mandrakesoft.com>.
; Thanks to Eric Marsden <emarsden@mail.dotcom.fr>.

;; Some macros.
(defmacro GNUEmacs (&rest x)
  (list 'if (string-match "GNU Emacs 20" (version)) (cons 'progn x)))
(defmacro XEmacs (&rest x)
  (list 'if (string-match "XEmacs 21" (version)) (cons 'progn x)))
(defmacro Xlaunch (&rest x)
  (list 'if (eq window-system 'x)(cons 'progn x)))


(GNUEmacs 
 (Xlaunch
     (define-key global-map [(delete)]    "\C-d") 
))

(GNUEmacs 
 ; XEmacs compatibility
 (global-set-key [(control tab)] `other-window)
 (global-set-key [(meta g)] `goto-line)
 (defun switch-to-other-buffer () (interactive) (switch-to-buffer (other-buffer)))
 (global-set-key [(meta control ?l)] `switch-to-other-buffer)

 (global-set-key [(meta O) ?H] 'beginning-of-line)
 (global-set-key [home] 'beginning-of-line)
 (global-set-key [(meta O) ?F] 'end-of-line)
 (global-set-key [end] 'end-of-line) 
 (setq next-line-add-newlines nil))

; X selection manipulation
(GNUEmacs (defun x-own-selection (s) (x-set-selection `PRIMARY s)))
(global-set-key [(shift insert)] '(lambda () (interactive) (insert (x-get-selection))))
(global-set-key [(control insert)] '(lambda () (interactive) (x-own-selection (buffer-substring (point) (mark)))))

; Shift-arrows a la windows...
(GNUEmacs (custom-set-variables
 '(pc-select-meta-moves-sexps t)
 '(pc-select-selection-keys-only t)
 '(pc-selection-mode t nil (pc-select))))

(XEmacs
 (if (eq window-system 'x)
     (global-set-key (read-kbd-macro "DEL") 'delete-char)
   (or (global-set-key "[3~" 'delete-char))
   ))

;; By default we starting in text mode.
(setq initial-major-mode
      (lambda ()
        (text-mode)
        (turn-on-auto-fill)
	(font-lock-mode)
	))

(GNUEmacs (setq revert-without-query (cons "TAGS" revert-without-query)))

; Use the following for i18n
;(standard-display-european t)
;(GNUEmacs (set-language-environment "latin-1"))
;(XEmacs (require 'x-compose))

; Some new Colors for Font-lock.
(setq font-lock-mode-maximum-decoration t)
(require 'font-lock)
(setq font-lock-use-default-fonts nil)
(setq font-lock-use-default-colors nil)
(copy-face 'default 'font-lock-string-face)
(set-face-foreground 'font-lock-string-face "Sienna")
(copy-face 'italic 'font-lock-comment-face)
(set-face-foreground 'font-lock-comment-face "Red")
(copy-face 'bold 'font-lock-function-name-face)
(set-face-foreground 'font-lock-function-name-face "MediumBlue")
(copy-face 'default 'font-lock-keyword-face)
(set-face-foreground 'font-lock-keyword-face "SteelBlue")
(copy-face 'default 'font-lock-type-face)
(set-face-foreground 'font-lock-type-face "DarkOliveGreen")
(GNUEmacs (set-face-foreground 'modeline "red")
	  (set-face-background 'modeline "lemonchiffon"))

(GNUEmacs
 (setq transient-mark-mode 't)
 )

(XEmacs
 (set-face-foreground 'bold-italic "Blue")
 )

(GNUEmacs
 (Xlaunch
  (make-face-bold 'bold-italic)
  ))

(set-face-foreground 'bold-italic "Blue")

(setq default-frame-alist
      '(
;;; Define here the default geometry or via ~/.Xdefaults.
;;	(width . 84) (height . 46)
	(cursor-color . "red")
	(cursor-type . box)
	(foreground-color . "black")
	(background-color . "honeydew")))

;; A small exemples to show how Emacs is powerfull.
; Define function to match a parenthesis otherwise insert a %

(global-set-key "%" 'match-paren)
(defun match-paren (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert %."
  (interactive "p")
  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
        ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
        (t (self-insert-command (or arg 1)))))

;; By default turn on colorization.
(if (fboundp 'global-font-lock-mode)
    (global-font-lock-mode t)
  )

;; Add bzip2 suffixes to info reader.
(XEmacs
 (require 'info)
 (setq Info-suffix-list
       (append '(
		 (".info.bz2" . "bzip2 -dc %s")
		 (".bz2"      . "bzip2 -dc %s")
		 )
	       Info-suffix-list))
 )

;; More information with the info file (Control-h i)