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