comparison etc/sample.emacs @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents 0293115a14e9
children 441bb1e64a06
comparison
equal deleted inserted replaced
23:0edd3412f124 24:4103f0995bd7
261 261
262 )) 262 ))
263 263
264 )) 264 ))
265 265
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 (list-faces)))
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
266 ;;; Older versions of emacs did not have these variables 299 ;;; Older versions of emacs did not have these variables
267 ;;; (emacs-major-version and emacs-minor-version.) 300 ;;; (emacs-major-version and emacs-minor-version.)
268 ;;; Let's define them if they're not around, since they make 301 ;;; Let's define them if they're not around, since they make
269 ;;; it much easier to conditionalize on the emacs version. 302 ;;; it much easier to conditionalize on the emacs version.
270 303
318 ;; Customization of Specific Packages ;; 351 ;; Customization of Specific Packages ;;
319 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 352 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
320 353
321 354
322 ;;; ******************** 355 ;;; ********************
323 ;;; Load ange-ftp, which uses the FTP protocol as a pseudo-filesystem. 356 ;;; Load efs, which uses the FTP protocol as a pseudo-filesystem.
324 ;;; When this is loaded, the pathname syntax /user@host:/remote/path 357 ;;; When this is loaded, the pathname syntax /user@host:/remote/path
325 ;;; refers to files accessible through ftp. 358 ;;; refers to files accessible through ftp.
326 ;;; 359 ;;;
327 (require 'dired) 360 (require 'dired)
328 (require 'ange-ftp) 361 ;; compatible ange-ftp/efs initialization derived from code
329 (setq ange-ftp-default-user "anonymous" ; id to use for /host:/remote/path 362 ;; from John Turner <turner@lanl.gov>
330 ange-ftp-generate-anonymous-password t ; use $USER@`hostname` 363 ;; As of 19.15, efs is bundled instead of ange-ftp.
331 ange-ftp-binary-file-name-regexp "." ; always transfer in binary mode 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
371 (if (and running-xemacs (< emacs-major-version 20) (>= emacs-minor-version 15))
372 (progn
373 (message "Loading and configuring bundled packages... efs")
374 (require 'efs-auto)
375 (if (getenv "USER")
376 (setq efs-default-user (getenv "USER")))
377 (if (getenv "EMAIL_ADDRESS")
378 (setq efs-generate-anonymous-password (getenv "EMAIL_ADDRESS"))
379 (if (and (getenv "USER")
380 (getenv "DOMAINNAME"))
381 (setq efs-generate-anonymous-password
382 (concat (getenv "USER")"@"(getenv "DOMAINNAME")))))
383 (setq efs-auto-save 1)
384 ))
385 (if (and running-xemacs (< emacs-major-version 20) (< emacs-minor-version 15))
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)
332 ) 398 )
399 )
333 400
334 401
335 ;;; ******************** 402 ;;; ********************
336 ;;; Load the auto-save.el package, which lets you put all of your autosave 403 ;;; Load the auto-save.el package, which lets you put all of your autosave
337 ;;; files in one place, instead of scattering them around the file system. 404 ;;; files in one place, instead of scattering them around the file system.
338 ;;; 405 ;;;
339 (setq auto-save-directory (expand-file-name "~/autosave/") 406 (setq auto-save-directory (expand-file-name "~/autosave/")
340 auto-save-directory-fallback auto-save-directory 407 auto-save-directory-fallback auto-save-directory
341 auto-save-hash-p nil 408 auto-save-hash-p nil
342 ange-ftp-auto-save t 409 efs-auto-save t
343 ange-ftp-auto-save-remotely nil 410 efs-auto-save-remotely nil
344 ;; now that we have auto-save-timeout, let's crank this up 411 ;; now that we have auto-save-timeout, let's crank this up
345 ;; for better interactive response. 412 ;; for better interactive response.
346 auto-save-interval 2000 413 auto-save-interval 2000
347 ) 414 )
348 ;; We load this afterwards because it checks to make sure the 415 ;; We load this afterwards because it checks to make sure the