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