[comp.emacs] .emacs files

sksircar@phoenix.Princeton.EDU (Subrata Kumar Sircar) (10/26/89)

I am using GNU Emacs 18.50.2 on berkely-unix (Ultrix) and want to bind the
function keys to new arguments.  I came up with the following code, bound
it into my .emacs file, and ran it... and nothing happened.  (This is why
I thought my .emacs file wasn't being read - thanks to all of you who replied
to the previous posting.)  Anyway, here is the code.  I would appreciate it
if someone could mail to me either the mistake I'm making, or some code that
would do the right thing.  Thank you.  If anyone else wants to know, I'll
summarize to the net.

(put 'eval-expression 'disabled nil)

(defvar fnkey-map (make-sparse-keymap) "Keymap for function keys")
(define-key esc-map "[" fnkey-map)

(define-key fnkey-map "11~" 'goto-line) ; F1
(define-key fnkey-map "12~" 'compile)   ; F2
(define-key fnkey-map "13~" 'next-error); F3

Subrata K. Sircar, Prophet    | Disclaimer:  My Opinions, Of course,
Charter Member of SPAMIT(tm)  | reflect the will of this entire multiverse.
sksircar@phoenix.princeton.edu| "Boy, your adolence and childhood expenses
SKSIRCAR@PUCC.BITNET	      | are on the house!"  "Imagine my relief."

rock@rancho.uucp (Rock Kent) (10/28/89)

>>>>> On 26 Oct 89 16:20:54 GMT, sksircar@phoenix.Princeton.EDU
>>>>> (Subrata Kumar Sircar) said:

SKS> I am using GNU Emacs 18.50.2 on berkely-unix (Ultrix) and want to
SKS> bind the function keys to new arguments.  I came up with the
SKS> following code, bound it into my .emacs file, and ran it... and
SKS> nothing happened. 

SKS> (defvar fnkey-map (make-sparse-keymap) "Keymap for function keys")
SKS> (define-key esc-map "[" fnkey-map)
SKS> (define-key fnkey-map "11~" 'goto-line) ; F1
SKS> (define-key fnkey-map "12~" 'compile)   ; F2
SKS> (define-key fnkey-map "13~" 'next-error); F3

Hmmm.  I'm not sure, but I think that your definition of [ under
esc-map is getting redefined after you set it.  Here's why:
     - emasc begins by loading loadup.el which starts off the process
       of initiating an emacs session and right away loads
       loaddefs.el.
     - loaddefs.el defines esc-map and further defines esc-map "[" to
       be backward-paragraph.
     - loadup.el them starts a few things before getting to loading
       startup.el. 
     - startup.el then sets some variables, takes care of any
       command-line arguments, loads the users $HOME/.emacs and THEN
       LOADS THE LIBRARY FOR THE TERMINAL TYPE.
     - the terminal library then defines some keys.  vt100.el, for
       instance, defines "\e[" to be the prefix invoking CSI-map and
       then goes on the define keys in CSI-map  ---  thus smashing any
       definition made in the .emacs init file.

Realizing that a user might want to set definitions and such AFTER the
terminal initialization processing had been completed, the authors of
emacs have provided us with term-setup-hook which is processed after
the terminal specific library is loaded.  I place the following in my
.emacs to do some customization:

(setq term-setup-hook 'term-setup-hook-procedures)

(defun term-setup-hook-procedures () "
The stuff I want to run after the terminals get installed."
  (enable-arrow-keys)
  (if (or (string= (getenv "TERM") "AT386")
	  (string= (getenv "TERM") "at386")
	  (string= (getenv "TERM") "root_at386"))
      (progn
	(global-set-key "\eOT" 'minkey)
	(global-set-key "\e\e[H" 'beginning-of-buffer)
	(global-set-key "\e\e[Y" 'end-of-buffer)))
  (if (or (string= (getenv "TERM") "pro_vt100")
	  (string= (getenv "TERM") "PRO_VT100"))
      (progn
	(global-set-key "\eOt" 'minkey)
        (setq meta-flag t)
	(global-set-key "\e\e[H" 'beginning-of-buffer)
	(global-set-key "\e\e[K" 'end-of-buffer)))
  )

Hope this helps some . . . I'll keep my fingers crossed that I didn't
head off on too much of a tangent or embarrass myself too much with my
(miss-)understanding of emacs.

***************************************************************************
*Rock Kent    rock@rancho.uucp        POB 8964, Rancho Sante Fe, CA. 92067*
***************************************************************************

cwilson@NISC.SRI.COM (Chan Wilson) (11/29/89)

Hi Ho, me again:

I'd like to get the mh-rmail mode loaded in automagically when I
startup emacs. How?

Also, the mh-restore-window-config restores to a blank slate - in
other words, how do I save a window config for it to return to?

I set M-p to jump the cursor up a buffer, but the mh-rmail mode grabs
it, even though I've unset it in my .emacs.  I assume this is because
I load in the mh-rmail via M-x mh-rmail, yes?  


Would some of you out there be willing to send some interesting .emacs
files, so I can scan through them, and answer some of my own
questions?

Thanks!

................
Chan Wilson -- cwilson@nisc.sri.com <or> cwilson@nic.ddn.mil
'A computer operator at SRI International'  
"I think, therefore...uh...I should be?"
................