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