1 ;;; sun-keys.el --- support for Sun function keys
3 ;; Author: Ian G. Batten <batten@uk.ac.bham.multics>
4 ;; Last-Modified: 30 May 1992
7 ;;; Copyright (C) 1986 Free Software Foundation, Inc.
9 ;;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 ;;; Support (cleanly) for Sun function keys. Provides help facilities,
28 ;;; better diagnostics, etc.
30 ;;; To use: make sure your .ttyswrc binds 'F1' to <ESC> * F1 <CR> and so on.
31 ;;; load this lot from your start_up
35 (defun sun-function-keys-dispatch (arg)
36 "Dispatcher for function keys."
38 (let* ((key-stroke (read t
))
39 (command (assq key-stroke sun-function-keys-command-list
)))
40 (cond (command (funcall (cdr command
) arg
))
41 (t (error "Unbound function key %s" key-stroke
)))))
43 (defvar sun-function-keys-command-list
44 '((F1 . sun-function-keys-describe-bindings
)
45 (R8 . previous-line
) ; arrow keys
50 (defun sun-function-keys-bind-key (arg1 arg2
)
51 "Bind a specified key."
52 (interactive "xFunction Key Cap Label:
54 (setq sun-function-keys-command-list
55 (cons (cons arg1 arg2
) sun-function-keys-command-list
)))
57 (defun sun-function-keys-describe-bindings (arg)
58 "Describe the function key bindings we're running"
60 (with-output-to-temp-buffer "*Help*"
61 (sun-function-keys-write-bindings
62 (sort (copy-sequence sun-function-keys-command-list
)
63 '(lambda (x y
) (string-lessp (car x
) (car y
)))))))
65 (defun sun-function-keys-write-bindings (list)
69 (princ (format "%s: %s\n"
72 (sun-function-keys-write-bindings (cdr list
)))))
74 (global-set-key "\e*" 'sun-function-keys-dispatch
)
76 (make-variable-buffer-local 'sun-function-keys-command-list
)
78 ;;; sun-keys.el ends here