Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!oddjob!matt From: matt@oddjob.UUCP Newsgroups: comp.emacs Subject: Re: Question/Suggestion on C-s/C-q question . . . Message-ID: <3683@oddjob.UChicago.EDU> Date: Wed, 4-Mar-87 21:45:15 EST Article-I.D.: oddjob.3683 Posted: Wed Mar 4 21:45:15 1987 Date-Received: Fri, 6-Mar-87 22:46:54 EST References: <8703042025.AA12061@ncifcrf.ncifcrf.uucp> Reply-To: matt@oddjob.uchicago.edu (Ka Kahula) Organization: Very Little Lines: 53 I don't believe the addresses that seismo is sticking on, but... randy@seismo.CSS.GOV@ncifcrf.UUCP (Randy Smith) writes: ) Does anyone have an idea how possible/easy it would be to define a ) key as a prefix for control? In other words, to allow a two key ) substitution for any control key? (Example: 'C-v s' substitutes for ) 'C-s'. C-v would be a bad choice, but you get the idea). TVI terminals have a key "FUNCT" which, if held while typing some other key x, sends C-A x C-M. I made this act as a meta key by using: (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))))) (define-key global-map "\^A" 'funct-key) Speaking off the top of my head, you have two main choices. You can emulate and simplify the above to: (defun prefix-control () "Make the net character act like the corresponing control character" (interactive) (setq prefix-arg current-prefix-arg this-command last-command unread-command-char (logand (read-char) 31))))) ;; A more sophisticated version would map ? to DEL The other choice is to make a new keymap that does indirection through whatever keymap is in effect. Binding a key sequence to a string has this effect - it's essentially a keyboard macro. (setq control-map (make-keymap)) (fset 'prefix-control control-map) (setq i 0) (while (< i 32) (define-key control-map (char-to-string (+ i ?@)) (char-to-string i)) (define-key control-map (char-to-string (+ i ?`)) (char-to-string i)) (setq i (1+ i))) (define-key control-map "?" "\^?") (define-key global-map "\^V" 'prefix-control) ;or whatever key you want In either case, the extension to "prefix-control-meta" is left as an exercise for the reader. Keep out of trouble, Randy. Matt