Mercurial > hg > xemacs-beta
comparison lisp/emulators/crisp.el @ 215:1f0dabaa0855 r20-4b6
Import from CVS: tag r20-4b6
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:07:35 +0200 |
parents | 78478c60bfcd |
children |
comparison
equal
deleted
inserted
replaced
214:c5d88c05e1e9 | 215:1f0dabaa0855 |
---|---|
1 ;; @(#) crisp.el -- CRiSP/Brief Emacs emulator | 1 ;; @(#) crisp.el -- CRiSP/Brief Emacs emulator |
2 | 2 |
3 ;; Author: Gary D. Foster <Gary.Foster@corp.sun.com> | 3 ;; Author: Gary D. Foster <Gary.Foster@corp.sun.com> |
4 ;; Created: 01 Mar 1996 | 4 ;; Created: 01 Mar 1996 |
5 ;; Version: $Revision: 1.7 $ | 5 ;; Version: 1.26 |
6 ;; Keywords: emulations brief crisp | 6 ;; Keywords: emulations brief crisp |
7 ;; X-Modified-by: | 7 ;; X-Modified-by: |
8 ;; $Log: crisp.el,v $ | 8 ;; crisp.el,v |
9 ;; Revision 1.7 1997/11/12 07:09:59 steve | 9 ;; Revision 1.26 1997/11/18 05:41:02 gfoster |
10 ;; Patches to beta4 | 10 ;; Added several new keybindings: |
11 ;; | 11 ;; C-home top of window |
12 ;; C-end bottom of window | |
13 ;; M-home beginning of line | |
14 ;; M-end end-of-line | |
15 ;; C-F format region | |
16 ;; M-l mark line | |
17 ;; M-m set mark | |
18 ;; Added crisp-version function | |
19 ;; | |
20 ;; Revision 1.25 1997/11/18 04:19:09 gfoster | |
21 ;; Shortened the version numbering, removed the release-version tracking | |
22 ;; | |
23 ;; Revision 1.24 1997/11/18 04:15:54 gfoster | |
24 ;; Added `crisp-submit-bug-report' (shamelessly cribbed from Barry's | |
25 ;; cc-mode. Thanks Barry!) | |
26 ;; | |
27 ;; Bound the above to C-c b | |
28 ;; | |
29 ;; Changed the behavior of `crisp-(kill|copy)-line' so (kill|copy)ing | |
30 ;; works on the region from point to eol instead of the entire line, when | |
31 ;; a region is not highlighted. | |
32 ;; | |
12 ;; Revision 1.23 1997/11/11 19:47:02 gfoster | 33 ;; Revision 1.23 1997/11/11 19:47:02 gfoster |
13 ;; Merged changes suggested by Hrvoje Niksic | 34 ;; Merged changes suggested by Hrvoje Niksic |
14 ;; make crisp-mode-map a sparse keymap parented from current-global-map | 35 ;; make crisp-mode-map a sparse keymap parented from current-global-map |
15 ;; don't copy the keymap in (crisp-mode-original-keymap) | 36 ;; don't copy the keymap in (crisp-mode-original-keymap) |
16 ;; declare last-last-command to shut up the byte-compiler | 37 ;; declare last-last-command to shut up the byte-compiler |
129 does not load the scroll-lock package.") | 150 does not load the scroll-lock package.") |
130 | 151 |
131 (defvar crisp-load-hook nil | 152 (defvar crisp-load-hook nil |
132 "Hooks to run after loading the CRiSP emulator package.") | 153 "Hooks to run after loading the CRiSP emulator package.") |
133 | 154 |
134 (defconst crisp-version "crisp.el release 1.1/$Revision: 1.7 $" | 155 (defconst crisp-version "1.26" |
135 "The release number and RCS version for the CRiSP emulator.") | 156 "The version of the CRiSP emulator.") |
157 | |
158 (defconst crisp-mode-help-address "gfoster@suzieq.ragesoft.com, Gary.Foster@corp.Sun.COM" | |
159 "The email address of the CRiSP mode author/maintainer.") | |
136 | 160 |
137 ;; Silence the byte-compiler. | 161 ;; Silence the byte-compiler. |
138 (defvar last-last-command) | 162 (defvar last-last-command) |
139 | 163 |
140 ;; and now the keymap defines | 164 ;; and now the keymap defines |
151 (define-key crisp-mode-map [(f4)] 'delete-window) | 175 (define-key crisp-mode-map [(f4)] 'delete-window) |
152 (define-key crisp-mode-map [(control f4)] 'delete-other-windows) | 176 (define-key crisp-mode-map [(control f4)] 'delete-other-windows) |
153 | 177 |
154 (define-key crisp-mode-map [(f5)] 'search-forward-regexp) | 178 (define-key crisp-mode-map [(f5)] 'search-forward-regexp) |
155 (define-key crisp-mode-map [(f19)] 'search-forward-regexp) | 179 (define-key crisp-mode-map [(f19)] 'search-forward-regexp) |
156 (define-key crisp-mode-map [(meta f5)] 'search-backward-regexp) | 180 (define-key crisp-mode-map [(meta f5)] 'search-backward-regexp) |
157 | 181 |
158 (define-key crisp-mode-map [(f6)] 'query-replace) | 182 (define-key crisp-mode-map [(f6)] 'query-replace) |
159 | 183 |
160 (define-key crisp-mode-map [(f7)] 'start-kbd-macro) | 184 (define-key crisp-mode-map [(f7)] 'start-kbd-macro) |
161 (define-key crisp-mode-map [(meta f7)] 'end-kbd-macro) | 185 (define-key crisp-mode-map [(meta f7)] 'end-kbd-macro) |
162 | 186 |
163 (define-key crisp-mode-map [(f8)] 'call-last-kbd-macro) | 187 (define-key crisp-mode-map [(f8)] 'call-last-kbd-macro) |
164 (define-key crisp-mode-map [(meta f8)] 'save-kbd-macro) | 188 (define-key crisp-mode-map [(meta f8)] 'save-kbd-macro) |
165 | 189 |
166 (define-key crisp-mode-map [(f9)] 'find-file) | 190 (define-key crisp-mode-map [(f9)] 'find-file) |
167 (define-key crisp-mode-map [(meta f9)] 'load-library) | 191 (define-key crisp-mode-map [(meta f9)] 'load-library) |
168 | 192 |
169 (define-key crisp-mode-map [(f10)] 'execute-extended-command) | 193 (define-key crisp-mode-map [(f10)] 'execute-extended-command) |
170 (define-key crisp-mode-map [(meta f10)] 'compile) | 194 (define-key crisp-mode-map [(meta f10)] 'compile) |
171 | 195 |
172 (define-key crisp-mode-map [(SunF37)] 'kill-buffer) | 196 (define-key crisp-mode-map [(SunF37)] 'kill-buffer) |
173 (define-key crisp-mode-map [(kp-add)] 'crisp-copy-line) | 197 (define-key crisp-mode-map [(kp-add)] 'crisp-copy-line) |
174 (define-key crisp-mode-map [(kp-subtract)] 'crisp-kill-line) | 198 (define-key crisp-mode-map [(kp-subtract)] 'crisp-kill-line) |
175 (define-key crisp-mode-map [(insert)] 'x-yank-clipboard-selection) | 199 (define-key crisp-mode-map [(insert)] 'x-yank-clipboard-selection) |
176 (define-key crisp-mode-map [(f16)] 'x-copy-primary-selection) ; copy on Sun5 kbd | 200 (define-key crisp-mode-map [(f16)] 'x-copy-primary-selection) ; copy on Sun5 kbd |
177 (define-key crisp-mode-map [(f20)] 'x-kill-primary-selection) ; cut on Sun5 kbd | 201 (define-key crisp-mode-map [(f20)] 'x-kill-primary-selection) ; cut on Sun5 kbd |
178 (define-key crisp-mode-map [(f18)] 'x-yank-clipboard-selection) ; paste on Sun5 kbd | 202 (define-key crisp-mode-map [(f18)] 'x-yank-clipboard-selection) ; paste on Sun5 kbd |
179 | 203 |
180 (define-key crisp-mode-map [(meta d)] (lambda () (interactive) (beginning-of-line) (kill-line))) | 204 (define-key crisp-mode-map [(control f)] 'fill-paragraph-or-region) |
205 (define-key crisp-mode-map [(meta d)] (lambda () | |
206 (interactive) | |
207 (beginning-of-line) (kill-line))) | |
181 (define-key crisp-mode-map [(meta e)] 'find-file) | 208 (define-key crisp-mode-map [(meta e)] 'find-file) |
182 (define-key crisp-mode-map [(meta g)] 'goto-line) | 209 (define-key crisp-mode-map [(meta g)] 'goto-line) |
183 (define-key crisp-mode-map [(meta h)] 'help) | 210 (define-key crisp-mode-map [(meta h)] 'help) |
184 (define-key crisp-mode-map [(meta i)] 'overwrite-mode) | 211 (define-key crisp-mode-map [(meta i)] 'overwrite-mode) |
185 (define-key crisp-mode-map [(meta j)] 'bookmark-jump) | 212 (define-key crisp-mode-map [(meta j)] 'bookmark-jump) |
213 (define-key crisp-mode-map [(meta l)] 'crisp-mark-line) | |
214 (define-key crisp-mode-map [(meta m)] 'set-mark-command) | |
186 (define-key crisp-mode-map [(meta n)] 'bury-buffer) | 215 (define-key crisp-mode-map [(meta n)] 'bury-buffer) |
187 (define-key crisp-mode-map [(meta p)] 'crisp-unbury-buffer) | 216 (define-key crisp-mode-map [(meta p)] 'crisp-unbury-buffer) |
188 (define-key crisp-mode-map [(meta u)] 'advertised-undo) | 217 (define-key crisp-mode-map [(meta u)] 'advertised-undo) |
189 (define-key crisp-mode-map [(f14)] 'advertised-undo) | 218 (define-key crisp-mode-map [(f14)] 'advertised-undo) |
190 (define-key crisp-mode-map [(meta w)] 'save-buffer) | 219 (define-key crisp-mode-map [(meta w)] 'save-buffer) |
191 (define-key crisp-mode-map [(meta x)] 'crisp-meta-x-wrapper) | 220 (define-key crisp-mode-map [(meta x)] 'crisp-meta-x-wrapper) |
192 (define-key crisp-mode-map [(meta ?0)] (lambda () (interactive) (bookmark-set "0"))) | 221 (define-key crisp-mode-map [(meta ?0)] (lambda () |
193 (define-key crisp-mode-map [(meta ?1)] (lambda () (interactive) (bookmark-set "1"))) | 222 (interactive) |
194 (define-key crisp-mode-map [(meta ?2)] (lambda () (interactive) (bookmark-set "2"))) | 223 (bookmark-set "0"))) |
195 (define-key crisp-mode-map [(meta ?3)] (lambda () (interactive) (bookmark-set "3"))) | 224 (define-key crisp-mode-map [(meta ?1)] (lambda () |
196 (define-key crisp-mode-map [(meta ?4)] (lambda () (interactive) (bookmark-set "4"))) | 225 (interactive) |
197 (define-key crisp-mode-map [(meta ?5)] (lambda () (interactive) (bookmark-set "5"))) | 226 (bookmark-set "1"))) |
198 (define-key crisp-mode-map [(meta ?6)] (lambda () (interactive) (bookmark-set "6"))) | 227 (define-key crisp-mode-map [(meta ?2)] (lambda () |
199 (define-key crisp-mode-map [(meta ?7)] (lambda () (interactive) (bookmark-set "7"))) | 228 (interactive) |
200 (define-key crisp-mode-map [(meta ?8)] (lambda () (interactive) (bookmark-set "8"))) | 229 (bookmark-set "2"))) |
201 (define-key crisp-mode-map [(meta ?9)] (lambda () (interactive) (bookmark-set "9"))) | 230 (define-key crisp-mode-map [(meta ?3)] (lambda () |
202 | 231 (interactive) |
203 (define-key crisp-mode-map [(shift right)] 'fkey-forward-word) | 232 (bookmark-set "3"))) |
204 (define-key crisp-mode-map [(shift left)] 'fkey-backward-word) | 233 (define-key crisp-mode-map [(meta ?4)] (lambda () |
205 (define-key crisp-mode-map [(shift delete)] 'kill-word) | 234 (interactive) |
235 (bookmark-set "4"))) | |
236 (define-key crisp-mode-map [(meta ?5)] (lambda () | |
237 (interactive) | |
238 (bookmark-set "5"))) | |
239 (define-key crisp-mode-map [(meta ?6)] (lambda () | |
240 (interactive) | |
241 (bookmark-set "6"))) | |
242 (define-key crisp-mode-map [(meta ?7)] (lambda () | |
243 (interactive) | |
244 (bookmark-set "7"))) | |
245 (define-key crisp-mode-map [(meta ?8)] (lambda () | |
246 (interactive) | |
247 (bookmark-set "8"))) | |
248 (define-key crisp-mode-map [(meta ?9)] (lambda () | |
249 (interactive) | |
250 (bookmark-set "9"))) | |
251 | |
252 (define-key crisp-mode-map [(shift right)] 'fkey-forward-word) | |
253 (define-key crisp-mode-map [(shift left)] 'fkey-backward-word) | |
254 (define-key crisp-mode-map [(shift delete)] 'kill-word) | |
206 (define-key crisp-mode-map [(shift backspace)] 'backward-kill-word) | 255 (define-key crisp-mode-map [(shift backspace)] 'backward-kill-word) |
207 (define-key crisp-mode-map [(control left)] 'backward-word) | 256 (define-key crisp-mode-map [(control left)] 'backward-word) |
208 (define-key crisp-mode-map [(control right)] 'forward-word) | 257 (define-key crisp-mode-map [(control right)] 'forward-word) |
209 | 258 |
210 (define-key crisp-mode-map [(home)] 'crisp-home) | 259 (define-key crisp-mode-map [(home)] 'crisp-home) |
211 (define-key crisp-mode-map [(end)] 'crisp-end) | 260 (define-key crisp-mode-map [(control home)] (lambda () |
261 (interactive) | |
262 (move-to-window-line 0))) | |
263 (define-key crisp-mode-map [(meta home)] 'beginning-of-line) | |
264 (define-key crisp-mode-map [(end)] 'crisp-end) | |
265 (define-key crisp-mode-map [(control end)] (lambda () | |
266 (interactive) | |
267 (move-to-window-line -1))) | |
268 (define-key crisp-mode-map [(meta end)] 'end-of-line) | |
269 | |
270 (define-key crisp-mode-map [(control c) (b)] 'crisp-submit-bug-report) | |
271 | |
272 (defun crisp-version (&optional arg) | |
273 "Version number of the CRiSP emulator package. | |
274 If ARG, insert results at point." | |
275 (interactive "P") | |
276 (let ((foo (concat "CRiSP version " crisp-version))) | |
277 (if arg | |
278 (insert (message foo)) | |
279 (message foo)))) | |
212 | 280 |
213 (defun crisp-mark-line (arg) | 281 (defun crisp-mark-line (arg) |
214 "Put mark at the end of line. Arg works as in `end-of-line'." | 282 "Put mark at the end of line. Arg works as in `end-of-line'." |
215 (interactive "p") | 283 (interactive "p") |
216 (mark-something 'crisp-mark-line 'end-of-line arg)) | 284 (mark-something 'crisp-mark-line 'end-of-line arg)) |
217 | 285 |
218 (defun crisp-kill-line (arg) | 286 (defun crisp-kill-line (arg) |
219 "Mark and kill line(s). | 287 "Mark and kill line(s). |
220 Marks the entire current line (honoring prefix arguments), copies the | 288 Marks from point to end of the current line (honoring prefix arguments), |
221 region to the kill ring and clipboard, and then deletes it." | 289 copies the region to the kill ring and clipboard, and then deletes it." |
222 (interactive "*p") | 290 (interactive "*p") |
223 (if zmacs-region-active-p | 291 (if zmacs-region-active-p |
224 (x-kill-primary-selection) | 292 (x-kill-primary-selection) |
225 (beginning-of-line) | |
226 (crisp-mark-line arg) | 293 (crisp-mark-line arg) |
227 (x-kill-primary-selection))) | 294 (x-kill-primary-selection))) |
228 | 295 |
229 (defun crisp-copy-line (arg) | 296 (defun crisp-copy-line (arg) |
230 "Mark and copy entire current line (honoring prefix arguments), copies the | 297 "Mark and copy line(s). |
231 region to the kill ring and clipboard, and then deactivates the region." | 298 Marks from point to end of the current line (honoring prefix arguments), |
299 copies the region to the kill ring and clipboard, and then deactivates | |
300 the region." | |
232 (interactive "*p") | 301 (interactive "*p") |
233 (let ((curpos (point))) | 302 (let ((curpos (point))) |
234 (if zmacs-region-active-p | 303 (if zmacs-region-active-p |
235 (x-copy-primary-selection) | 304 (x-copy-primary-selection) |
236 (beginning-of-line) | |
237 (crisp-mark-line arg) | 305 (crisp-mark-line arg) |
238 (x-copy-primary-selection) | 306 (x-copy-primary-selection) |
239 (goto-char curpos)))) | 307 (goto-char curpos)))) |
240 | 308 |
241 (defun crisp-home () | 309 (defun crisp-home () |
281 `execute-extended-command' (the normal Emacs binding)." | 349 `execute-extended-command' (the normal Emacs binding)." |
282 (interactive) | 350 (interactive) |
283 (if crisp-override-meta-x | 351 (if crisp-override-meta-x |
284 (save-buffers-kill-emacs) | 352 (save-buffers-kill-emacs) |
285 (call-interactively 'execute-extended-command))) | 353 (call-interactively 'execute-extended-command))) |
354 | |
355 ;; bug reporter | |
356 | |
357 (defun crisp-submit-bug-report () | |
358 "Submit via mail a bug report on CC Mode." | |
359 (interactive) | |
360 (require 'cc-vars) | |
361 ;; load in reporter | |
362 (let ((reporter-prompt-for-summary-p t) | |
363 (reporter-dont-compact-list '(c-offsets-alist)) | |
364 (style c-indentation-style) | |
365 (hook c-special-indent-hook) | |
366 (c-features c-emacs-features)) | |
367 (and | |
368 (if (y-or-n-p "Do you want to submit a report on CRiSP Mode? ") | |
369 t (message "") nil) | |
370 (require 'reporter) | |
371 (reporter-submit-bug-report | |
372 crisp-mode-help-address | |
373 (concat "CRiSP Mode [" crisp-version "]") | |
374 nil | |
375 nil | |
376 nil | |
377 "Dear Gary," | |
378 )))) | |
286 | 379 |
287 ;; Now enable the mode | 380 ;; Now enable the mode |
288 | 381 |
289 (defun crisp-mode (&optional arg) | 382 (defun crisp-mode (&optional arg) |
290 "Toggle CRiSP emulation minor mode. | 383 "Toggle CRiSP emulation minor mode. |