1 ;;; sun.el --- keybinding for standard default sunterm keys
3 ;; Copyright (C) 1987, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Jeff Peck <peck@sun.com>
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 3, 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 the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
28 ;; The function key sequences for the console have been converted for
29 ;; use with function-key-map, but the *tool stuff hasn't been touched.
33 (defun scroll-down-in-place (n)
38 (defun scroll-up-in-place (n)
43 (defun kill-region-and-unmark (beg end
)
44 "Like kill-region, but pops the mark [which equals point, anyway.]"
47 (setq this-command
'kill-region-and-unmark
)
50 (defun select-previous-complex-command ()
51 "Select Previous-complex-command"
53 (if (zerop (minibuffer-depth))
54 (repeat-complex-command 1)
55 ;; FIXME: this function does not seem to exist. -stef'01
56 (previous-complex-command 1)))
58 (defun rerun-prev-command ()
59 "Repeat Previous-complex-command."
61 (eval (nth 0 command-history
)))
63 (defvar grep-arg nil
"Default arg for RE-search")
65 (if (memq last-command
'(research-forward research-backward
)) grep-arg
66 (let* ((command (car command-history
))
67 (command-name (symbol-name (car command
)))
68 (search-arg (car (cdr command
)))
70 (and command-name
(string-match "search" command-name
)))
72 (if (and search-command
(stringp search-arg
)) (setq grep-arg search-arg
)
73 (setq search-command this-command
74 grep-arg
(read-string "REsearch: " grep-arg
)
75 this-command search-command
)
78 (defun research-forward ()
79 "Repeat RE search forward."
81 (re-search-forward (grep-arg)))
83 (defun research-backward ()
84 "Repeat RE search backward."
86 (re-search-backward (grep-arg)))
89 ;; handle sun's extra function keys
90 ;; this version for those who run with standard .ttyswrc and no emacstool
92 ;; sunview picks up expose and open on the way UP,
93 ;; so we ignore them on the way down
96 (defvar sun-raw-prefix
97 (let ((map (make-sparse-keymap)))
98 (define-key map
"210z" [r3])
99 (define-key map "213z" [r6])
100 (define-key map "214z" [r7])
101 (define-key map "216z" [r9])
102 (define-key map "218z" [r11])
103 (define-key map "220z" [r13])
104 (define-key map "222z" [r15])
105 (define-key map "193z" [redo])
106 (define-key map "194z" [props])
107 (define-key map "195z" [undo])
108 ;; (define-key map "196z" 'ignore) ; Expose-down
109 ;; (define-key map "197z" [put])
110 ;; (define-key map "198z" 'ignore) ; Open-down
111 ;; (define-key map "199z" [get])
112 (define-key map "200z" [find])
113 ;; (define-key map "201z" 'kill-region-and-unmark) ; Delete
114 (define-key map "224z" [f1])
115 (define-key map "225z" [f2])
116 (define-key map "226z" [f3])
117 (define-key map "227z" [f4])
118 (define-key map "228z" [f5])
119 (define-key map "229z" [f6])
120 (define-key map "230z" [f7])
121 (define-key map "231z" [f8])
122 (define-key map "232z" [f9])
123 (define-key map "233z" [f10])
124 (define-key map "234z" [f11])
125 (define-key map "235z" [f12])
126 (define-key map "A" [up]) ; R8
127 (define-key map "B" [down]) ; R14
128 (define-key map "C" [right]) ; R12
129 (define-key map "D" [left]) ; R10
132 ;; Since .emacs gets loaded before this file, a hook is supplied
133 ;; for you to put your own bindings in.
135 (defvar sun-raw-prefix-hooks nil
136 "List of forms to evaluate after setting sun-raw-prefix.")
140 (defun terminal-init-sun ()
141 "Terminal initialization function for sun."
142 (define-key input-decode-map "\e[" sun-raw-prefix)
144 (global-set-key [r3] 'backward-page
)
145 (global-set-key [r6] 'forward-page)
146 (global-set-key [r7] 'beginning-of-buffer)
147 (global-set-key [r9] 'scroll-down)
148 (global-set-key [r11] 'recenter)
149 (global-set-key [r13] 'end-of-buffer)
150 (global-set-key [r15] 'scroll-up)
151 (global-set-key [redo] 'redraw-display) ;FIXME: collides with default.
152 (global-set-key [props] 'list-buffers)
153 (global-set-key [put] 'sun-select-region)
154 (global-set-key [get] 'sun-yank-selection)
155 (global-set-key [find] 'exchange-point-and-mark)
156 (global-set-key [f3] 'scroll-down-in-place)
157 (global-set-key [f4] 'scroll-up-in-place)
158 (global-set-key [f6] 'shrink-window)
159 (global-set-key [f7] 'enlarge-window)
161 (when sun-raw-prefix-hooks
162 (message "sun-raw-prefix-hooks is obsolete! Use term-setup-hook instead!")
163 (let ((hooks sun-raw-prefix-hooks))
166 (setq hooks (cdr hooks))))))
168 ;; arch-tag: db761d47-fd7d-42b4-aae1-04fa116b6ba6