annotate lisp/=sun-keys.el @ 483:00f564a647fa

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Mon, 13 Jan 1992 06:37:58 +0000
parents 63b375f17a65
children 7cbd4fcd8b0f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 ;;; Support (cleanly) for Sun function keys. Provides help facilities,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3 ;;; better diagnostics, etc.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 ;;; To use: make sure your .ttyswrc binds 'F1' to <ESC> * F1 <CR> and so on.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 ;;; load this lot from your start_up
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 ;;; Copyright (C) 1986 Free Software Foundation, Inc.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;;; This file is part of GNU Emacs.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; the Free Software Foundation; either version 1, or (at your option)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; any later version.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 ;; GNU General Public License for more details.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;;; Batten@uk.ac.bham.multics (Ian G. Batten)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 (defun sun-function-keys-dispatch (arg)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 "Dispatcher for function keys."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 (interactive "p")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 (let* ((key-stroke (read t))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 (command (assq key-stroke sun-function-keys-command-list)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 (cond (command (funcall (cdr command) arg))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 (t (error "Unbound function key %s" key-stroke)))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 (defvar sun-function-keys-command-list
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 '((F1 . sun-function-keys-describe-bindings)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 (R8 . previous-line) ; arrow keys
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 (R10 . backward-char)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 (R12 . forward-char)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 (R14 . next-line)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 (defun sun-function-keys-bind-key (arg1 arg2)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 "Bind a specified key."
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 (interactive "xFunction Key Cap Label:
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 CCommand To Use:")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 (setq sun-function-keys-command-list
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (cons (cons arg1 arg2) sun-function-keys-command-list)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 (defun sun-function-keys-describe-bindings (arg)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 "Describe the function key bindings we're running"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 (interactive)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 (with-output-to-temp-buffer "*Help*"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (sun-function-keys-write-bindings
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 (sort (copy-sequence sun-function-keys-command-list)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 '(lambda (x y) (string-lessp (car x) (car y)))))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 (defun sun-function-keys-write-bindings (list)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 (cond ((null list)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 t)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 (t
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (princ (format "%s: %s\n"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 (car (car list))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 (cdr (car list))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 (sun-function-keys-write-bindings (cdr list)))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 (global-set-key "\e*" 'sun-function-keys-dispatch)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 (make-variable-buffer-local 'sun-function-keys-command-list)