[comp.emacs] Using Wyse-60 'No Scroll' key as meta key

walters@io.UUCP (Tim Walters) (10/07/87)

We have a few Wyse-60 terminals which we are using with Gnu emacs
18.41. These terminals have a 'No Scroll' key which can be set up to
work as a kind of meta key: holding down No Scroll + key sends 3
characters: ctrl-A key CR. I have some functions which bind, say,
ctrl-A b CR to backward-word, but I would like to have a technique for
making No Scroll + key work *exactly* the same as ESC + key, i.e. as a
real meta key, however that key might be bound in the current buffer.

Ideally I would like to have a single function, bound to ctrl-A, which
handles everything. I can think of a couple of ways this might work,
but my knowledge of the Gnu functions is not strong enough to
implement them. The function could pick up the next two characters
from the input stream and then either push an escape + char back into
the input stream, or look up the appropriate function in the meta key
keymap table and call it. Can anyone suggest a way to implement this?
Any pointers would be appreciated.
-- 
	...!harvard!umb!ileaf!walters	Tim Walters, Interleaf
	  ...!sun!sunne!ileaf!walters	Ten Canal Park, Cambridge, MA 02141
					(617) 577-9813 x5510

matt@oddjob.UChicago.EDU (My Name Here) (10/07/87)

In article <400@io.UUCP> walters@wally.UUCP (Tim Walters) writes:

) These terminals have a 'No Scroll' key which can be set up to
) work as a kind of meta key: holding down No Scroll + key sends 3
) characters: ctrl-A key CR.

TVI terminals have a "FUNCT" key that does the same thing.  I wrote
the following to make that into a meta key.  You should be able to
use it as is.  Note that you'll have to move beginning-of-line to
some other key.  I move it to ESC-I, which is the TVI "BACK TAB" key.

(defun funct-key ()
  "Make the TVI's FUNCT key act like a META key"
  (interactive)
  (let ((save-key (read-char)))
    (if (/= (read-char) ?\^M)
	(error "bad C-A or FUNCT key usage")
      (setq prefix-arg current-prefix-arg
	    this-command last-command
	    unread-command-char (logior save-key 128)))))

;; move the old function of C-A
(define-key esc-map "I" (key-binding "\^A")) ; BACK TAB
(define-key global-map "\^A" 'funct-key)

			Matt Crawford
--
"Dirk Gently is the name under which I now trade.  There are certain events
in the past, I'm afraid, from which I would wish to disassociate myself."

  "Absolutely, I know how you feel.  Most of the fourteenth century, for
  instance, was pretty grim."