comparison etc/sample.emacs @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 8b8b7f3559a2
children c7528f8e288d
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
36 36
37 ;; set up the function keys to do common tasks to reduce Emacs pinky 37 ;; set up the function keys to do common tasks to reduce Emacs pinky
38 ;; and such. 38 ;; and such.
39 39
40 ;; Make F1 invoke help 40 ;; Make F1 invoke help
41 (global-set-key [f1] 'help-command) 41 (global-set-key 'f1 'help-command)
42 ;; Make F2 be `undo' 42 ;; Make F2 be `undo'
43 (global-set-key [f2] 'undo) 43 (global-set-key 'f2 'undo)
44 ;; Make F3 be `find-file' 44 ;; Make F3 be `find-file'
45 ;; Note: it does not currently work to say 45 ;; Note: it does not currently work to say
46 ;; (global-set-key 'f3 "\C-x\C-f") 46 ;; (global-set-key 'f3 "\C-x\C-f")
47 ;; The reason is that macros can't do interactive things properly. 47 ;; The reason is that macros can't do interactive things properly.
48 ;; This is an extremely longstanding bug in Emacs. Eventually, 48 ;; This is an extremely longstanding bug in Emacs. Eventually,
49 ;; it will be fixed. (Hopefully ..) 49 ;; it will be fixed. (Hopefully ..)
50 (global-set-key [f3] 'find-file) 50 (global-set-key 'f3 'find-file)
51 51
52 ;; Make F4 be "mark", F5 be "copy", F6 be "paste" 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 53 ;; Note that you can set a key sequence either to a command or to another
54 ;; key sequence. 54 ;; key sequence.
55 (global-set-key [f4] 'set-mark-command) 55 (global-set-key 'f4 'set-mark-command)
56 (global-set-key [f5] "\M-w") 56 (global-set-key 'f5 "\M-w")
57 (global-set-key [f6] "\C-y") 57 (global-set-key 'f6 "\C-y")
58 58
59 ;; Shift-F4 is "pop mark off of stack" 59 ;; Shift-F4 is "pop mark off of stack"
60 (global-set-key '(shift f4) (lambda () (interactive) (set-mark-command t))) 60 (global-set-key '(shift f4) (lambda () (interactive) (set-mark-command t)))
61 61
62 ;; Make F7 be `save-buffer' 62 ;; Make F7 be `save-buffer'
63 (global-set-key [f7] 'save-buffer) 63 (global-set-key 'f7 'save-buffer)
64 64
65 ;; Make F8 be "start macro", F9 be "end macro", F10 be "execute macro" 65 ;; Make F8 be "start macro", F9 be "end macro", F10 be "execute macro"
66 (global-set-key [f8] 'start-kbd-macro) 66 (global-set-key 'f8 'start-kbd-macro)
67 (global-set-key [f9] 'end-kbd-macro) 67 (global-set-key 'f9 'end-kbd-macro)
68 (global-set-key [f10] 'call-last-kbd-macro) 68 (global-set-key 'f10 'call-last-kbd-macro)
69 69
70 ;; Here's an alternative binding if you don't use keyboard macros: 70 ;; Here's an alternative binding if you don't use keyboard macros:
71 ;; Make F8 be `save-buffer' followed by `delete-window'. 71 ;; Make F8 be `save-buffer' followed by `delete-window'.
72 ;;(global-set-key 'f8 "\C-x\C-s\C-x0") 72 ;;(global-set-key 'f8 "\C-x\C-s\C-x0")
73 73
95 kill-whole-line t 95 kill-whole-line t
96 ) 96 )
97 97
98 ;; When running ispell, consider all 1-3 character words as correct. 98 ;; When running ispell, consider all 1-3 character words as correct.
99 (setq ispell-extra-args '("-W" "3")) 99 (setq ispell-extra-args '("-W" "3"))
100
101 ;; Change the way the buffer name is displayed in the
102 ;; modeline. The variable for this is called
103 ;; 'modeline-buffer-identification but was called
104 ;; 'mode-line-buffer-identification in older XEmacsen.
105 (if (boundp 'modeline-buffer-identification)
106 ;; Note that if you want to put more than one form in the
107 ;; `THEN' clause of an IF-THEN-ELSE construct, you have to
108 ;; surround the forms with `progn'. You don't have to
109 ;; do this for the `ELSE' clauses.
110 (progn
111 (setq-default modeline-buffer-identification '("XEmacs: %17b"))
112 (setq modeline-buffer-identification '("XEmacs: %17b")))
113 (setq-default mode-line-buffer-identification '("XEmacs: %17b"))
114 (setq mode-line-buffer-identification '("XEmacs: %17b")))
100 115
101 (cond ((or (not (fboundp 'device-type)) 116 (cond ((or (not (fboundp 'device-type))
102 (equal (device-type) 'x)) 117 (equal (device-type) 'x))
103 ;; Code which applies only when running emacs under X goes here. 118 ;; Code which applies only when running emacs under X goes here.
104 ;; (We check whether the function `device-type' exists 119 ;; (We check whether the function `device-type' exists
168 (define-key global-map [(control x) return] nil) 183 (define-key global-map [(control x) return] nil)
169 184
170 ;; Change the pointer used when the mouse is over a modeline 185 ;; Change the pointer used when the mouse is over a modeline
171 (set-glyph-image modeline-pointer-glyph "leftbutton") 186 (set-glyph-image modeline-pointer-glyph "leftbutton")
172 187
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
178 ;; Change the pointer used during garbage collection. 188 ;; Change the pointer used during garbage collection.
179 ;; 189 ;;
180 ;; Note that this pointer image is rather large as pointers go, 190 ;; 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 191 ;; and so it won't work on some X servers (such as the MIT
182 ;; R5 Sun server) because servers may have lamentably small 192 ;; R5 Sun server) because servers may have lamentably small
261 271
262 )) 272 ))
263 273
264 )) 274 ))
265 275
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)))
292 (faces (face-list)))
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
299 ;;; Older versions of emacs did not have these variables 276 ;;; Older versions of emacs did not have these variables
300 ;;; (emacs-major-version and emacs-minor-version.) 277 ;;; (emacs-major-version and emacs-minor-version.)
301 ;;; Let's define them if they're not around, since they make 278 ;;; Let's define them if they're not around, since they make
302 ;;; it much easier to conditionalize on the emacs version. 279 ;;; it much easier to conditionalize on the emacs version.
303 280
351 ;; Customization of Specific Packages ;; 328 ;; Customization of Specific Packages ;;
352 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 329 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
353 330
354 331
355 ;;; ******************** 332 ;;; ********************
356 ;;; Load efs, which uses the FTP protocol as a pseudo-filesystem. 333 ;;; Load ange-ftp, which uses the FTP protocol as a pseudo-filesystem.
357 ;;; When this is loaded, the pathname syntax /user@host:/remote/path 334 ;;; When this is loaded, the pathname syntax /user@host:/remote/path
358 ;;; refers to files accessible through ftp. 335 ;;; refers to files accessible through ftp.
359 ;;; 336 ;;;
360 (require 'dired) 337 (require 'dired)
361 ;; compatible ange-ftp/efs initialization derived from code 338 (require 'ange-ftp)
362 ;; from John Turner <turner@lanl.gov> 339 (setq ange-ftp-default-user "anonymous" ; id to use for /host:/remote/path
363 ;; As of 19.15, efs is bundled instead of ange-ftp. 340 ange-ftp-generate-anonymous-password t ; use $USER@`hostname`
364 ;; NB: doesn't handle 20.0 properly, efs didn't appear until 20.1. 341 ange-ftp-binary-file-name-regexp "." ; always transfer in binary mode
365 ;; 342 )
366 ;; The environment variable EMAIL_ADDRESS is used as the password 343
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
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))))
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")))))
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 )
399 )
400
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))
410 344
411 ;;; ******************** 345 ;;; ********************
412 ;;; Load the auto-save.el package, which lets you put all of your autosave 346 ;;; 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. 347 ;;; files in one place, instead of scattering them around the file system.
414 ;;; 348 ;;;
415 (setq auto-save-directory (expand-file-name "~/autosave/") 349 (setq auto-save-directory (expand-file-name "~/autosave/")
416 auto-save-directory-fallback auto-save-directory 350 auto-save-directory-fallback auto-save-directory
417 auto-save-hash-p nil 351 auto-save-hash-p nil
418 efs-auto-save t 352 ange-ftp-auto-save t
419 efs-auto-save-remotely nil 353 ange-ftp-auto-save-remotely nil
420 ;; now that we have auto-save-timeout, let's crank this up 354 ;; now that we have auto-save-timeout, let's crank this up
421 ;; for better interactive response. 355 ;; for better interactive response.
422 auto-save-interval 2000 356 auto-save-interval 2000
423 ) 357 )
424 ;; We load this afterwards because it checks to make sure the 358 ;; We load this afterwards because it checks to make sure the
628 562
629 (autoload 'resize-minibuffer-mode "rsz-minibuf" nil t) 563 (autoload 'resize-minibuffer-mode "rsz-minibuf" nil t)
630 (resize-minibuffer-mode) 564 (resize-minibuffer-mode)
631 (setq resize-minibuffer-window-exactly nil) 565 (setq resize-minibuffer-window-exactly nil)
632 566
567
633 ;;; ******************** 568 ;;; ********************
634 ;;; W3 is a browser for the World Wide Web, and takes advantage of the very 569 ;;; 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 570 ;;; 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 571 ;;; '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: 572 ;;; behind a firewall, you will have to do something like this first: