marc@ladwp (Marc Hall) (02/26/91)
We have been attempting to determine what specific character sequences are emitted by the the function keys f1-f12 on the IBM RS/6000 Model 320 when running the emacs 18.56 in its own X window. The character sequences that we see when a key is pressed in a scratch buffer are of the form : f1 - 01q f2 - 02q f3 - 03q . . . . . . f12 - 12q shift f1 - 13q shift f2 - 14q . . . . . . shift f12 - 23q and so on, There is a prefix to each of these character sequences which has causes a behavior similiar to the C-g bell function. Does anyone know what this prefix is ? Marc Hall (213)-481-4735 elroy.jpl.nasa.gov!ladwp!marc
chrisj@netcom.COM (Christopher T. Jewell) (02/27/91)
In article <135@ladwp.ladwp.com> marc@ladwp (Marc Hall) writes: > > We have been attempting to determine what specific character sequences are >emitted by the the function keys f1-f12 on the IBM RS/6000 Model 320 when running >the emacs 18.56 in its own X window. > >The character sequences that we see when a key is pressed in a scratch buffer are >of the form : > f1 - 01q [stuff deleted] > >There is a prefix to each of these character sequences which has causes a behavior >similiar to the C-g bell function. Does anyone know what this prefix is ? The way to see the whole sequence generated by a function key (or other specialized keys such as PageUp and End) is to type a control-Q before the function key, so that the leading Escape or whatever will be inserted in the buffer, instead of being interpreted as a prefix. I'm replying from home so I cannot try it and tell you the exact result, but you'll probably see something like ^[[123q where the 123 will be different for each function key, but the Esc, [, and q will be the same for all (or at least most) of those keys. If you're looking to bind, for example, help to F1, you'll probably have to first unbind M-[ from its usual meaning, backward-paragraph, with a line like this in your .emacs file: (global-unset-key "\M-[") (Section 28.6.2 of the Gnu Emacs Manual shows an example of something similar). What appears to the original poster as a bell function is probably just Emacs complaining that the user has issued backward-paragraph while the point is at the start of the buffer. If he typed several lines of text with interspersed blank lines, the F1 key would probably jump to the blank line preceding the current paragraph before inserting the digits and the 'q'. -- Chris (Christopher T. Jewell) chrisj@netcom.com apple!netcom!chrisj
wohler@sapwdf.UUCP (Bill Wohler) (02/27/91)
allow me to save you some work. based upon sun.el, i came up with the following to bind the function keys to functions. most of it you won't need to change, but you can give functions to the PF keys. --bw wohler@sap-ag.de ----- my-x.el follows ----- (defvar x-esc-bracket t "*If non-nil, rebind ESC [ as prefix for X function keys.") (defun ignore-key () "interactive version of ignore" (interactive) (ignore)) (defvar num-state t) (defun swap-num-keys () "Exchange meaning of Number keys." (interactive) (setq num-state (cond ((null num-state) (define-key esc-map "On" 'ignore-key) ; comma (define-key esc-map "Op" 'ignore-key) ; 0 (define-key esc-map "Oq" 'ignore-key) ; 1 (define-key esc-map "Or" 'ignore-key) ; 2 (define-key esc-map "Os" 'ignore-key) ; 3 (define-key esc-map "Ot" 'ignore-key) ; 4 (define-key esc-map "Ou" 'ignore-key) ; 5 ;;(define-key esc-map "Ov" 'ignore-key) ; 6 (page up!) (define-key esc-map "Ow" 'ignore-key) ; 7 (define-key esc-map "Ox" 'ignore-key) ; 8 (define-key esc-map "Oy" 'ignore-key) ; 9 t) (t (define-key esc-map "On" 'delete-char) ; comma (define-key esc-map "Op" 'ignore-key) ; 0 (define-key esc-map "Oq" 'end-of-buffer) ; 1 (define-key esc-map "Or" 'next-line) ; 2 (define-key esc-map "Os" 'scroll-up) ; 3 (define-key esc-map "Ot" 'backward-char) ; 4 (define-key esc-map "Ou" 'ignore-key) ; 5 ;;(define-key esc-map "Ov" 'forward-char) ; 6 (page up!) (define-key esc-map "Ow" 'beginning-of-buffer) ; 7 (define-key esc-map "Ox" 'previous-line) ; 8 (define-key esc-map "Oy" 'scroll-down) ; 9 nil)))) (defvar x-raw-map (make-sparse-keymap) "*Keymap for ESC-[ encoded keyboard") (define-key x-raw-map "A" 'previous-line) ; up arrow (define-key x-raw-map "B" 'next-line) ; down arrow (define-key x-raw-map "D" 'backward-char) ; left arrow (define-key x-raw-map "C" 'forward-char) ; right arrow (define-key x-raw-map "11~" 'help-for-help) ; F1 (define-key x-raw-map "12~" 'ignore-key) ; F2 (define-key x-raw-map "13~" 'ignore-key) ; F3 (define-key x-raw-map "14~" 'ignore-key) ; F4 (define-key x-raw-map "15~" 'ignore-key) ; F5 (define-key x-raw-map "17~" 'ignore-key) ; F6 (define-key x-raw-map "18~" 'ignore-key) ; F7 (define-key x-raw-map "19~" 'ignore-key) ; F8 (define-key x-raw-map "20~" 'ignore-key) ; F9 (define-key x-raw-map "21~" 'my-exit-emacs) ; F10 (define-key x-raw-map "23~" 'ignore-key) ; F11 (define-key x-raw-map "2~" 'ignore-key) ; insert (define-key x-raw-map "\M-L" 'beginning-of-buffer) ; begin (define-key x-raw-map "\M-\C-@" 'end-of-buffer) ; end (if x-esc-bracket (progn (define-key esc-map "[" x-raw-map) ; Install x-raw-map (define-key esc-map "OP" 'swap-num-keys) ; num (define-key esc-map "OQ" 'ignore-key) ; div (define-key esc-map "OR" 'ignore-key) ; mult (define-key esc-map "OS" 'ignore-key) ; minus (define-key esc-map "Om" 'ignore-key) ; plus (define-key esc-map "OM" 'newline) ; enter (define-key esc-map "Ov" 'scroll-down) ; Page up (define-key esc-map "Ol" 'scroll-up) ; Page down (define-key esc-map "[[" 'backward-paragraph) ; the original esc-[ (swap-num-keys) ))
preston@LL.MIT.EDU (Steven Preston) (02/28/91)
In article mumble, marc@ladwp (Marc Hall) writes: > We have been attempting to determine what specific character sequences are > emitted by the the function keys f1-f12 on the IBM RS/6000 Model 320 when running > the emacs 18.56 in its own X window. Try using the see-chars function available on most emacs-lisp archives, and reproduced here; (defun see-chars () "Displays characters typed, terminated by a 3-second timeout." (interactive) (let ((chars "") (inhibit-quit t)) (message "Enter characters, terminated by 3-second timeout...") (while (not (sit-for 3)) (setq chars (concat chars (list (read-char))) quit-flag nil)) ; quit-flag maybe set by C-g (message "Characters entered: %s" (key-description chars)))) Simply eval this defun and then say M-x see-chars, type a key (or keys) and wait for three seconds. It will print the keys in the echo area. BTW, your function keys are almost certainly sending "ESC [ 0 0 1 q" for example. Emacs beeps because "ESC [ 0" is not bound in the keymap, whereas "ESC [" is. After complaining about the unbound seqence, by beeping, emacs sees "0 1 q" and inserts it into the current buffer. -- Steve Preston