[comp.sys.sgi] Turning the Alt key into a Meta key

dboles@ccwf.cc.utexas.edu (David Boles) (05/01/91)

The subject line pretty much says it all, I've heard that some 
people out there have done this for Emacs and I'd like to join
in the fun.

Thanks

  David Boles




-- 
-------------------------------------------------------------------------------
David Boles                                       Applied Research Laboratories
dboles@ccwf.cc.utexas.edu                        DOS is severely brain-damaged,
apas611@chpc.utexas.edu                   so just pull the plug and let it DIE.
-------------------------------------------------------------------------------

guido@cwi.nl (Guido van Rossum) (05/01/91)

dboles@ccwf.cc.utexas.edu (David Boles) writes:

>The subject line pretty much says it all, I've heard that some 
>people out there have done this for Emacs and I'd like to join
>in the fun.

If you are using X (which you should!), you can call xmodmap with an
input file containing these three lines:

	! For SGI keyboard: turn Alt keys into Meta keys
	keysym Alt_L = Meta_L
	keysym Alt_R = Meta_R

--Guido van Rossum, CWI, Amsterdam <guido@cwi.nl>
PS: if you follow-up to an article but really want to start a new thread,
don't just edit the subject, also remove the References: line.

jeremy@cs.adelaide.edu.au (Jeremy Webber) (05/02/91)

This works for me under Irix 3.2, for NeWS applications such as wsh.

Create a directory in your home directory called NeWS.
Copy /usr/NeWS/lib/NeWS/UI.ps into it.
Then apply the following patch.

Hope this helps,
	-jeremy

------- cut here and remove the .sig from the end ---
*** /usr/NeWS/lib/NeWS/UI.ps	Tue Nov 28 10:23:00 1989
--- UI.ps	Thu Feb 22 09:34:42 1990
***************
*** 1,3 ****
--- 1,10 ----
+ 
+ %  Modified at Digital Arts to make the right Alt key act like
+ %  a META key.
+ %  NB: with this patch ordinary access to the right Alt key is disabled!!
+ %
+ %  The new code is added in two places, deliniated by comments.  Look for the
+ %  keyword "meta".
  %
  %  UI.ps: low level of mouse & keyboard user interface
  %
***************
*** 467,475 ****
--- 474,512 ----
  	} ifelse
      } def
  
+ % new code for meta key
+ /MetaDown false def                   % true when either alt key is down
+ 
+ {
+     createevent dup begin		% gobble alt key
+           /Name [28560] def		% right Alt key
+           /Priority 4 def
+           /Exclusivity true def
+       end
+     expressinterest
+     {
+       awaitevent
+       dup /Action get /DownTransition eq
+               {/MetaDown true store}     % downtrans -> set  flag
+               {/MetaDown false store}    % uptrans -> clear flag
+       ifelse
+     } loop
+ } fork
+ %end new code
+ 
+ 
      /deliver_keyboard_to_focus {				% event => -
  	dup dup begin						% ev ev
  	    sgi_translatekey					% ev (string)
+ % new code for meta key
+           dup dup type /stringtype eq         % if there's a string
+           exch length 0 ne and                % of nonzero length
+           MetaDown and                        % and meta is down
+           Action /DownTransition eq and       % and ev is a keypress
+           {dup dup 0 get 128 or               % then ior 128 into
+            0 exch put                         % the 1st char in the string
+           } if
+ % end new code
  	    /ClientData exch def				% ev
  	end
  	InteractionLock monitorlocked MenuBusy 0 ne or {

--
--
--
Jeremy Webber			   ACSnet: jeremy@chook.ua.oz
Digital Arts Film and Television,  Internet: jeremy@cs.adelaide.edu.au
3 Milner St, Hindmarsh, SA 5007,   Voicenet: +61 8 346 4534
Australia			   Papernet: +61 8 346 4537 (FAX)