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
|
16
|
41 (global-set-key [f1] 'help-command)
|
0
|
42 ;; Make F2 be `undo'
|
16
|
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 ..)
|
16
|
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.
|
16
|
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'
|
16
|
63 (global-set-key [f7] 'save-buffer)
|
0
|
64
|
|
65 ;; Make F8 be "start macro", F9 be "end macro", F10 be "execute macro"
|
16
|
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
|
12
|
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 ))
|
|
265
|
24
|
266 ;; Oh, and here's a cute hack you might want to put in the sample .emacs
|
|
267 ;; file: it changes the color of the window if it's not on the local
|
|
268 ;; machine, or if it's running as root:
|
|
269
|
|
270 ;; local emacs background: whitesmoke
|
|
271 ;; remote emacs background: palegreen1
|
|
272 ;; root emacs background: coral2
|
|
273 (cond
|
|
274 ((and (string-match "XEmacs" emacs-version)
|
|
275 (eq window-system 'x)
|
|
276 (boundp 'emacs-major-version)
|
|
277 (= emacs-major-version 19)
|
|
278 (>= emacs-minor-version 12))
|
|
279 (let* ((root-p (eq 0 (user-uid)))
|
|
280 (dpy (or (getenv "DISPLAY") ""))
|
|
281 (remote-p (not
|
|
282 (or (string-match "^\\(\\|unix\\|localhost\\):" dpy)
|
|
283 (let ((s (system-name)))
|
|
284 (if (string-match "\\.\\(netscape\\|mcom\\)\\.com" s)
|
|
285 (setq s (substring s 0 (match-beginning 0))))
|
|
286 (string-match (concat "^" (regexp-quote s)) dpy)))))
|
|
287 (bg (cond (root-p "coral2")
|
|
288 (remote-p "palegreen1")
|
|
289 (t nil))))
|
|
290 (cond (bg
|
|
291 (let ((def (color-name (face-background 'default)))
|
26
|
292 (faces (face-list)))
|
24
|
293 (while faces
|
|
294 (let ((obg (face-background (car faces))))
|
|
295 (if (and obg (equal def (color-name obg)))
|
|
296 (set-face-background (car faces) bg)))
|
|
297 (setq faces (cdr faces)))))))))
|
|
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 ;;; ********************
|
24
|
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)
|
24
|
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
|
26
|
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))))
|
24
|
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")))))
|
26
|
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 )
|
24
|
399 )
|
0
|
400
|
42
|
401 ;;; ********************
|
|
402 ;;; Load the default-dir.el package which installs fancy handling
|
|
403 ;;; of the initial contents in the minibuffer when reading
|
|
404 ;;; file names.
|
|
405
|
|
406 (if (and running-xemacs
|
|
407 (or (and (= emacs-major-version 20) (>= emacs-minor-version 1))
|
|
408 (and (= emacs-major-version 19) (>= emacs-minor-version 15))))
|
|
409 (require 'default-dir))
|
0
|
410
|
|
411 ;;; ********************
|
|
412 ;;; Load the auto-save.el package, which lets you put all of your autosave
|
|
413 ;;; files in one place, instead of scattering them around the file system.
|
|
414 ;;;
|
|
415 (setq auto-save-directory (expand-file-name "~/autosave/")
|
|
416 auto-save-directory-fallback auto-save-directory
|
|
417 auto-save-hash-p nil
|
24
|
418 efs-auto-save t
|
|
419 efs-auto-save-remotely nil
|
0
|
420 ;; now that we have auto-save-timeout, let's crank this up
|
|
421 ;; for better interactive response.
|
|
422 auto-save-interval 2000
|
|
423 )
|
|
424 ;; We load this afterwards because it checks to make sure the
|
|
425 ;; auto-save-directory exists (creating it if not) when it's loaded.
|
|
426 (require 'auto-save)
|
|
427
|
|
428 ;; This adds additional extensions which indicate files normally
|
|
429 ;; handled by cc-mode.
|
|
430 (setq auto-mode-alist
|
|
431 (append '(("\\.C$" . c++-mode)
|
|
432 ("\\.cc$" . c++-mode)
|
|
433 ("\\.hh$" . c++-mode)
|
|
434 ("\\.c$" . c-mode)
|
|
435 ("\\.h$" . c-mode))
|
|
436 auto-mode-alist))
|
|
437
|
|
438
|
|
439 ;;; ********************
|
|
440 ;;; cc-mode (the mode you're in when editing C, C++, and Objective C files)
|
|
441
|
|
442 ;; Tell cc-mode not to check for old-style (K&R) function declarations.
|
|
443 ;; This speeds up indenting a lot.
|
|
444 (setq c-recognize-knr-p nil)
|
|
445
|
|
446 ;; Change the indentation amount to 4 spaces instead of 2.
|
|
447 ;; You have to do it in this complicated way because of the
|
|
448 ;; strange way the cc-mode initializes the value of `c-basic-offset'.
|
|
449 (add-hook 'c-mode-hook (lambda () (setq c-basic-offset 4)))
|
|
450
|
|
451
|
|
452 ;;; ********************
|
|
453 ;;; Load a partial-completion mechanism, which makes minibuffer completion
|
|
454 ;;; search multiple words instead of just prefixes; for example, the command
|
|
455 ;;; `M-x byte-compile-and-load-file RET' can be abbreviated as `M-x b-c-a RET'
|
|
456 ;;; because there are no other commands whose first three words begin with
|
|
457 ;;; the letters `b', `c', and `a' respectively.
|
|
458 ;;;
|
|
459 (load-library "completer")
|
|
460
|
|
461
|
|
462 ;;; ********************
|
|
463 ;;; Load crypt, which is a package for automatically decoding and reencoding
|
|
464 ;;; files by various methods - for example, you can visit a .Z or .gz file,
|
|
465 ;;; edit it, and have it automatically re-compressed when you save it again.
|
|
466 ;;;
|
|
467 (setq crypt-encryption-type 'pgp ; default encryption mechanism
|
|
468 crypt-confirm-password t ; make sure new passwords are correct
|
|
469 ;crypt-never-ever-decrypt t ; if you don't encrypt anything, set this to
|
|
470 ; tell it not to assume that "binary" files
|
|
471 ; are encrypted and require a password.
|
|
472 )
|
|
473 (require 'crypt)
|
|
474
|
|
475
|
|
476 ;;; ********************
|
|
477 ;;; Edebug is a source-level debugger for emacs-lisp programs.
|
|
478 ;;;
|
|
479 (define-key emacs-lisp-mode-map "\C-xx" 'edebug-defun)
|
|
480
|
|
481
|
|
482 ;;; ********************
|
|
483 ;;; Font-Lock is a syntax-highlighting package. When it is enabled and you
|
|
484 ;;; are editing a program, different parts of your program will appear in
|
|
485 ;;; different fonts or colors. For example, with the code below, comments
|
|
486 ;;; appear in red italics, function names in function definitions appear in
|
|
487 ;;; blue bold, etc. The code below will cause font-lock to automatically be
|
|
488 ;;; enabled when you edit C, C++, Emacs-Lisp, and many other kinds of
|
|
489 ;;; programs.
|
|
490 ;;;
|
|
491 ;;; The "Options" menu has some commands for controlling this as well.
|
|
492 ;;;
|
|
493 (cond (running-xemacs
|
|
494
|
|
495 ;; If you want the default colors, you could do this:
|
|
496 ;; (setq font-lock-use-default-fonts nil)
|
|
497 ;; (setq font-lock-use-default-colors t)
|
|
498 ;; but I want to specify my own colors, so I turn off all
|
|
499 ;; default values.
|
|
500 (setq font-lock-use-default-fonts nil)
|
|
501 (setq font-lock-use-default-colors nil)
|
|
502
|
|
503 (require 'font-lock)
|
|
504
|
|
505 ;; Mess around with the faces a bit. Note that you have
|
|
506 ;; to change the font-lock-use-default-* variables *before*
|
|
507 ;; loading font-lock, and wait till *after* loading font-lock
|
|
508 ;; to customize the faces.
|
|
509
|
|
510 ;; string face is green
|
|
511 (set-face-foreground 'font-lock-string-face "forest green")
|
|
512
|
|
513 ;; comments are italic and red; doc strings are italic
|
|
514 ;;
|
|
515 ;; (I use copy-face instead of make-face-italic/make-face-bold
|
|
516 ;; because the startup code does intelligent things to the
|
|
517 ;; 'italic and 'bold faces to ensure that they are different
|
|
518 ;; from the default face. For example, if the default face
|
|
519 ;; is bold, then the 'bold face will be unbold.)
|
|
520 (copy-face 'italic 'font-lock-comment-face)
|
2
|
521 ;; Underlining comments looks terrible on tty's
|
0
|
522 (set-face-underline-p 'font-lock-comment-face nil 'global 'tty)
|
|
523 (set-face-highlight-p 'font-lock-comment-face t 'global 'tty)
|
|
524 (copy-face 'font-lock-comment-face 'font-lock-doc-string-face)
|
|
525 (set-face-foreground 'font-lock-comment-face "red")
|
|
526
|
|
527 ;; function names are bold and blue
|
|
528 (copy-face 'bold 'font-lock-function-name-face)
|
|
529 (set-face-foreground 'font-lock-function-name-face "blue")
|
|
530
|
|
531 ;; misc. faces
|
|
532 (and (find-face 'font-lock-preprocessor-face) ; 19.13 and above
|
|
533 (copy-face 'bold 'font-lock-preprocessor-face))
|
|
534 (copy-face 'italic 'font-lock-type-face)
|
|
535 (copy-face 'bold 'font-lock-keyword-face)
|
|
536 ))
|
|
537
|
|
538
|
|
539 ;;; ********************
|
|
540 ;;; fast-lock is a package which speeds up the highlighting of files
|
|
541 ;;; by saving information about a font-locked buffer to a file and
|
|
542 ;;; loading that information when the file is loaded again. This
|
|
543 ;;; requires a little extra disk space be used.
|
|
544 ;;;
|
|
545 ;;; Normally fast-lock puts the cache file (the filename appended with
|
|
546 ;;; .flc) in the same directory as the file it caches. You can
|
|
547 ;;; specify an alternate directory to use by setting the variable
|
|
548 ;;; fast-lock-cache-directories.
|
|
549
|
|
550 ;; Let's use lazy-lock instead.
|
|
551 ;;(add-hook 'font-lock-mode-hook 'turn-on-fast-lock)
|
|
552 ;;(setq fast-lock-cache-directories '("/foo/bar/baz"))
|
|
553
|
|
554
|
|
555 ;;; ********************
|
|
556 ;;; lazy-lock is a package which speeds up the highlighting of files
|
|
557 ;;; by doing it "on-the-fly" -- only the visible portion of the
|
|
558 ;;; buffer is fontified. The results may not always be quite as
|
|
559 ;;; accurate as using full font-lock or fast-lock, but it's *much*
|
|
560 ;;; faster. No more annoying pauses when you load files.
|
|
561
|
|
562 (add-hook 'font-lock-mode-hook 'turn-on-lazy-lock)
|
|
563 ;; I personally don't like "stealth mode" (where lazy-lock starts
|
|
564 ;; fontifying in the background if you're idle for 30 seconds)
|
|
565 ;; because it takes too long to wake up again on my piddly Sparc 1+.
|
|
566 (setq lazy-lock-stealth-time nil)
|
|
567
|
|
568
|
|
569 ;;; ********************
|
|
570 ;;; func-menu is a package that scans your source file for function
|
|
571 ;;; definitions and makes a menubar entry that lets you jump to any
|
|
572 ;;; particular function definition by selecting it from the menu. The
|
|
573 ;;; following code turns this on for all of the recognized languages.
|
|
574 ;;; Scanning the buffer takes some time, but not much.
|
|
575 ;;;
|
|
576 ;;; Send bug reports, enhancements etc to:
|
|
577 ;;; David Hughes <ukchugd@ukpmr.cs.philips.nl>
|
|
578 ;;;
|
|
579 (cond (running-xemacs
|
|
580 (require 'func-menu)
|
|
581 (define-key global-map 'f8 'function-menu)
|
|
582 (add-hook 'find-file-hooks 'fume-add-menubar-entry)
|
|
583 (define-key global-map "\C-cl" 'fume-list-functions)
|
|
584 (define-key global-map "\C-cg" 'fume-prompt-function-goto)
|
|
585
|
|
586 ;; The Hyperbole information manager package uses (shift button2) and
|
|
587 ;; (shift button3) to provide context-sensitive mouse keys. If you
|
|
588 ;; use this next binding, it will conflict with Hyperbole's setup.
|
|
589 ;; Choose another mouse key if you use Hyperbole.
|
|
590 (define-key global-map '(shift button3) 'mouse-function-menu)
|
|
591
|
|
592 ;; For descriptions of the following user-customizable variables,
|
|
593 ;; type C-h v <variable>
|
|
594 (setq fume-max-items 25
|
|
595 fume-fn-window-position 3
|
|
596 fume-auto-position-popup t
|
|
597 fume-display-in-modeline-p t
|
|
598 fume-menubar-menu-location "File"
|
|
599 fume-buffer-name "*Function List*"
|
|
600 fume-no-prompt-on-valid-default nil)
|
|
601 ))
|
|
602
|
|
603
|
|
604 ;;; ********************
|
|
605 ;;; MH is a mail-reading system from the Rand Corporation that relies on a
|
|
606 ;;; number of external filter programs (which do not come with emacs.)
|
|
607 ;;; Emacs provides a nice front-end onto MH, called "mh-e".
|
|
608 ;;;
|
|
609 ;; Bindings that let you send or read mail using MH
|
2
|
610 ;(global-set-key "\C-xm" 'mh-smail)
|
0
|
611 ;(global-set-key "\C-x4m" 'mh-smail-other-window)
|
2
|
612 ;(global-set-key "\C-cr" 'mh-rmail)
|
0
|
613
|
|
614 ;; Customization of MH behavior.
|
|
615 (setq mh-delete-yanked-msg-window t)
|
|
616 (setq mh-yank-from-start-of-msg 'body)
|
|
617 (setq mh-summary-height 11)
|
|
618
|
|
619 ;; Use lines like the following if your version of MH
|
|
620 ;; is in a special place.
|
|
621 ;(setq mh-progs "/usr/dist/pkgs/mh/bin.svr4/")
|
|
622 ;(setq mh-lib "/usr/dist/pkgs/mh/lib.svr4/")
|
|
623
|
|
624
|
|
625 ;;; ********************
|
|
626 ;;; resize-minibuffer-mode makes the minibuffer automatically
|
|
627 ;;; resize as necessary when it's too big to hold its contents.
|
|
628
|
|
629 (autoload 'resize-minibuffer-mode "rsz-minibuf" nil t)
|
|
630 (resize-minibuffer-mode)
|
|
631 (setq resize-minibuffer-window-exactly nil)
|
|
632
|
|
633 ;;; ********************
|
|
634 ;;; W3 is a browser for the World Wide Web, and takes advantage of the very
|
|
635 ;;; latest redisplay features in XEmacs. You can access it simply by typing
|
|
636 ;;; 'M-x w3'; however, if you're unlucky enough to be on a machine that is
|
|
637 ;;; behind a firewall, you will have to do something like this first:
|
|
638
|
|
639 ;(setq w3-use-telnet t
|
|
640 ; ;;
|
|
641 ; ;; If the Telnet program you use to access the outside world is
|
|
642 ; ;; not called "telnet", specify its name like this.
|
|
643 ; w3-telnet-prog "itelnet"
|
|
644 ; ;;
|
|
645 ; ;; If your Telnet program adds lines of junk at the beginning
|
|
646 ; ;; of the session, specify the number of lines here.
|
|
647 ; w3-telnet-header-length 4
|
|
648 ; )
|