annotate lisp/term/sun.el @ 34946:3b286703dff9

*** empty log message ***
author Gerd Moellmann <gerd@gnu.org>
date Tue, 02 Jan 2001 10:35:32 +0000
parents 8f952e921136
children 916f157c7118
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17517
8f952e921136 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 14170
diff changeset
1 ;;; sun.el --- keybinding for standard default sunterm keys
2140
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
2
14170
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
3 ;; Copyright (C) 1987 Free Software Foundation, Inc.
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
4
2140
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
5 ;; Author: Jeff Peck <peck@sun.com>
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
6 ;; Keywords: terminals
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
7
14170
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
8 ;; This file is part of GNU Emacs.
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
9
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
13 ;; any later version.
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14
14170
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
18 ;; GNU General Public License for more details.
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
19
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
20 ;; You should have received a copy of the GNU General Public License
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23cc3f54e536 Update FSF's office address.
Erik Naggum <erik@naggum.no>
parents: 5029
diff changeset
23 ;; Boston, MA 02111-1307, USA.
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
2140
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
25 ;;; Commentary:
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;; The function key sequences for the console have been converted for
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;; use with function-key-map, but the *tool stuff hasn't been touched.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29
2140
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
30 ;;; Code:
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 (defun ignore-key ()
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 "interactive version of ignore"
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 (interactive)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 (ignore))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 (defun scroll-down-in-place (n)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 (interactive "p")
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 (previous-line n)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 (scroll-down n))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 (defun scroll-up-in-place (n)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 (interactive "p")
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 (next-line n)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 (scroll-up n))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 (defun kill-region-and-unmark (beg end)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 "Like kill-region, but pops the mark [which equals point, anyway.]"
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 (interactive "r")
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (kill-region beg end)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (setq this-command 'kill-region-and-unmark)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 (set-mark-command t))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 (defun select-previous-complex-command ()
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 "Select Previous-complex-command"
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 (interactive)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 (if (zerop (minibuffer-depth))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 (repeat-complex-command 1)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 (previous-complex-command 1)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 (defun rerun-prev-command ()
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 "Repeat Previous-complex-command."
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 (interactive)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 (eval (nth 0 command-history)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 (defvar grep-arg nil "Default arg for RE-search")
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 (defun grep-arg ()
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 (if (memq last-command '(research-forward research-backward)) grep-arg
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 (let* ((command (car command-history))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 (command-name (symbol-name (car command)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 (search-arg (car (cdr command)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 (search-command
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 (and command-name (string-match "search" command-name)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 )
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 (if (and search-command (stringp search-arg)) (setq grep-arg search-arg)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 (setq search-command this-command
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 grep-arg (read-string "REsearch: " grep-arg)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 this-command search-command)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 grep-arg))))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 (defun research-forward ()
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 "Repeat RE search forward."
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 (interactive)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (re-search-forward (grep-arg)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 (defun research-backward ()
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 "Repeat RE search backward."
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 (interactive)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (re-search-backward (grep-arg)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 ;;; handle sun's extra function keys
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 ;;; this version for those who run with standard .ttyswrc and no emacstool
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 ;;; sunview picks up expose and open on the way UP,
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 ;;; so we ignore them on the way down
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 (defvar sun-esc-bracket nil
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 "*If non-nil, rebind ESC [ as prefix for Sun function keys.")
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101
5029
c02c789d39d7 (sun-raw-prefix): Make this just a variable, not a function name.
Richard M. Stallman <rms@gnu.org>
parents: 3287
diff changeset
102 (defvar sun-raw-prefix (make-sparse-keymap))
c02c789d39d7 (sun-raw-prefix): Make this just a variable, not a function name.
Richard M. Stallman <rms@gnu.org>
parents: 3287
diff changeset
103 (define-key function-key-map "\e[" sun-raw-prefix)
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104
498
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
105 (define-key sun-raw-prefix "210z" [r3])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
106 (define-key sun-raw-prefix "213z" [r6])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
107 (define-key sun-raw-prefix "214z" [r7])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
108 (define-key sun-raw-prefix "216z" [r9])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
109 (define-key sun-raw-prefix "218z" [r11])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
110 (define-key sun-raw-prefix "220z" [r13])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
111 (define-key sun-raw-prefix "222z" [r15])
2140
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
112 (define-key sun-raw-prefix "193z" [redo])
498
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
113 (define-key sun-raw-prefix "194z" [props])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
114 (define-key sun-raw-prefix "195z" [undo])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
115 ; (define-key sun-raw-prefix "196z" 'ignore-key) ; Expose-down
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
116 ; (define-key sun-raw-prefix "197z" [put])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
117 ; (define-key sun-raw-prefix "198z" 'ignore-key) ; Open-down
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
118 ; (define-key sun-raw-prefix "199z" [get])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
119 (define-key sun-raw-prefix "200z" [find])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
120 ; (define-key sun-raw-prefix "201z" 'kill-region-and-unmark) ; Delete
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
121 (define-key sun-raw-prefix "226z" [t3])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
122 (define-key sun-raw-prefix "227z" [t4])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
123 (define-key sun-raw-prefix "229z" [t6])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
124 (define-key sun-raw-prefix "230z" [t7])
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
125 (define-key sun-raw-prefix "A" [up]) ; R8
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
126 (define-key sun-raw-prefix "B" [down]) ; R14
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
127 (define-key sun-raw-prefix "C" [right]) ; R12
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
128 (define-key sun-raw-prefix "D" [left]) ; R10
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 (global-set-key [r3] 'backward-page)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 (global-set-key [r6] 'forward-page)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 (global-set-key [r7] 'beginning-of-buffer)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 (global-set-key [r9] 'scroll-down)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 (global-set-key [r11] 'recenter)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 (global-set-key [r13] 'end-of-buffer)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 (global-set-key [r15] 'scroll-up)
2140
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
137 (global-set-key [redo] 'redraw-display)
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 (global-set-key [props] 'list-buffers)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 (global-set-key [undo] 'undo)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 (global-set-key [put] 'sun-select-region)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 (global-set-key [get] 'sun-yank-selection)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 (global-set-key [find] 'exchange-point-and-mark)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 (global-set-key [t3] 'scroll-down-in-place)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 (global-set-key [t4] 'scroll-up-in-place)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 (global-set-key [t6] 'shrink-window)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 (global-set-key [t7] 'enlarge-window)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 (if sun-esc-bracket (global-unset-key "\e["))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 ;;; Since .emacs gets loaded before this file, a hook is supplied
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 ;;; for you to put your own bindings in.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153
498
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
154 (defvar sun-raw-prefix-hooks nil
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
155 "List of forms to evaluate after setting sun-raw-prefix.")
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156
498
b8f4bc96f789 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 466
diff changeset
157 (let ((hooks sun-raw-prefix-hooks))
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 (while hooks
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 (eval (car hooks))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 (setq hooks (cdr hooks))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 ))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163
2140
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
164 ;;; This section adds definitions for the emacstool users
466
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 ;;; emacstool event filter converts function keys to C-x*{c}{lrt}
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 ;;; for example the Open key (L7) would be encoded as "\C-x*gl"
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 ;;; the control, meta, and shift keys modify the character {lrt}
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 ;;; note that (unshifted) C-l is ",", C-r is "2", and C-t is "4"
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 ;;; {c} is [a-j] for LEFT, [a-i] for TOP, [a-o] for RIGHT.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 ;;; A higher level insists on encoding {h,j,l,n}{r} (the arrow keys)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 ;;; as ANSI escape sequences. Use the shell command
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 ;;; % setkeys noarrows
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 ;;; if you want these to come through for emacstool.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 ;;; If you are not using EmacsTool,
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 ;;; you can also use this by creating a .ttyswrc file to do the conversion.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 ;;; but it won't include the CONTROL, META, or SHIFT keys!
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 ;;; Important to define SHIFTed sequence before matching unshifted sequence.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 ;;; (talk about bletcherous old uppercase terminal conventions!*$#@&%*&#$%)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 ;;; this is worse than C-S/C-Q flow control anyday!
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 ;;; Do *YOU* run in capslock mode?
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 ;;; Note: al, el and gl are trapped by EmacsTool, so they never make it here.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 (defvar meta-flag t)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 (defvar suntool-map (make-sparse-keymap)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 "*Keymap for Emacstool bindings.")
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 (define-key suntool-map "gr" 'beginning-of-buffer) ; r7
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 (define-key suntool-map "iR" 'backward-page) ; R9
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 (define-key suntool-map "ir" 'scroll-down) ; r9
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 (define-key suntool-map "kr" 'recenter) ; r11
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 (define-key suntool-map "mr" 'end-of-buffer) ; r13
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 (define-key suntool-map "oR" 'forward-page) ; R15
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 (define-key suntool-map "or" 'scroll-up) ; r15
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 (define-key suntool-map "b\M-L" 'rerun-prev-command) ; M-AGAIN
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (define-key suntool-map "b\M-l" 'prev-complex-command) ; M-Again
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 (define-key suntool-map "bl" 'redraw-display) ; Again
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 (define-key suntool-map "cl" 'list-buffers) ; Props
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 (define-key suntool-map "dl" 'undo) ; Undo
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 (define-key suntool-map "el" 'ignore-key) ; Expose-Open
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 (define-key suntool-map "fl" 'sun-select-region) ; Put
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (define-key suntool-map "f," 'copy-region-as-kill) ; C-Put
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 (define-key suntool-map "gl" 'ignore-key) ; Open-Open
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 (define-key suntool-map "hl" 'sun-yank-selection) ; Get
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 (define-key suntool-map "h," 'yank) ; C-Get
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 (define-key suntool-map "il" 'research-forward) ; Find
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 (define-key suntool-map "i," 're-search-forward) ; C-Find
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 (define-key suntool-map "i\M-l" 'research-backward) ; M-Find
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 (define-key suntool-map "i\M-," 're-search-backward) ; C-M-Find
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (define-key suntool-map "jL" 'yank) ; DELETE
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 (define-key suntool-map "jl" 'kill-region-and-unmark) ; Delete
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 (define-key suntool-map "j\M-l" 'exchange-point-and-mark); M-Delete
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 (define-key suntool-map "j,"
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 '(lambda () (interactive) (pop-mark 1))) ; C-Delete
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 (define-key suntool-map "fT" 'shrink-window-horizontally) ; T6
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 (define-key suntool-map "gT" 'enlarge-window-horizontally) ; T7
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 (define-key suntool-map "ft" 'shrink-window) ; t6
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 (define-key suntool-map "gt" 'enlarge-window) ; t7
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (define-key suntool-map "cT" '(lambda(n) (interactive "p") (scroll-down n)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 (define-key suntool-map "dT" '(lambda(n) (interactive "p") (scroll-up n)))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 (define-key suntool-map "ct" 'scroll-down-in-place) ; t3
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 (define-key suntool-map "dt" 'scroll-up-in-place) ; t4
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 (define-key ctl-x-map "*" suntool-map)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 ;;; Since .emacs gets loaded before this file, a hook is supplied
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 ;;; for you to put your own bindings in.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 (defvar suntool-map-hooks nil
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 "List of forms to evaluate after setting suntool-map.")
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 (let ((hooks suntool-map-hooks))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 (while hooks
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 (eval (car hooks))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 (setq hooks (cdr hooks))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 ))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 ;;; If running under emacstool, arrange to call suspend-emacstool
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 ;;; instead of suspend-emacs.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 ;;; First mouse blip is a clue that we are in emacstool.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 ;;;
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 ;;; C-x C-@ is the mouse command prefix.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 (autoload 'sun-mouse-handler "sun-mouse"
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 "Sun Emacstool handler for mouse blips (not loaded)." t)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 (defun emacstool-init ()
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 "Set up Emacstool window, if you know you are in an emacstool."
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 ;; Make sure sun-mouse and sun-fns are loaded.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 (require 'sun-fns)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 (define-key ctl-x-map "\C-@" 'sun-mouse-handler)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 (if (< (sun-window-init) 0)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 (message "Not a Sun Window")
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 (progn
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 (substitute-key-definition 'suspend-emacs 'suspend-emacstool global-map)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 (substitute-key-definition 'suspend-emacs 'suspend-emacstool esc-map)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 (substitute-key-definition 'suspend-emacs 'suspend-emacstool ctl-x-map))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 (send-string-to-terminal
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 (concat "\033]lEmacstool - GNU Emacs " emacs-version "\033\\"))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 ))
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 (defun sun-mouse-once ()
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 "Converts to emacstool and sun-mouse-handler on first mouse hit."
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 (interactive)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 (emacstool-init)
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 (sun-mouse-handler) ; Now, execute this mouse blip.
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 )
a5749ca987d0 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 (define-key ctl-x-map "\C-@" 'sun-mouse-once)
2140
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
279
c049f2ca31f6 Added headers, removed function-key bindings.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 498
diff changeset
280 ;;; sun.el ends here