view lisp/term/tvi970.el @ 1590:11cd7c23f538

* keyboard.c (unread_switch_frame): Don't declare this static. * keyboard.c (Vlast_event_frame): Doc fix. * keyboard.c (read_char): Write composite events to the dribble file properly. * keyboard.c (init_keyboard): Initialize Vlast_event_frame to Qnil, rather than the selected frame. * keyboard.c (lispy_modifier_list): Added sanity check before indexing into modifier_symbols. * keyboard.c (add_command_key): When copying the contents of the old this_command_keys to new_keys, remember to multiply size by sizeof (Lisp_Object) to get the amount we really need to copy. Rename unread_command_char to unread_command_event; it has subtly different semantics now, and we should use `make-obsolete-variable' to warn people. * keyboard.c (unread_command_char): Rename. (command_loop_1, read_char, Finput_pending, Fdiscard_input, quit_throw_to_read_char, init_keyboard, syms_of_keyboard): Change references. * keyboard.c (read_key_sequence): Don't use save_excursion_{save,restore} to protect the caller against buffer switches; use Fset_buffer and Fcurrent_buffer; redisplay might change point, and we don't want to undo that. * keyboard.c (kbd_buffer_get_event): When checking a mouse movement for a frame switch, don't assume Vlast_event_frame contains a Lisp_Frame object.
author Jim Blandy <jimb@redhat.com>
date Mon, 16 Nov 1992 00:44:13 +0000
parents 86f90c43ef3e
children 9bc89a98c002
line wrap: on
line source

;;; Terminal support for the Televideo 970.
;;; Jim Blandy <jimb@occs.cs.oberlin.edu>, January 1992


;;; Define the escape codes sent by the function keys.
(or (lookup-key function-key-map "\e[")
    (define-key function-key-map "\e[" (make-keymap)))
(or (lookup-key function-key-map "\eO")
    (define-key function-key-map "\eO" (make-keymap)))

;; Miscellaneous keys
(mapcar (function (lambda (key-binding)
		    (define-key function-key-map
		      (car key-binding) (nth 1 key-binding))))
	'(("\e[H" [home])
	  ("\e[Z" [backtab])
	  ("\e[i" [print])
	  ("\e[2J" [clear])
	  ("\e[@" [insert])
	  ("\e[P" [delete])
	  ("\e[L" [insertline])
	  ("\e[M" [deleteline])
	  ("\e[K" [eraseline])
	  ("\e[J" [erasepage])
	  ("\e[U" [page])
	  ("\e[g" [S-tab])
	  ("\e[2N" [clearentry])
	  ("\e[2K" [S-clearentry])
	  ("\e[E" [?\C-j])
	  ("\e[g" [S-backtab])
	  ("\e[?1i" [S-print])
	  ("\e[4h" [S-insert])
	  ("\e[4l" [S-delete])
	  ("\e[Q"  [S-insertline])
	  ("\e[1Q" [S-deleteline])
	  ("\e[19l" [S-eraseline])
	  ("\e[19h" [S-erasepage])
	  ("\e[V" [S-page])
	  ("\eS" [send])
	  ("\e5" [S-send])
	  ("\eOm" [kp-subtract])
	  ("\eOl" [kp-separator])
	  ("\eOn" [kp-decimal])
	  ("\eOM" [enter])
	  ("\eOP" [kp-f1])
	  ("\eOQ" [kp-f2])
	  ("\eOR" [kp-f3])
	  ("\eOS" [kp-f4])))
;; The numeric keypad keys.
(let ((i 0))
  (while (< i 10)
    (define-key function-key-map
      (format "\eO%c" (+ i ?p))
      (vector (intern (format "kp-%d" i))))
    (setq i (1+ i))))
;; The numbered function keys.
(let ((i 0))
  (while (< i 16)
    (define-key function-key-map
      (format "\e?%c" (+ i ?a))
      (vector (intern (format "f%d" (1+ i)))))
    (define-key function-key-map
      (format "\e?%c" (+ i ?A))
      (vector (intern (format "S-f%d" (1+ i)))))
    (setq i (1+ i))))


;;; Should keypad numbers send ordinary digits or distinct escape sequences?
(defvar tvi970-keypad-numeric nil
  "The terminal should be in numeric keypad mode iff this variable is non-nil.
Do not set this variable!  Call the function ``tvi970-set-keypad-mode''.")

(defun tvi970-set-keypad-mode (&optional arg)
  "Set the current mode of the TVI 970 numeric keypad.
In ``numeric keypad mode'', the number keys on the keypad act as
ordinary digits.  In ``alternate keypad mode'', the keys send distinct
escape sequences, meaning that they can have their own bindings,
independent of the normal number keys.
With no argument, toggle between the two possible modes.
With a positive argument, select alternate keypad mode.
With a negative argument, select numeric keypad mode."
  (interactive "P")
  (setq tvi970-keypad-numeric 
	(if (null arg)
	    (not tvi970-keypad-numeric)
	  (> (prefix-numeric-value arg) 0)))
  (send-string-to-terminal (if tvi970-keypad-numeric "\e=" "\e>")))

(tvi970-set-keypad-mode 1)