[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: meta/escape key problem



   Date: Tue, 2 Mar 93 18:27 MET
   From: sauthier@lia.di.epfl.ch (Eric Sauthier)

   I work on a symbolics, but quite often use its terminal capabilities to have a
   connection to SPARCs. I'd like to be able to use the meta key on my symbolics
   "terminal" and have it interpreted as being an ESC on the SPARC. Is this
   possible?  Do I have to play around with some sort of keyboard mapping table on
   the symbolics or should I change something in the TERMCAP settings on the sun
   (I'd rather go for the first mentionned if possible)? Needless to say that I'd
   ...

I still have this lying around:

;;; -*- Mode: LISP; Package: TELNET; Base: 8 -*-

;;; patch to convert meta-<char> to ESCAPE - CHAR in telnet filter
(DEFMETHOD (:FILTER TELNET-FILTER) (CH)
  (COND ((LISTP CH)
	 CH)
	((CL:MEMBER CH '(#\SCROLL #\META-SCROLL #\KEYBOARD:BACK-SCROLL) :TEST #'CHAR-EQUAL)
	 (CP::SCROLL-WINDOW-COMMAND-INTERNAL
	   :SCREEN
	   (SELECTOR CH CHAR-EQUAL
	     (#\SCROLL +1)
	     (#\META-SCROLL -1)
	     (#\KEYBOARD:BACK-SCROLL -1))
	   :Y *TERMINAL-STREAM*)
	 NIL)
	(T
	 (LET ((CODE (SEND INPUT-TRANSLATION-STATE :TRANSLATE-INPUT-CHAR CH)))
	   (WHEN (NULL CODE)
	     (SETQ CODE (CHAR-CODE CH))
	     (WHEN (CHAR-BIT CH :CONTROL)
	       (SETQ CODE (LDB (BYTE 5 0) CODE)))	;Controlify
	     (COND ((> CODE #O400)		; outside standard charset?
		    (SETQ CODE NIL))		; not handled. 
		   (T
		    (SETQ CODE (AREF *TELNET-KEYS* CODE))))
	     (WHEN (AND (FIXP CODE) (CHAR-BIT CH :META))
	       (WHEN (OR ( (CHAR-CODE #/A) CODE (CHAR-CODE #/Z))
			 ( (CHAR-CODE #/a) CODE (CHAR-CODE #/z)))
		 (SETQ CODE (LOGXOR CODE #O40)))	;Flip case (m-A  m-a).
;;; this section has been modified (replaces a <meta> with <esc>) : 
	       (SEND OUTPUT-STREAM :TYO #o033)    ; send an escape to the output
	       CODE))
;;; old code   (SETQ CODE (LOGIOR CODE #O200))))
;;; end of patch
	   (IF (ARRAYP CODE)
	       (LOOP FOR CODE BEING THE ARRAY-ELEMENTS OF CODE
		     DO (SEND OUTPUT-STREAM :TYO CODE))
	       CODE)))))



Hope this is useful,
jeffrey