annotate etc/sample.emacs @ 16:0293115a14e9 r19-15b91

Import from CVS: tag r19-15b91
author cvs
date Mon, 13 Aug 2007 08:49:20 +0200
parents 9ee227acff29
children 4103f0995bd7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1 ;; -*- Mode: Emacs-Lisp -*-
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;; This is a sample .emacs file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; The .emacs file, which should reside in your home directory, allows you to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; customize the behavior of Emacs. In general, changes to your .emacs file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;; will not take effect until the next time you start up Emacs. You can load
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; it explicitly with `M-x load-file RET ~/.emacs RET'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; There is a great deal of documentation on customization in the Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;; manual. You can read this manual with the online Info browser: type
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; `C-h i' or select "Emacs Info" from the "Help" menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; Basic Customization ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; Enable the commands `narrow-to-region' ("C-x n n") and
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
20 ;; `eval-expression' ("M-:", or "ESC :"). Both are useful
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; commands, but they can be confusing for a new user, so they're
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; disabled by default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 (put 'narrow-to-region 'disabled nil)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
24 (put 'eval-expression 'disabled nil)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Define a variable to indicate whether we're running XEmacs/Lucid Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; (You do not have to defvar a global variable before using it --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; you can just call `setq' directly like we do for `emacs-major-version'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; below. It's clearer this way, though.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; Make the sequence "C-x w" execute the `what-line' command,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; which prints the current line number in the echo area.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (global-set-key "\C-xw" 'what-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; set up the function keys to do common tasks to reduce Emacs pinky
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; and such.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; Make F1 invoke help
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
41 (global-set-key [f1] 'help-command)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; Make F2 be `undo'
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
43 (global-set-key [f2] 'undo)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; Make F3 be `find-file'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; Note: it does not currently work to say
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; (global-set-key 'f3 "\C-x\C-f")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; The reason is that macros can't do interactive things properly.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; This is an extremely longstanding bug in Emacs. Eventually,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; it will be fixed. (Hopefully ..)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
50 (global-set-key [f3] 'find-file)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;; Make F4 be "mark", F5 be "copy", F6 be "paste"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; Note that you can set a key sequence either to a command or to another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; key sequence.
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
55 (global-set-key [f4] 'set-mark-command)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
56 (global-set-key [f5] "\M-w")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
57 (global-set-key [f6] "\C-y")
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 ;; Shift-F4 is "pop mark off of stack"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (global-set-key '(shift f4) (lambda () (interactive) (set-mark-command t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;; Make F7 be `save-buffer'
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
63 (global-set-key [f7] 'save-buffer)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 ;; Make F8 be "start macro", F9 be "end macro", F10 be "execute macro"
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
66 (global-set-key [f8] 'start-kbd-macro)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
67 (global-set-key [f9] 'end-kbd-macro)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 14
diff changeset
68 (global-set-key [f10] 'call-last-kbd-macro)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 ;; Here's an alternative binding if you don't use keyboard macros:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 ;; Make F8 be `save-buffer' followed by `delete-window'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 ;;(global-set-key 'f8 "\C-x\C-s\C-x0")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 ;; If you prefer delete to actually delete forward then you want to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 ;; uncomment the next line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 ;; (load-library "delbackspace")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (cond (running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 ;; Code for any version of XEmacs/Lucid Emacs goes here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; Change the values of some variables.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ;; (t means true; nil means false.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ;; Use the "Describe Variable..." option on the "Help" menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 ;; to find out what these variables mean.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (setq find-file-use-truenames nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 find-file-compare-truenames t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 minibuffer-confirm-incomplete t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 complex-buffers-menu-p t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 next-line-add-newlines nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 mail-yank-prefix "> "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 kill-whole-line t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;; When running ispell, consider all 1-3 character words as correct.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (setq ispell-extra-args '("-W" "3"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (cond ((or (not (fboundp 'device-type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (equal (device-type) 'x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ;; Code which applies only when running emacs under X goes here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ;; (We check whether the function `device-type' exists
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ;; before using it. In versions before 19.12, there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ;; was no such function. If it doesn't exist, we
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ;; simply assume we're running under X -- versions before
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ;; 19.12 only supported X.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ;; Remove the binding of C-x C-c, which normally exits emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ;; It's easy to hit this by mistake, and that can be annoying.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ;; Under X, you can always quit with the "Exit Emacs" option on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ;; the File menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (global-set-key "\C-x\C-c" nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ;; Uncomment this to enable "sticky modifier keys" in 19.13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 ;; and up. With sticky modifier keys enabled, you can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ;; press and release a modifier key before pressing the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;; key to be modified, like how the ESC key works always.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ;; If you hold the modifier key down, however, you still
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 ;; get the standard behavior. I personally think this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ;; is the best thing since sliced bread (and a *major*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 ;; win when it comes to reducing Emacs pinky), but it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; disorienting at first so I'm not enabling it here by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;; default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;;(setq modifier-keys-are-sticky t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ;; This changes the variable which controls the text that goes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ;; in the top window title bar. (However, it is not changed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ;; unless it currently has the default value, to avoid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 ;; interfering with a -wn command line argument I may have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 ;; started emacs with.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (if (equal frame-title-format "%S: %b")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (setq frame-title-format
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (concat "%S: " invocation-directory invocation-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 " [" emacs-version "]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (if nil ; (getenv "NCD")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 " %b"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 ;; If we're running on display 0, load some nifty sounds that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ;; will replace the default beep. But if we're running on a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ;; display other than 0, which probably means my NCD X terminal,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ;; which can't play digitized sounds, do two things: reduce the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 ;; beep volume a bit, and change the pitch of the sound that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;; made for "no completions."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 ;; (Note that sampled sounds only work if XEmacs was compiled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ;; with sound support, and we're running on the console of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ;; Sparc, HP, or SGI machine, or on a machine which has a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ;; NetAudio server; otherwise, you just get the standard beep.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;; (Note further that changing the pitch and duration of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ;; standard beep only works with some X servers; many servers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;; completely ignore those parameters.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (cond ((string-match ":0" (getenv "DISPLAY"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (load-default-sounds))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (setq bell-volume 40)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (setq sound-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (append sound-alist '((no-completion :pitch 500))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; Make `C-x C-m' and `C-x RET' be different (since I tend
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;; to type the latter by accident sometimes.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (define-key global-map [(control x) return] nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ;; Change the pointer used when the mouse is over a modeline
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (set-glyph-image modeline-pointer-glyph "leftbutton")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 2
diff changeset
173 ;; Change the continuation glyph face so it stands out more
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 2
diff changeset
174 (and (fboundp 'set-glyph-property)
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 2
diff changeset
175 (boundp 'continuation-glyph)
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 2
diff changeset
176 (set-glyph-property continuation-glyph 'face 'bold))
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 2
diff changeset
177
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ;; Change the pointer used during garbage collection.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; Note that this pointer image is rather large as pointers go,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; and so it won't work on some X servers (such as the MIT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;; R5 Sun server) because servers may have lamentably small
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;; upper limits on pointer size.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;;(if (featurep 'xpm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 ;; (set-glyph-image gc-pointer-glyph
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;; (expand-file-name "trash.xpm" data-directory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;; Here's another way to do that: it first tries to load the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;; pointer once and traps the error, just to see if it's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;; possible to load that pointer on this system; if it is,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;; then it sets gc-pointer-glyph, because we know that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ;; will work. Otherwise, it doesn't change that variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 ;; because we know it will just cause some error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (if (featurep 'xpm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (let ((file (expand-file-name "recycle.xpm" data-directory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (if (condition-case error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;; check to make sure we can use the pointer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (make-image-instance file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 '(pointer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (error nil)) ; returns nil if an error occurred.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (set-glyph-image gc-pointer-glyph file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 ;; Add `dired' to the File menu
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
204 (add-menu-button '("File") ["Edit Directory" dired t])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ;; Here's a way to add scrollbar-like buttons to the menubar
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
207 (add-menu-button nil ["Top" beginning-of-buffer t])
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
208 (add-menu-button nil ["<<<" scroll-down t])
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
209 (add-menu-button nil [" . " recenter t])
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
210 (add-menu-button nil [">>>" scroll-up t])
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
211 (add-menu-button nil ["Bot" end-of-buffer t])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;; Change the behavior of mouse button 2 (which is normally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ;; bound to `mouse-yank'), so that it inserts the selected text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;; at point (where the text cursor is), instead of at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; position clicked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ;; Note that you can find out what a particular key sequence or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ;; mouse button does by using the "Describe Key..." option on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 ;; the Help menu.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (setq mouse-yank-at-point t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 ;; When editing C code (and Lisp code and the like), I often
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ;; like to insert tabs into comments and such. It gets to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ;; a pain to always have to use `C-q TAB', so I set up a more
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ;; convenient binding. Note that this does not work in
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
227 ;; TTY frames, where tab and shift-tab are indistinguishable.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (define-key global-map '(shift tab) 'self-insert-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ;; LISPM bindings of Control-Shift-C and Control-Shift-E.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 ;; Note that "\C-C" means Control-C, not Control-Shift-C.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ;; To specify shifted control characters, you must use the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 ;; more verbose syntax used here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (define-key emacs-lisp-mode-map '(control C) 'compile-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (define-key emacs-lisp-mode-map '(control E) 'eval-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ;; If you like the FSF Emacs binding of button3 (single-click
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 ;; extends the selection, double-click kills the selection),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ;; uncomment the following:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; Under 19.13, the following is enough:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ;(define-key global-map 'button3 'mouse-track-adjust)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ;; But under 19.12, you need this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 ;(define-key global-map 'button3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ; (lambda (event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 ; (interactive "e")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ; (let ((default-mouse-track-adjust t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 ; (mouse-track event))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ;; Under both 19.12 and 19.13, you also need this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 ;(add-hook 'mouse-track-click-hook
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ; (lambda (event count)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ; (if (or (/= (event-button event) 3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 ; (/= count 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ; nil ;; do the normal operation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ; (kill-region (point) (mark))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ; t ;; don't do the normal operations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ; )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ;;; Older versions of emacs did not have these variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;;; (emacs-major-version and emacs-minor-version.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ;;; Let's define them if they're not around, since they make
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;;; it much easier to conditionalize on the emacs version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (if (and (not (boundp 'emacs-major-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (string-match "^[0-9]+" emacs-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (setq emacs-major-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (string-to-int (substring emacs-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (match-beginning 0) (match-end 0)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (if (and (not (boundp 'emacs-minor-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (setq emacs-minor-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (string-to-int (substring emacs-version
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (match-beginning 1) (match-end 1)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;;; Define a function to make it easier to check which version we're
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;;; running.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (defun running-emacs-version-or-newer (major minor)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (or (> emacs-major-version major)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (and (= emacs-major-version major)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (>= emacs-minor-version minor))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (cond ((and running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (running-emacs-version-or-newer 19 6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 ;; Code requiring XEmacs/Lucid Emacs version 19.6 or newer goes here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 (cond ((>= emacs-major-version 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 ;; Code for any vintage-19 emacs goes here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (cond ((and (not running-xemacs)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (>= emacs-major-version 19))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 ;; Code specific to FSF Emacs 19 (not XEmacs/Lucid Emacs) goes here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (cond ((< emacs-major-version 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; Code specific to emacs 18 goes here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 ;; Customization of Specific Packages ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 ;;; Load ange-ftp, which uses the FTP protocol as a pseudo-filesystem.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 ;;; When this is loaded, the pathname syntax /user@host:/remote/path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 ;;; refers to files accessible through ftp.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (require 'dired)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (require 'ange-ftp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (setq ange-ftp-default-user "anonymous" ; id to use for /host:/remote/path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 ange-ftp-generate-anonymous-password t ; use $USER@`hostname`
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 ange-ftp-binary-file-name-regexp "." ; always transfer in binary mode
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 ;;; Load the auto-save.el package, which lets you put all of your autosave
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 ;;; files in one place, instead of scattering them around the file system.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (setq auto-save-directory (expand-file-name "~/autosave/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 auto-save-directory-fallback auto-save-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 auto-save-hash-p nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 ange-ftp-auto-save t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 ange-ftp-auto-save-remotely nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 ;; now that we have auto-save-timeout, let's crank this up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 ;; for better interactive response.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 auto-save-interval 2000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 ;; We load this afterwards because it checks to make sure the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 ;; auto-save-directory exists (creating it if not) when it's loaded.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (require 'auto-save)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 ;; This adds additional extensions which indicate files normally
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 ;; handled by cc-mode.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (setq auto-mode-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (append '(("\\.C$" . c++-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 ("\\.cc$" . c++-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 ("\\.hh$" . c++-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 ("\\.c$" . c-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 ("\\.h$" . c-mode))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 auto-mode-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ;;; cc-mode (the mode you're in when editing C, C++, and Objective C files)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 ;; Tell cc-mode not to check for old-style (K&R) function declarations.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 ;; This speeds up indenting a lot.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (setq c-recognize-knr-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 ;; Change the indentation amount to 4 spaces instead of 2.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 ;; You have to do it in this complicated way because of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 ;; strange way the cc-mode initializes the value of `c-basic-offset'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (add-hook 'c-mode-hook (lambda () (setq c-basic-offset 4)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 ;;; Load a partial-completion mechanism, which makes minibuffer completion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 ;;; search multiple words instead of just prefixes; for example, the command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 ;;; `M-x byte-compile-and-load-file RET' can be abbreviated as `M-x b-c-a RET'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 ;;; because there are no other commands whose first three words begin with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 ;;; the letters `b', `c', and `a' respectively.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (load-library "completer")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 ;;; Load crypt, which is a package for automatically decoding and reencoding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 ;;; files by various methods - for example, you can visit a .Z or .gz file,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ;;; edit it, and have it automatically re-compressed when you save it again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (setq crypt-encryption-type 'pgp ; default encryption mechanism
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 crypt-confirm-password t ; make sure new passwords are correct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 ;crypt-never-ever-decrypt t ; if you don't encrypt anything, set this to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 ; tell it not to assume that "binary" files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 ; are encrypted and require a password.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (require 'crypt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 ;;; Edebug is a source-level debugger for emacs-lisp programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (define-key emacs-lisp-mode-map "\C-xx" 'edebug-defun)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 ;;; Font-Lock is a syntax-highlighting package. When it is enabled and you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 ;;; are editing a program, different parts of your program will appear in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 ;;; different fonts or colors. For example, with the code below, comments
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 ;;; appear in red italics, function names in function definitions appear in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 ;;; blue bold, etc. The code below will cause font-lock to automatically be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ;;; enabled when you edit C, C++, Emacs-Lisp, and many other kinds of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 ;;; programs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 ;;; The "Options" menu has some commands for controlling this as well.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (cond (running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 ;; If you want the default colors, you could do this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 ;; (setq font-lock-use-default-fonts nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ;; (setq font-lock-use-default-colors t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ;; but I want to specify my own colors, so I turn off all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ;; default values.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (setq font-lock-use-default-fonts nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (setq font-lock-use-default-colors nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (require 'font-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 ;; Mess around with the faces a bit. Note that you have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 ;; to change the font-lock-use-default-* variables *before*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 ;; loading font-lock, and wait till *after* loading font-lock
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 ;; to customize the faces.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 ;; string face is green
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (set-face-foreground 'font-lock-string-face "forest green")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 ;; comments are italic and red; doc strings are italic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 ;; (I use copy-face instead of make-face-italic/make-face-bold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 ;; because the startup code does intelligent things to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 ;; 'italic and 'bold faces to ensure that they are different
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 ;; from the default face. For example, if the default face
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 ;; is bold, then the 'bold face will be unbold.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (copy-face 'italic 'font-lock-comment-face)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
445 ;; Underlining comments looks terrible on tty's
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (set-face-underline-p 'font-lock-comment-face nil 'global 'tty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (set-face-highlight-p 'font-lock-comment-face t 'global 'tty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (copy-face 'font-lock-comment-face 'font-lock-doc-string-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (set-face-foreground 'font-lock-comment-face "red")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 ;; function names are bold and blue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (copy-face 'bold 'font-lock-function-name-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (set-face-foreground 'font-lock-function-name-face "blue")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 ;; misc. faces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (and (find-face 'font-lock-preprocessor-face) ; 19.13 and above
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (copy-face 'bold 'font-lock-preprocessor-face))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (copy-face 'italic 'font-lock-type-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (copy-face 'bold 'font-lock-keyword-face)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 ;;; fast-lock is a package which speeds up the highlighting of files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 ;;; by saving information about a font-locked buffer to a file and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 ;;; loading that information when the file is loaded again. This
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 ;;; requires a little extra disk space be used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 ;;; Normally fast-lock puts the cache file (the filename appended with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 ;;; .flc) in the same directory as the file it caches. You can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 ;;; specify an alternate directory to use by setting the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 ;;; fast-lock-cache-directories.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 ;; Let's use lazy-lock instead.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ;;(add-hook 'font-lock-mode-hook 'turn-on-fast-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 ;;(setq fast-lock-cache-directories '("/foo/bar/baz"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 ;;; lazy-lock is a package which speeds up the highlighting of files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 ;;; by doing it "on-the-fly" -- only the visible portion of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;;; buffer is fontified. The results may not always be quite as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 ;;; accurate as using full font-lock or fast-lock, but it's *much*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 ;;; faster. No more annoying pauses when you load files.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 ;; I personally don't like "stealth mode" (where lazy-lock starts
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 ;; fontifying in the background if you're idle for 30 seconds)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 ;; because it takes too long to wake up again on my piddly Sparc 1+.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (setq lazy-lock-stealth-time nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 ;;; func-menu is a package that scans your source file for function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 ;;; definitions and makes a menubar entry that lets you jump to any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 ;;; particular function definition by selecting it from the menu. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;;; following code turns this on for all of the recognized languages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 ;;; Scanning the buffer takes some time, but not much.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 ;;; Send bug reports, enhancements etc to:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 ;;; David Hughes <ukchugd@ukpmr.cs.philips.nl>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (cond (running-xemacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (require 'func-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (define-key global-map 'f8 'function-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 (add-hook 'find-file-hooks 'fume-add-menubar-entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (define-key global-map "\C-cl" 'fume-list-functions)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (define-key global-map "\C-cg" 'fume-prompt-function-goto)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 ;; The Hyperbole information manager package uses (shift button2) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 ;; (shift button3) to provide context-sensitive mouse keys. If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 ;; use this next binding, it will conflict with Hyperbole's setup.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 ;; Choose another mouse key if you use Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (define-key global-map '(shift button3) 'mouse-function-menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 ;; For descriptions of the following user-customizable variables,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 ;; type C-h v <variable>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (setq fume-max-items 25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 fume-fn-window-position 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 fume-auto-position-popup t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 fume-display-in-modeline-p t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 fume-menubar-menu-location "File"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 fume-buffer-name "*Function List*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 fume-no-prompt-on-valid-default nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 ;;; MH is a mail-reading system from the Rand Corporation that relies on a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 ;;; number of external filter programs (which do not come with emacs.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 ;;; Emacs provides a nice front-end onto MH, called "mh-e".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 ;; Bindings that let you send or read mail using MH
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
534 ;(global-set-key "\C-xm" 'mh-smail)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 ;(global-set-key "\C-x4m" 'mh-smail-other-window)
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
536 ;(global-set-key "\C-cr" 'mh-rmail)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 ;; Customization of MH behavior.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (setq mh-delete-yanked-msg-window t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (setq mh-yank-from-start-of-msg 'body)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (setq mh-summary-height 11)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ;; Use lines like the following if your version of MH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 ;; is in a special place.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 ;(setq mh-progs "/usr/dist/pkgs/mh/bin.svr4/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 ;(setq mh-lib "/usr/dist/pkgs/mh/lib.svr4/")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 ;;; resize-minibuffer-mode makes the minibuffer automatically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 ;;; resize as necessary when it's too big to hold its contents.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (autoload 'resize-minibuffer-mode "rsz-minibuf" nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (resize-minibuffer-mode)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (setq resize-minibuffer-window-exactly nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 ;;; ********************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 ;;; W3 is a browser for the World Wide Web, and takes advantage of the very
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 ;;; latest redisplay features in XEmacs. You can access it simply by typing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 ;;; 'M-x w3'; however, if you're unlucky enough to be on a machine that is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 ;;; behind a firewall, you will have to do something like this first:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 ;(setq w3-use-telnet t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 ; ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 ; ;; If the Telnet program you use to access the outside world is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 ; ;; not called "telnet", specify its name like this.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 ; w3-telnet-prog "itelnet"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 ; ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 ; ;; If your Telnet program adds lines of junk at the beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 ; ;; of the session, specify the number of lines here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 ; w3-telnet-header-length 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 ; )