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