annotate lisp/emulation/ws-mode.el @ 109405:6730a174eb2b

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