home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / gnu / emacs / help / 4096 < prev    next >
Encoding:
Text File  |  1992-09-11  |  3.2 KB  |  74 lines

  1. Path: sparky!uunet!sun-barr!ames!agate!darkstar.UCSC.EDU!darkstar.ucsc.edu!hermit
  2. From: hermit@cats.UCSC.EDU (William R. Ward)
  3. Newsgroups: gnu.emacs.help
  4. Subject: Re: Can I have more than one initialization file?
  5. Date: 11 Sep 92 18:49:38
  6. Organization: Computing and Telecommunications Services, UCSC
  7. Lines: 61
  8. Message-ID: <HERMIT.92Sep11184938@am.ucsc.edu>
  9. References: <1992Sep12.000403.3747@fcom.cc.utah.edu>
  10. NNTP-Posting-Host: am.ucsc.edu
  11. In-reply-to: mjk@greisen.physics.utah.edu's message of 12 Sep 92 00:04:03 GMT
  12.  
  13. In article <1992Sep12.000403.3747@fcom.cc.utah.edu> mjk@greisen.physics.utah.edu (Matthew J. Kidd) writes:
  14.  
  15. |I use emacs on two different terminals. In each case I have customized
  16. |the key bindings to correspond with some of the special keys in obvious
  17. |ways. 
  18.  
  19. |I would like to create a couple of aliases that invoke emacs with different
  20. |initialization files. However, I don't see any way of getting emacs to use a
  21. |different initialization file (other than .emacs) save for that of another
  22. |user via the -u command line option. I could probably get around this
  23. |problems using soft links, but it would be more elegant if emacs could handle
  24. |it directly.
  25.  
  26. |Even better, would be if the code in the initialization file could pick
  27. |out the TERM enviroment variable and execute different code on that 
  28. |basis. If this is possible, I would appreciate advice and code. My lisp
  29. |experience goes little further than changing keybindings. 
  30.  
  31. No sweat.
  32.  
  33. The following excerpt from my .emacs file sets various keys on my
  34. VT-100 emulator to various corresponding Emacs functions.  The
  35. disadvantage with this is that it takes away the M-[ command, which is
  36. a useful thing.  I rebind M-[ and M-] to M-{ and M-} (which is closer
  37. to the vi commands { and }, which do the same thing in vi, which was
  38. my first editor before I was converted....)
  39.  
  40. --8<-- cut here --8<--
  41.  
  42. (setq termtype (getenv "TERM"))
  43. (if (or (equal termtype "vt100")
  44.     (equal termtype "vt102")
  45.     (equal termtype "vt220")
  46.     (equal termtype "ansi"))
  47.     (progn
  48.       (setq term-file-prefix nil)
  49.       (setq vt100-cursor-map (make-keymap))
  50.       (define-key global-map "\e[" vt100-cursor-map)
  51.       (define-key vt100-cursor-map "A" 'previous-line)    ; up arrow
  52.       (define-key vt100-cursor-map "B" 'next-line)        ; down arrow
  53.       (define-key vt100-cursor-map "C" 'forward-char)        ; right arrow
  54.       (define-key vt100-cursor-map "D" 'backward-char)    ; left arrow
  55.       (define-key vt100-cursor-map "p" 'overwrite-mode)    ; insert
  56.       (define-key vt100-cursor-map "\C-?" 'delete-char)    ; delete
  57.       (define-key vt100-cursor-map "H" 'beginning-of-line)    ; home
  58.       (define-key vt100-cursor-map "K" 'end-of-line)        ; end
  59.       (define-key vt100-cursor-map "y" 'scroll-down)        ; page-up
  60.       (define-key vt100-cursor-map "s" 'scroll-up)        ; page-down
  61.       (setq vt100-other-map (make-keymap))
  62.       (define-key global-map "\eO" vt100-other-map)
  63.       (define-key vt100-other-map "P" 'help-for-help)))     ; help
  64.  
  65. --8<-- cut here --8<--
  66.  
  67. Have fun!  You can do similar things with other term types, of
  68. course...
  69. --
  70. William R Ward                       Bay View Software
  71. VoiceMail: +1 (408) 479-4072         Internet:  hermit@cats.ucsc.edu
  72. SnailMail: 1803 Mission St. #339     BITNet:    hermit@cats.bitnet
  73.            Santa Cruz CA 95060 USA
  74.