Mercurial > emacs
annotate lisp/emulation/ws-mode.el @ 5828:0c2b604b0385
Comment change.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 07 Feb 1994 20:32:40 +0000 |
parents | 1f5c25761f2f |
children | 3e1323443b1a |
rev | line source |
---|---|
656
d74e65773062
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
309
diff
changeset
|
1 ;;; ws-mode.el --- WordStar emulation mode for GNU Emacs |
d74e65773062
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
309
diff
changeset
|
2 |
841 | 3 ;; Copyright (C) 1991 Free Software Foundation, Inc. |
4 | |
772
2b5af16c9af3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
656
diff
changeset
|
5 ;; Author: Juergen Nickelsen <nickel@cs.tu-berlin.de> |
2b5af16c9af3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
656
diff
changeset
|
6 ;; Version: 0.7 |
812
485e82a8acb5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
773
diff
changeset
|
7 ;; Keywords: emulations |
309 | 8 |
9 ;; This file is distributed in the hope that it will be useful, | |
10 ;; but WITHOUT ANY WARRANTY. No author or distributor | |
11 ;; accepts responsibility to anyone for the consequences of using it | |
12 ;; or for whether it serves any particular purpose or works at all, | |
13 ;; unless he says so in writing. Refer to the GNU Emacs General Public | |
14 ;; License for full details. | |
15 | |
16 ;; Everyone is granted permission to copy, modify and redistribute | |
17 ;; this file, but only under the conditions described in the | |
18 ;; GNU Emacs General Public License. A copy of this license is | |
19 ;; supposed to have been given to you along with GNU Emacs so you | |
20 ;; can know your rights and responsibilities. It should be in a | |
21 ;; file named COPYING. Among other things, the copyright notice | |
22 ;; and this notice must be preserved on all copies. | |
23 | |
772
2b5af16c9af3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
656
diff
changeset
|
24 ;;; Commentary: |
309 | 25 |
1222
3db6f2ac8539
Delete obsolete comments.
Richard M. Stallman <rms@gnu.org>
parents:
841
diff
changeset
|
26 ;; This emulates WordStar, with a major mode. |
309 | 27 |
772
2b5af16c9af3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
656
diff
changeset
|
28 ;;; Code: |
309 | 29 |
30 (defvar wordstar-mode-map nil "") | |
31 (defvar wordstar-C-j-map nil "") | |
32 (defvar wordstar-C-k-map nil "") | |
33 (defvar wordstar-C-o-map nil "") | |
34 (defvar wordstar-C-q-map nil "") | |
35 | |
36 (if wordstar-mode-map | |
37 () | |
38 (setq wordstar-mode-map (make-keymap)) | |
39 ;; (setq wordstar-C-j-map (make-keymap)) ; later, perhaps | |
40 (setq wordstar-C-k-map (make-keymap)) | |
41 (setq wordstar-C-o-map (make-keymap)) | |
42 (setq wordstar-C-q-map (make-keymap)) | |
43 | |
44 (define-key wordstar-mode-map "\C-a" 'backward-word) | |
45 (define-key wordstar-mode-map "\C-b" 'fill-paragraph) | |
46 (define-key wordstar-mode-map "\C-c" 'scroll-up) | |
47 (define-key wordstar-mode-map "\C-d" 'forward-char) | |
48 (define-key wordstar-mode-map "\C-e" 'previous-line) | |
49 (define-key wordstar-mode-map "\C-f" 'forward-word) | |
50 (define-key wordstar-mode-map "\C-g" 'delete-char) | |
51 (define-key wordstar-mode-map "\C-h" 'backward-char) | |
52 (define-key wordstar-mode-map "\C-i" 'indent-for-tab-command) | |
53 (define-key wordstar-mode-map "\C-j" 'help-for-help) | |
54 (define-key wordstar-mode-map "\C-k" wordstar-C-k-map) | |
55 (define-key wordstar-mode-map "\C-l" 'ws-repeat-search) | |
56 (define-key wordstar-mode-map "\C-n" 'open-line) | |
57 (define-key wordstar-mode-map "\C-o" wordstar-C-o-map) | |
58 (define-key wordstar-mode-map "\C-p" 'quoted-insert) | |
59 (define-key wordstar-mode-map "\C-q" wordstar-C-q-map) | |
60 (define-key wordstar-mode-map "\C-r" 'scroll-down) | |
61 (define-key wordstar-mode-map "\C-s" 'backward-char) | |
62 (define-key wordstar-mode-map "\C-t" 'kill-word) | |
63 (define-key wordstar-mode-map "\C-u" 'keyboard-quit) | |
64 (define-key wordstar-mode-map "\C-v" 'overwrite-mode) | |
65 (define-key wordstar-mode-map "\C-w" 'scroll-down-line) | |
66 (define-key wordstar-mode-map "\C-x" 'next-line) | |
67 (define-key wordstar-mode-map "\C-y" 'kill-complete-line) | |
68 (define-key wordstar-mode-map "\C-z" 'scroll-up-line) | |
69 | |
70 ;; wordstar-C-k-map | |
71 | |
72 (define-key wordstar-C-k-map " " ()) | |
73 (define-key wordstar-C-k-map "0" 'ws-set-marker-0) | |
74 (define-key wordstar-C-k-map "1" 'ws-set-marker-1) | |
75 (define-key wordstar-C-k-map "2" 'ws-set-marker-2) | |
76 (define-key wordstar-C-k-map "3" 'ws-set-marker-3) | |
77 (define-key wordstar-C-k-map "4" 'ws-set-marker-4) | |
78 (define-key wordstar-C-k-map "5" 'ws-set-marker-5) | |
79 (define-key wordstar-C-k-map "6" 'ws-set-marker-6) | |
80 (define-key wordstar-C-k-map "7" 'ws-set-marker-7) | |
81 (define-key wordstar-C-k-map "8" 'ws-set-marker-8) | |
82 (define-key wordstar-C-k-map "9" 'ws-set-marker-9) | |
83 (define-key wordstar-C-k-map "b" 'ws-begin-block) | |
84 (define-key wordstar-C-k-map "\C-b" 'ws-begin-block) | |
85 (define-key wordstar-C-k-map "c" 'ws-copy-block) | |
86 (define-key wordstar-C-k-map "\C-c" 'ws-copy-block) | |
87 (define-key wordstar-C-k-map "d" 'save-buffers-kill-emacs) | |
88 (define-key wordstar-C-k-map "\C-d" 'save-buffers-kill-emacs) | |
89 (define-key wordstar-C-k-map "f" 'find-file) | |
90 (define-key wordstar-C-k-map "\C-f" 'find-file) | |
91 (define-key wordstar-C-k-map "h" 'ws-show-markers) | |
92 (define-key wordstar-C-k-map "\C-h" 'ws-show-markers) | |
93 (define-key wordstar-C-k-map "i" 'ws-indent-block) | |
94 (define-key wordstar-C-k-map "\C-i" 'ws-indent-block) | |
95 (define-key wordstar-C-k-map "k" 'ws-end-block) | |
96 (define-key wordstar-C-k-map "\C-k" 'ws-end-block) | |
97 (define-key wordstar-C-k-map "p" 'ws-print-block) | |
98 (define-key wordstar-C-k-map "\C-p" 'ws-print-block) | |
99 (define-key wordstar-C-k-map "q" 'kill-emacs) | |
100 (define-key wordstar-C-k-map "\C-q" 'kill-emacs) | |
101 (define-key wordstar-C-k-map "r" 'insert-file) | |
102 (define-key wordstar-C-k-map "\C-r" 'insert-file) | |
103 (define-key wordstar-C-k-map "s" 'save-some-buffers) | |
104 (define-key wordstar-C-k-map "\C-s" 'save-some-buffers) | |
105 (define-key wordstar-C-k-map "t" 'ws-mark-word) | |
106 (define-key wordstar-C-k-map "\C-t" 'ws-mark-word) | |
107 (define-key wordstar-C-k-map "u" 'ws-exdent-block) | |
108 (define-key wordstar-C-k-map "\C-u" 'keyboard-quit) | |
109 (define-key wordstar-C-k-map "v" 'ws-move-block) | |
110 (define-key wordstar-C-k-map "\C-v" 'ws-move-block) | |
111 (define-key wordstar-C-k-map "w" 'ws-write-block) | |
112 (define-key wordstar-C-k-map "\C-w" 'ws-write-block) | |
113 (define-key wordstar-C-k-map "x" 'save-buffers-kill-emacs) | |
114 (define-key wordstar-C-k-map "\C-x" 'save-buffers-kill-emacs) | |
115 (define-key wordstar-C-k-map "y" 'ws-delete-block) | |
116 (define-key wordstar-C-k-map "\C-y" 'ws-delete-block) | |
117 | |
118 ;; wordstar-C-j-map not yet implemented | |
119 | |
120 ;; wordstar-C-o-map | |
121 | |
122 (define-key wordstar-C-o-map " " ()) | |
123 (define-key wordstar-C-o-map "c" 'center-line) | |
124 (define-key wordstar-C-o-map "\C-c" 'center-line) | |
125 (define-key wordstar-C-o-map "b" 'switch-to-buffer) | |
126 (define-key wordstar-C-o-map "\C-b" 'switch-to-buffer) | |
127 (define-key wordstar-C-o-map "j" 'justify-current-line) | |
128 (define-key wordstar-C-o-map "\C-j" 'justify-current-line) | |
129 (define-key wordstar-C-o-map "k" 'kill-buffer) | |
130 (define-key wordstar-C-o-map "\C-k" 'kill-buffer) | |
131 (define-key wordstar-C-o-map "l" 'list-buffers) | |
132 (define-key wordstar-C-o-map "\C-l" 'list-buffers) | |
133 (define-key wordstar-C-o-map "m" 'auto-fill-mode) | |
134 (define-key wordstar-C-o-map "\C-m" 'auto-fill-mode) | |
135 (define-key wordstar-C-o-map "r" 'set-fill-column) | |
136 (define-key wordstar-C-o-map "\C-r" 'set-fill-column) | |
137 (define-key wordstar-C-o-map "\C-u" 'keyboard-quit) | |
138 (define-key wordstar-C-o-map "wd" 'delete-other-windows) | |
139 (define-key wordstar-C-o-map "wh" 'split-window-horizontally) | |
140 (define-key wordstar-C-o-map "wo" 'other-window) | |
141 (define-key wordstar-C-o-map "wv" 'split-window-vertically) | |
142 | |
143 ;; wordstar-C-q-map | |
144 (define-key wordstar-C-q-map " " ()) | |
145 (define-key wordstar-C-q-map "0" 'ws-find-marker-0) | |
146 (define-key wordstar-C-q-map "1" 'ws-find-marker-1) | |
147 (define-key wordstar-C-q-map "2" 'ws-find-marker-2) | |
148 (define-key wordstar-C-q-map "3" 'ws-find-marker-3) | |
149 (define-key wordstar-C-q-map "4" 'ws-find-marker-4) | |
150 (define-key wordstar-C-q-map "5" 'ws-find-marker-5) | |
151 (define-key wordstar-C-q-map "6" 'ws-find-marker-6) | |
152 (define-key wordstar-C-q-map "7" 'ws-find-marker-7) | |
153 (define-key wordstar-C-q-map "8" 'ws-find-marker-8) | |
154 (define-key wordstar-C-q-map "9" 'ws-find-marker-9) | |
155 (define-key wordstar-C-q-map "a" 'ws-query-replace) | |
156 (define-key wordstar-C-q-map "\C-a" 'ws-query-replace) | |
157 (define-key wordstar-C-q-map "b" 'ws-goto-block-begin) | |
158 (define-key wordstar-C-q-map "\C-b" 'ws-goto-block-begin) | |
159 (define-key wordstar-C-q-map "c" 'end-of-buffer) | |
160 (define-key wordstar-C-q-map "\C-c" 'end-of-buffer) | |
161 (define-key wordstar-C-q-map "d" 'end-of-line) | |
162 (define-key wordstar-C-q-map "\C-d" 'end-of-line) | |
163 (define-key wordstar-C-q-map "f" 'ws-search) | |
164 (define-key wordstar-C-q-map "\C-f" 'ws-search) | |
165 (define-key wordstar-C-q-map "k" 'ws-goto-block-end) | |
166 (define-key wordstar-C-q-map "\C-k" 'ws-goto-block-end) | |
167 (define-key wordstar-C-q-map "l" 'ws-undo) | |
168 (define-key wordstar-C-q-map "\C-l" 'ws-undo) | |
169 (define-key wordstar-C-q-map "p" 'ws-last-cursorp) | |
170 (define-key wordstar-C-q-map "\C-p" 'ws-last-cursorp) | |
171 (define-key wordstar-C-q-map "r" 'beginning-of-buffer) | |
172 (define-key wordstar-C-q-map "\C-r" 'beginning-of-buffer) | |
173 (define-key wordstar-C-q-map "s" 'beginning-of-line) | |
174 (define-key wordstar-C-q-map "\C-s" 'beginning-of-line) | |
175 (define-key wordstar-C-q-map "\C-u" 'keyboard-quit) | |
176 (define-key wordstar-C-q-map "w" 'ws-last-error) | |
177 (define-key wordstar-C-q-map "\C-w" 'ws-last-error) | |
178 (define-key wordstar-C-q-map "y" 'ws-kill-eol) | |
179 (define-key wordstar-C-q-map "\C-y" 'ws-kill-eol) | |
180 (define-key wordstar-C-q-map "\177" 'ws-kill-bol)) | |
181 | |
4935
1f5c25761f2f
(wordstar-mode): Add autoload.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
182 ;;;###autoload |
1244
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
183 (defun wordstar-mode () |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
184 "Major mode with WordStar-like key bindings. |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
185 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
186 BUGS: |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
187 - Help menus with WordStar commands (C-j just calls help-for-help) |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
188 are not implemented |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
189 - Options for search and replace |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
190 - Show markers (C-k h) is somewhat strange |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
191 - Search and replace (C-q a) is only available in forward direction |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
192 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
193 No key bindings beginning with ESC are installed, they will work |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
194 Emacs-like. |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
195 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
196 The key bindings are: |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
197 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
198 C-a backward-word |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
199 C-b fill-paragraph |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
200 C-c scroll-up-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
201 C-d forward-char |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
202 C-e previous-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
203 C-f forward-word |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
204 C-g delete-char |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
205 C-h backward-char |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
206 C-i indent-for-tab-command |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
207 C-j help-for-help |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
208 C-k ordstar-C-k-map |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
209 C-l ws-repeat-search |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
210 C-n open-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
211 C-p quoted-insert |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
212 C-r scroll-down-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
213 C-s backward-char |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
214 C-t kill-word |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
215 C-u keyboard-quit |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
216 C-v overwrite-mode |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
217 C-w scroll-down |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
218 C-x next-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
219 C-y kill-complete-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
220 C-z scroll-up |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
221 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
222 C-k 0 ws-set-marker-0 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
223 C-k 1 ws-set-marker-1 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
224 C-k 2 ws-set-marker-2 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
225 C-k 3 ws-set-marker-3 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
226 C-k 4 ws-set-marker-4 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
227 C-k 5 ws-set-marker-5 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
228 C-k 6 ws-set-marker-6 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
229 C-k 7 ws-set-marker-7 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
230 C-k 8 ws-set-marker-8 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
231 C-k 9 ws-set-marker-9 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
232 C-k b ws-begin-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
233 C-k c ws-copy-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
234 C-k d save-buffers-kill-emacs |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
235 C-k f find-file |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
236 C-k h ws-show-markers |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
237 C-k i ws-indent-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
238 C-k k ws-end-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
239 C-k p ws-print-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
240 C-k q kill-emacs |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
241 C-k r insert-file |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
242 C-k s save-some-buffers |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
243 C-k t ws-mark-word |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
244 C-k u ws-exdent-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
245 C-k C-u keyboard-quit |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
246 C-k v ws-move-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
247 C-k w ws-write-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
248 C-k x kill-emacs |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
249 C-k y ws-delete-block |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
250 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
251 C-o c center-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
252 C-o b switch-to-buffer |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
253 C-o j justify-current-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
254 C-o k kill-buffer |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
255 C-o l list-buffers |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
256 C-o m auto-fill-mode |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
257 C-o r set-fill-column |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
258 C-o C-u keyboard-quit |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
259 C-o wd delete-other-windows |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
260 C-o wh split-window-horizontally |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
261 C-o wo other-window |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
262 C-o wv split-window-vertically |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
263 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
264 C-q 0 ws-find-marker-0 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
265 C-q 1 ws-find-marker-1 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
266 C-q 2 ws-find-marker-2 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
267 C-q 3 ws-find-marker-3 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
268 C-q 4 ws-find-marker-4 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
269 C-q 5 ws-find-marker-5 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
270 C-q 6 ws-find-marker-6 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
271 C-q 7 ws-find-marker-7 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
272 C-q 8 ws-find-marker-8 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
273 C-q 9 ws-find-marker-9 |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
274 C-q a ws-query-replace |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
275 C-q b ws-to-block-begin |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
276 C-q c end-of-buffer |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
277 C-q d end-of-line |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
278 C-q f ws-search |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
279 C-q k ws-to-block-end |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
280 C-q l ws-undo |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
281 C-q p ws-last-cursorp |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
282 C-q r beginning-of-buffer |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
283 C-q C-u keyboard-quit |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
284 C-q w ws-last-error |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
285 C-q y ws-kill-eol |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
286 C-q DEL ws-kill-bol |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
287 " |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
288 (interactive) |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
289 (kill-all-local-variables) |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
290 (use-local-map wordstar-mode-map) |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
291 (setq mode-name "WordStar") |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
292 (setq major-mode 'wordstar-mode)) |
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
293 |
309 | 294 |
295 (defun center-paragraph () | |
296 "Center each line in the paragraph at or after point. | |
297 See center-line for more info." | |
298 (interactive) | |
299 (save-excursion | |
300 (forward-paragraph) | |
301 (or (bolp) (newline 1)) | |
302 (let ((end (point))) | |
303 (backward-paragraph) | |
304 (center-region (point) end)))) | |
305 | |
306 (defun center-region (from to) | |
307 "Center each line starting in the region. | |
308 See center-line for more info." | |
309 (interactive "r") | |
310 (if (> from to) | |
311 (let ((tem to)) | |
312 (setq to from from tem))) | |
313 (save-excursion | |
314 (save-restriction | |
315 (narrow-to-region from to) | |
316 (goto-char from) | |
317 (while (not (eobp)) | |
318 (center-line) | |
319 (forward-line 1))))) | |
320 | |
321 (defun center-line () | |
322 "Center the line point is on, within the width specified by `fill-column'. | |
323 This means adjusting the indentation to match | |
324 the distance between the end of the text and `fill-column'." | |
325 (interactive) | |
326 (save-excursion | |
327 (let (line-length) | |
328 (beginning-of-line) | |
329 (delete-horizontal-space) | |
330 (end-of-line) | |
331 (delete-horizontal-space) | |
332 (setq line-length (current-column)) | |
333 (beginning-of-line) | |
334 (indent-to | |
335 (+ left-margin | |
336 (/ (- fill-column left-margin line-length) 2)))))) | |
337 | |
338 (defun scroll-down-line () | |
339 "Scroll one line down." | |
340 (interactive) | |
341 (scroll-down 1)) | |
342 | |
343 (defun scroll-up-line () | |
344 "Scroll one line up." | |
345 (interactive) | |
346 (scroll-up 1)) | |
347 | |
348 ;;;;;;;;;;; | |
349 ;; wordstar special variables: | |
350 | |
351 (defvar ws-marker-0 nil "Position marker 0 in WordStar mode.") | |
352 (defvar ws-marker-1 nil "Position marker 1 in WordStar mode.") | |
353 (defvar ws-marker-2 nil "Position marker 2 in WordStar mode.") | |
354 (defvar ws-marker-3 nil "Position marker 3 in WordStar mode.") | |
355 (defvar ws-marker-4 nil "Position marker 4 in WordStar mode.") | |
356 (defvar ws-marker-5 nil "Position marker 5 in WordStar mode.") | |
357 (defvar ws-marker-6 nil "Position marker 6 in WordStar mode.") | |
358 (defvar ws-marker-7 nil "Position marker 7 in WordStar mode.") | |
359 (defvar ws-marker-8 nil "Position marker 8 in WordStar mode.") | |
360 (defvar ws-marker-9 nil "Position marker 9 in WordStar mode.") | |
361 | |
362 (defvar ws-block-begin-marker nil "Beginning of \"Block\" in WordStar mode.") | |
363 (defvar ws-block-end-marker nil "End of \"Block\" in WordStar mode.") | |
364 | |
365 (defvar ws-search-string nil "String of last search in WordStar mode.") | |
366 (defvar ws-search-direction t | |
367 "Direction of last search in WordStar mode. T if forward, NIL if backward.") | |
368 | |
369 (defvar ws-last-cursorposition nil | |
370 "Position before last search etc. in WordStar mode.") | |
371 | |
372 (defvar ws-last-errormessage nil | |
373 "Last error message issued by a WordStar mode function.") | |
374 | |
375 ;;;;;;;;;;; | |
376 ;; wordstar special functions: | |
377 | |
378 (defun ws-error (string) | |
379 "Report error of a WordStar special function. Error message is saved | |
380 in ws-last-errormessage for recovery with C-q w." | |
381 (setq ws-last-errormessage string) | |
382 (error string)) | |
383 | |
384 (defun ws-set-marker-0 () | |
385 "In WordStar mode: Set marker 0 to current cursor position." | |
386 (interactive) | |
387 (setq ws-marker-0 (point-marker)) | |
388 (message "Marker 0 set")) | |
389 | |
390 (defun ws-set-marker-1 () | |
391 "In WordStar mode: Set marker 1 to current cursor position." | |
392 (interactive) | |
393 (setq ws-marker-1 (point-marker)) | |
394 (message "Marker 1 set")) | |
395 | |
396 (defun ws-set-marker-2 () | |
397 "In WordStar mode: Set marker 2 to current cursor position." | |
398 (interactive) | |
399 (setq ws-marker-2 (point-marker)) | |
400 (message "Marker 2 set")) | |
401 | |
402 (defun ws-set-marker-3 () | |
403 "In WordStar mode: Set marker 3 to current cursor position." | |
404 (interactive) | |
405 (setq ws-marker-3 (point-marker)) | |
406 (message "Marker 3 set")) | |
407 | |
408 (defun ws-set-marker-4 () | |
409 "In WordStar mode: Set marker 4 to current cursor position." | |
410 (interactive) | |
411 (setq ws-marker-4 (point-marker)) | |
412 (message "Marker 4 set")) | |
413 | |
414 (defun ws-set-marker-5 () | |
415 "In WordStar mode: Set marker 5 to current cursor position." | |
416 (interactive) | |
417 (setq ws-marker-5 (point-marker)) | |
418 (message "Marker 5 set")) | |
419 | |
420 (defun ws-set-marker-6 () | |
421 "In WordStar mode: Set marker 6 to current cursor position." | |
422 (interactive) | |
423 (setq ws-marker-6 (point-marker)) | |
424 (message "Marker 6 set")) | |
425 | |
426 (defun ws-set-marker-7 () | |
427 "In WordStar mode: Set marker 7 to current cursor position." | |
428 (interactive) | |
429 (setq ws-marker-7 (point-marker)) | |
430 (message "Marker 7 set")) | |
431 | |
432 (defun ws-set-marker-8 () | |
433 "In WordStar mode: Set marker 8 to current cursor position." | |
434 (interactive) | |
435 (setq ws-marker-8 (point-marker)) | |
436 (message "Marker 8 set")) | |
437 | |
438 (defun ws-set-marker-9 () | |
439 "In WordStar mode: Set marker 9 to current cursor position." | |
440 (interactive) | |
441 (setq ws-marker-9 (point-marker)) | |
442 (message "Marker 9 set")) | |
443 | |
444 (defun ws-begin-block () | |
445 "In WordStar mode: Set block begin marker to current cursor position." | |
446 (interactive) | |
447 (setq ws-block-begin-marker (point-marker)) | |
448 (message "Block begin marker set")) | |
449 | |
450 (defun ws-show-markers () | |
451 "In WordStar mode: Show block markers." | |
452 (interactive) | |
453 (if (or ws-block-begin-marker ws-block-end-marker) | |
454 (save-excursion | |
455 (if ws-block-begin-marker | |
456 (let () | |
457 (goto-char ws-block-begin-marker) | |
458 (message "Block begin marker") | |
459 (sit-for 2)) | |
460 (message "Block begin marker not set") | |
461 (sit-for 2)) | |
462 (if ws-block-end-marker | |
463 (let () | |
464 (goto-char ws-block-end-marker) | |
465 (message "Block end marker") | |
466 (sit-for 2)) | |
467 (message "Block end marker not set")) | |
468 (message "")) | |
469 (message "Block markers not set"))) | |
470 | |
471 | |
472 (defun ws-indent-block () | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
1244
diff
changeset
|
473 "In WordStar mode: Indent block (not yet implemented)." |
309 | 474 (interactive) |
475 (ws-error "Indent block not yet implemented")) | |
476 | |
477 (defun ws-end-block () | |
478 "In WordStar mode: Set block end marker to current cursor position." | |
479 (interactive) | |
480 (setq ws-block-end-marker (point-marker)) | |
481 (message "Block end marker set")) | |
482 | |
483 (defun ws-print-block () | |
484 "In WordStar mode: Print block." | |
485 (interactive) | |
486 (message "Don't do this. Write block to a file (C-k w) and print this file.")) | |
487 | |
488 (defun ws-mark-word () | |
489 "In WordStar mode: Mark current word as block." | |
490 (interactive) | |
491 (save-excursion | |
1244
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
492 (forward-word 1) |
309 | 493 (sit-for 1) |
494 (ws-end-block) | |
1244
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
495 (forward-word -1) |
309 | 496 (sit-for 1) |
497 (ws-begin-block))) | |
498 | |
499 (defun ws-exdent-block () | |
500 "I don't know what this (C-k u) should do." | |
501 (interactive) | |
502 (ws-error "This won't be done -- not yet implemented.")) | |
503 | |
504 (defun ws-move-block () | |
505 "In WordStar mode: Move block to current cursor position." | |
506 (interactive) | |
507 (if (and ws-block-begin-marker ws-block-end-marker) | |
508 (let () | |
1244
ee01548e8ba5
(ws-mark-word): Use forward-word, with an arg, instead of backward-word.
Richard M. Stallman <rms@gnu.org>
parents:
1222
diff
changeset
|
509 (kill-region ws-block-begin-marker ws-block-end-marker) |
309 | 510 (yank) |
511 (save-excursion | |
512 (goto-char (region-beginning)) | |
513 (setq ws-block-begin-marker (point-marker)) | |
514 (goto-char (region-end)) | |
515 (setq ws-block-end-marker (point-marker)))) | |
516 (ws-error (cond (ws-block-begin-marker "Block end marker not set") | |
517 (ws-block-end-marker "Block begin marker not set") | |
518 (t "Block markers not set"))))) | |
519 | |
520 (defun ws-write-block () | |
521 "In WordStar mode: Write block to file." | |
522 (interactive) | |
523 (if (and ws-block-begin-marker ws-block-end-marker) | |
524 (let ((filename (read-file-name "Write block to file: "))) | |
525 (write-region ws-block-begin-marker ws-block-end-marker filename)) | |
526 (ws-error (cond (ws-block-begin-marker "Block end marker not set") | |
527 (ws-block-end-marker "Block begin marker not set") | |
528 (t "Block markers not set"))))) | |
529 | |
530 | |
531 (defun ws-delete-block () | |
532 "In WordStar mode: Delete block." | |
533 (interactive) | |
534 (if (and ws-block-begin-marker ws-block-end-marker) | |
535 (let () | |
536 (kill-region ws-block-begin-marker ws-block-end-marker) | |
537 (setq ws-block-end-marker nil) | |
538 (setq ws-block-begin-marker nil)) | |
539 (ws-error (cond (ws-block-begin-marker "Block end marker not set") | |
540 (ws-block-end-marker "Block begin marker not set") | |
541 (t "Block markers not set"))))) | |
542 | |
543 (defun ws-find-marker-0 () | |
544 "In WordStar mode: Go to marker 0." | |
545 (interactive) | |
546 (if ws-marker-0 | |
547 (let () | |
548 (setq ws-last-cursorposition (point-marker)) | |
549 (goto-char ws-marker-0)) | |
550 (ws-error "Marker 0 not set"))) | |
551 | |
552 (defun ws-find-marker-1 () | |
553 "In WordStar mode: Go to marker 1." | |
554 (interactive) | |
555 (if ws-marker-1 | |
556 (let () | |
557 (setq ws-last-cursorposition (point-marker)) | |
558 (goto-char ws-marker-1)) | |
559 (ws-error "Marker 1 not set"))) | |
560 | |
561 (defun ws-find-marker-2 () | |
562 "In WordStar mode: Go to marker 2." | |
563 (interactive) | |
564 (if ws-marker-2 | |
565 (let () | |
566 (setq ws-last-cursorposition (point-marker)) | |
567 (goto-char ws-marker-2)) | |
568 (ws-error "Marker 2 not set"))) | |
569 | |
570 (defun ws-find-marker-3 () | |
571 "In WordStar mode: Go to marker 3." | |
572 (interactive) | |
573 (if ws-marker-3 | |
574 (let () | |
575 (setq ws-last-cursorposition (point-marker)) | |
576 (goto-char ws-marker-3)) | |
577 (ws-error "Marker 3 not set"))) | |
578 | |
579 (defun ws-find-marker-4 () | |
580 "In WordStar mode: Go to marker 4." | |
581 (interactive) | |
582 (if ws-marker-4 | |
583 (let () | |
584 (setq ws-last-cursorposition (point-marker)) | |
585 (goto-char ws-marker-4)) | |
586 (ws-error "Marker 4 not set"))) | |
587 | |
588 (defun ws-find-marker-5 () | |
589 "In WordStar mode: Go to marker 5." | |
590 (interactive) | |
591 (if ws-marker-5 | |
592 (let () | |
593 (setq ws-last-cursorposition (point-marker)) | |
594 (goto-char ws-marker-5)) | |
595 (ws-error "Marker 5 not set"))) | |
596 | |
597 (defun ws-find-marker-6 () | |
598 "In WordStar mode: Go to marker 6." | |
599 (interactive) | |
600 (if ws-marker-6 | |
601 (let () | |
602 (setq ws-last-cursorposition (point-marker)) | |
603 (goto-char ws-marker-6)) | |
604 (ws-error "Marker 6 not set"))) | |
605 | |
606 (defun ws-find-marker-7 () | |
607 "In WordStar mode: Go to marker 7." | |
608 (interactive) | |
609 (if ws-marker-7 | |
610 (let () | |
611 (setq ws-last-cursorposition (point-marker)) | |
612 (goto-char ws-marker-7)) | |
613 (ws-error "Marker 7 not set"))) | |
614 | |
615 (defun ws-find-marker-8 () | |
616 "In WordStar mode: Go to marker 8." | |
617 (interactive) | |
618 (if ws-marker-8 | |
619 (let () | |
620 (setq ws-last-cursorposition (point-marker)) | |
621 (goto-char ws-marker-8)) | |
622 (ws-error "Marker 8 not set"))) | |
623 | |
624 (defun ws-find-marker-9 () | |
625 "In WordStar mode: Go to marker 9." | |
626 (interactive) | |
627 (if ws-marker-9 | |
628 (let () | |
629 (setq ws-last-cursorposition (point-marker)) | |
630 (goto-char ws-marker-9)) | |
631 (ws-error "Marker 9 not set"))) | |
632 | |
633 (defun ws-goto-block-begin () | |
634 "In WordStar mode: Go to block begin marker." | |
635 (interactive) | |
636 (if ws-block-begin-marker | |
637 (let () | |
638 (setq ws-last-cursorposition (point-marker)) | |
639 (goto-char ws-block-begin-marker)) | |
640 (ws-error "Block begin marker not set"))) | |
641 | |
642 (defun ws-search (string) | |
643 "In WordStar mode: Search string, remember string for repetition." | |
644 (interactive "sSearch for: ") | |
645 (message "Forward (f) or backward (b)") | |
646 (let ((direction | |
647 (read-char))) | |
648 (cond ((equal (upcase direction) \070) | |
649 (setq ws-search-string string) | |
650 (setq ws-search-direction t) | |
651 (setq ws-last-cursorposition (point-marker)) | |
652 (search-forward string)) | |
653 ((equal (upcase direction) \066) | |
654 (setq ws-search-string string) | |
655 (setq ws-search-direction nil) | |
656 (setq ws-last-cursorposition (point-marker)) | |
657 (search-backward string)) | |
658 (t (keyboard-quit))))) | |
659 | |
660 (defun ws-goto-block-end () | |
661 "In WordStar mode: Go to block end marker." | |
662 (interactive) | |
663 (if ws-block-end-marker | |
664 (let () | |
665 (setq ws-last-cursorposition (point-marker)) | |
666 (goto-char ws-block-end-marker)) | |
667 (ws-error "Block end marker not set"))) | |
668 | |
669 (defun ws-undo () | |
670 "In WordStar mode: Undo and give message about undoing more changes." | |
671 (interactive) | |
672 (undo) | |
673 (message "Repeat C-q l to undo more changes.")) | |
674 | |
675 (defun ws-goto-last-cursorposition () | |
676 "In WordStar mode: " | |
677 (interactive) | |
678 (if ws-last-cursorposition | |
679 (let () | |
680 (setq ws-last-cursorposition (point-marker)) | |
681 (goto-char ws-last-cursorposition)) | |
682 (ws-error "No last cursor position available."))) | |
683 | |
684 (defun ws-last-error () | |
685 "In WordStar mode: repeat last error message. | |
686 This will only work for errors raised by WordStar mode functions." | |
687 (interactive) | |
688 (if ws-last-errormessage | |
689 (message ws-last-errormessage) | |
690 (message "No WordStar error yet."))) | |
691 | |
692 (defun ws-kill-eol () | |
693 "In WordStar mode: Kill to end of line (like WordStar, not like Emacs)." | |
694 (interactive) | |
695 (let ((p (point))) | |
696 (end-of-line) | |
697 (kill-region p (point)))) | |
698 | |
699 (defun ws-kill-bol () | |
700 "In WordStar mode: Kill to beginning of line | |
701 (like WordStar, not like Emacs)." | |
702 (interactive) | |
703 (let ((p (point))) | |
704 (beginning-of-line) | |
705 (kill-region (point) p))) | |
706 | |
707 (defun kill-complete-line () | |
708 "Kill the complete line." | |
709 (interactive) | |
710 (beginning-of-line) | |
711 (if (eobp) (error "End of buffer")) | |
712 (let ((beg (point))) | |
713 (forward-line 1) | |
714 (kill-region beg (point)))) | |
715 | |
716 (defun ws-repeat-search () | |
717 "In WordStar mode: Repeat last search." | |
718 (interactive) | |
719 (setq ws-last-cursorposition (point-marker)) | |
720 (if ws-search-string | |
721 (if ws-search-direction | |
722 (search-forward ws-search-string) | |
723 (search-backward ws-search-string)) | |
724 (ws-error "No search to repeat"))) | |
725 | |
726 (defun ws-query-replace (from to) | |
727 "In WordStar mode: Search string, remember string for repetition." | |
728 (interactive "sReplace: | |
729 sWith: " ) | |
730 (setq ws-search-string from) | |
731 (setq ws-search-direction t) | |
732 (setq ws-last-cursorposition (point-marker)) | |
733 (query-replace from to)) | |
734 | |
735 (defun ws-copy-block () | |
736 "In WordStar mode: Copy block to current cursor position." | |
737 (interactive) | |
738 (if (and ws-block-begin-marker ws-block-end-marker) | |
739 (let () | |
740 (copy-region-as-kill ws-block-begin-marker ws-block-end-marker) | |
741 (yank) | |
742 (save-excursion | |
743 (goto-char (region-beginning)) | |
744 (setq ws-block-begin-marker (point-marker)) | |
745 (goto-char (region-end)) | |
746 (setq ws-block-end-marker (point-marker)))) | |
747 (ws-error (cond (ws-block-begin-marker "Block end marker not set") | |
748 (ws-block-end-marker "Block begin marker not set") | |
749 (t "Block markers not set"))))) | |
656
d74e65773062
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
309
diff
changeset
|
750 |
d74e65773062
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
309
diff
changeset
|
751 ;;; ws-mode.el ends here |