[comp.emacs] Problem with setting mouse-map keys in .emacs file

gildea@ALEXANDER.BBN.COM (Stephen Gildea) (07/13/90)

> I've been having a problem when trying to define keys in the
> mouse-map for X.

Terminal- and window-system-dependent code is loaded conditionally at
run-time after your .emacs is read.  Thus the variables are you are
trying to set in .emacs haven't been defined yet.

The solution is to do your customization in a function attached to
window-setup-hook.  (For ordinary terminals, use term-setup-hook.)
I do something like this:

(if (eq window-system 'x)
    (setq window-setup-hook
	  '(lambda ()
	     (define-key mouse-map x-button-s-left 'x-mouse-set-mark)
	     (define-key mouse-map x-button-s-middle 'x-copy-moused-sexp)
	     (define-key mouse-map x-button-s-right 'x-cut-and-wipe-text))))


 < Stephen				Bolt Beranek and Newman Inc.
   gildea@bbn.com			Cambridge, Massachusetts

   What in heaven's name brought you to Casablana?
     My health.  I came to Casablana for the waters.
   Waters?  What waters?  We're in the desert.
     I was misinformed.