* lisp/url/url-handlers.el (url-http-parse-response): Remove unused autoload.
[bpt/emacs.git] / lisp / term / sun.el
CommitLineData
092af6d8 1;;; sun.el --- keybinding for standard default sunterm keys
864a714e 2
ba318903 3;; Copyright (C) 1987, 2001-2014 Free Software Foundation, Inc.
2fe590dc 4
864a714e
ER
5;; Author: Jeff Peck <peck@sun.com>
6;; Keywords: terminals
7
2fe590dc
EN
8;; This file is part of GNU Emacs.
9
1fecc8fe 10;; GNU Emacs is free software: you can redistribute it and/or modify
2fe590dc 11;; it under the terms of the GNU General Public License as published by
1fecc8fe
GM
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
2fe590dc
EN
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
e645a1dd 19
2fe590dc 20;; You should have received a copy of the GNU General Public License
1fecc8fe 21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
e645a1dd 22
864a714e 23;;; Commentary:
e645a1dd
JB
24
25;; The function key sequences for the console have been converted for
26;; use with function-key-map, but the *tool stuff hasn't been touched.
27
864a714e 28;;; Code:
e645a1dd 29
e645a1dd
JB
30(defun scroll-down-in-place (n)
31 (interactive "p")
f7ba2ff4 32 (forward-line (- n))
e645a1dd
JB
33 (scroll-down n))
34
35(defun scroll-up-in-place (n)
36 (interactive "p")
f7ba2ff4 37 (forward-line n)
e645a1dd
JB
38 (scroll-up n))
39
40(defun kill-region-and-unmark (beg end)
9c9e18e8 41 "Like `kill-region', but pops the mark [which equals point, anyway.]"
e645a1dd
JB
42 (interactive "r")
43 (kill-region beg end)
44 (setq this-command 'kill-region-and-unmark)
45 (set-mark-command t))
46
e645a1dd
JB
47(defun rerun-prev-command ()
48 "Repeat Previous-complex-command."
49 (interactive)
50 (eval (nth 0 command-history)))
51
52(defvar grep-arg nil "Default arg for RE-search")
53(defun grep-arg ()
54 (if (memq last-command '(research-forward research-backward)) grep-arg
55 (let* ((command (car command-history))
56 (command-name (symbol-name (car command)))
57 (search-arg (car (cdr command)))
db95369b 58 (search-command
e645a1dd
JB
59 (and command-name (string-match "search" command-name)))
60 )
61 (if (and search-command (stringp search-arg)) (setq grep-arg search-arg)
db95369b 62 (setq search-command this-command
e645a1dd
JB
63 grep-arg (read-string "REsearch: " grep-arg)
64 this-command search-command)
65 grep-arg))))
66
67(defun research-forward ()
68 "Repeat RE search forward."
69 (interactive)
70 (re-search-forward (grep-arg)))
71
72(defun research-backward ()
73 "Repeat RE search backward."
74 (interactive)
75 (re-search-backward (grep-arg)))
76\f
acd9f40c
SM
77;;
78;; handle sun's extra function keys
79;; this version for those who run with standard .ttyswrc and no emacstool
80;;
db95369b 81;; sunview picks up expose and open on the way UP,
acd9f40c
SM
82;; so we ignore them on the way down
83;;
e645a1dd 84
9039fed0
SM
85(defvar sun-raw-prefix
86 (let ((map (make-sparse-keymap)))
87 (define-key map "210z" [r3])
88 (define-key map "213z" [r6])
89 (define-key map "214z" [r7])
90 (define-key map "216z" [r9])
91 (define-key map "218z" [r11])
92 (define-key map "220z" [r13])
93 (define-key map "222z" [r15])
94 (define-key map "193z" [redo])
95 (define-key map "194z" [props])
96 (define-key map "195z" [undo])
97 ;; (define-key map "196z" 'ignore) ; Expose-down
98 ;; (define-key map "197z" [put])
99 ;; (define-key map "198z" 'ignore) ; Open-down
100 ;; (define-key map "199z" [get])
101 (define-key map "200z" [find])
102 ;; (define-key map "201z" 'kill-region-and-unmark) ; Delete
103 (define-key map "224z" [f1])
104 (define-key map "225z" [f2])
105 (define-key map "226z" [f3])
106 (define-key map "227z" [f4])
107 (define-key map "228z" [f5])
108 (define-key map "229z" [f6])
109 (define-key map "230z" [f7])
110 (define-key map "231z" [f8])
111 (define-key map "232z" [f9])
112 (define-key map "233z" [f10])
113 (define-key map "234z" [f11])
114 (define-key map "235z" [f12])
115 (define-key map "A" [up]) ; R8
116 (define-key map "B" [down]) ; R14
117 (define-key map "C" [right]) ; R12
118 (define-key map "D" [left]) ; R10
119 map))
e645a1dd 120
acd9f40c
SM
121;; Since .emacs gets loaded before this file, a hook is supplied
122;; for you to put your own bindings in.
e645a1dd 123
141e63d5 124(defvar sun-raw-prefix-hooks nil
9c9e18e8 125 "List of forms to evaluate after setting `sun-raw-prefix'.")
98bd6b32
GM
126;; Obsolete since 21.1, but tty-setup-hook only exists since 24.4.
127(make-obsolete-variable 'sun-raw-prefix-hooks 'tty-setup-hook "21.1")
e645a1dd 128
e645a1dd 129\f
e645a1dd 130
4f0c9ba7
DN
131(defun terminal-init-sun ()
132 "Terminal initialization function for sun."
9039fed0 133 (define-key input-decode-map "\e[" sun-raw-prefix)
4f0c9ba7
DN
134
135 (global-set-key [r3] 'backward-page)
136 (global-set-key [r6] 'forward-page)
137 (global-set-key [r7] 'beginning-of-buffer)
ce3cefcc 138 (global-set-key [r9] 'scroll-down-command)
4f0c9ba7
DN
139 (global-set-key [r11] 'recenter)
140 (global-set-key [r13] 'end-of-buffer)
ce3cefcc 141 (global-set-key [r15] 'scroll-up-command)
4f0c9ba7
DN
142 (global-set-key [redo] 'redraw-display) ;FIXME: collides with default.
143 (global-set-key [props] 'list-buffers)
144 (global-set-key [put] 'sun-select-region)
145 (global-set-key [get] 'sun-yank-selection)
146 (global-set-key [find] 'exchange-point-and-mark)
147 (global-set-key [f3] 'scroll-down-in-place)
148 (global-set-key [f4] 'scroll-up-in-place)
149 (global-set-key [f6] 'shrink-window)
150 (global-set-key [f7] 'enlarge-window)
151
152 (when sun-raw-prefix-hooks
98bd6b32
GM
153 (message "sun-raw-prefix-hooks is obsolete! Use %s instead!"
154 (or (car-safe (get 'sun-raw-prefix-hooks 'byte-obsolete-variable))
155 "emacs-startup-hook"))
4f0c9ba7
DN
156 (let ((hooks sun-raw-prefix-hooks))
157 (while hooks
158 (eval (car hooks))
ee756915 159 (setq hooks (cdr hooks))))))
864a714e
ER
160
161;;; sun.el ends here