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