Mercurial > emacs
annotate lisp/=sun-keys.el @ 826:e9b9a1cff2c9
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Tue, 21 Jul 1992 04:09:28 +0000 |
parents | 38b2499cb3e9 |
children | 2cdce064065f |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
1 ;;; sun-keys.el --- support for Sun function keys |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
2 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
3 ;; Author: Ian G. Batten <batten@uk.ac.bham.multics> |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
4 ;; Last-Modified: 30 May 1992 |
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
5 ;; Keywords: terminals |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
6 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
7 ;;; Copyright (C) 1986 Free Software Foundation, Inc. |
35 | 8 ;;; |
9 ;;; This file is part of GNU Emacs. | |
10 | |
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 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
35 | 14 ;; any later version. |
15 | |
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. | |
20 | |
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. | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
24 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
25 ;;; Commentary: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
26 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
27 ;;; Support (cleanly) for Sun function keys. Provides help facilities, |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
28 ;;; better diagnostics, etc. |
35 | 29 ;;; |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
30 ;;; To use: make sure your .ttyswrc binds 'F1' to <ESC> * F1 <CR> and so on. |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
31 ;;; load this lot from your start_up |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
32 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
33 ;;; Code: |
35 | 34 |
35 (defun sun-function-keys-dispatch (arg) | |
36 "Dispatcher for function keys." | |
37 (interactive "p") | |
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))))) | |
42 | |
43 (defvar sun-function-keys-command-list | |
44 '((F1 . sun-function-keys-describe-bindings) | |
45 (R8 . previous-line) ; arrow keys | |
46 (R10 . backward-char) | |
47 (R12 . forward-char) | |
48 (R14 . next-line))) | |
49 | |
50 (defun sun-function-keys-bind-key (arg1 arg2) | |
51 "Bind a specified key." | |
52 (interactive "xFunction Key Cap Label: | |
53 CCommand To Use:") | |
54 (setq sun-function-keys-command-list | |
55 (cons (cons arg1 arg2) sun-function-keys-command-list))) | |
56 | |
57 (defun sun-function-keys-describe-bindings (arg) | |
58 "Describe the function key bindings we're running" | |
59 (interactive) | |
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))))))) | |
64 | |
65 (defun sun-function-keys-write-bindings (list) | |
66 (cond ((null list) | |
67 t) | |
68 (t | |
69 (princ (format "%s: %s\n" | |
70 (car (car list)) | |
71 (cdr (car list)))) | |
72 (sun-function-keys-write-bindings (cdr list))))) | |
73 | |
74 (global-set-key "\e*" 'sun-function-keys-dispatch) | |
75 | |
76 (make-variable-buffer-local 'sun-function-keys-command-list) | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
77 |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
35
diff
changeset
|
78 ;;; sun-keys.el ends here |