[comp.emacs] using variables before they are defined

wohler@SPAM.ISTC.SRI.COM.UUCP (03/05/87)

  i'd like to bind a key in the mh-folder-mode-map to one of my
  functions.  however, the line
  
(define-key mh-folder-mode-map "\eE" 'mh-extract-unsent-mail)

  in my .emacs dies since mh-folder-mode-map has not been defined yet.

  what is the preferred way to make this key binding?  i don't want to
  use global-set-key for obvious reasons.

						--bw

matt@oddjob.UUCP (03/05/87)

wohler@SPAM.ISTC.SRI.COM (Bill Wohler) writes:
)   i'd like to bind a key in the mh-folder-mode-map to one of my
)   functions.  however, the line
)   
) (define-key mh-folder-mode-map "\eE" 'mh-extract-unsent-mail)
) 
)   in my .emacs dies since mh-folder-mode-map has not been defined yet.

There is a variable called mh-folder-mode-hook.  If it has a
non-nil value when you enter mh-folder-mode then that value is
executed.  I have in my .emacs file:

(setq mh-letter-mode-hook
      (function
       (lambda nil (setq indent-line-function 'indent-to-left-margin))))

You should try:

(setq mh-folder-mode-hook
      (function
       (lambda nil
	 (define-key mh-folder-mode-map "\eE" 'mh-extract-unsent-mail))))
________________________________________________________
Matt	     University		matt@oddjob.uchicago.edu
Crawford     of Chicago     {astrovax,ihnp4}!oddjob!matt