aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-04-10 20:43:54 +0000
committerRichard M. Stallman1997-04-10 20:43:54 +0000
commit5e33ba39fe60ea21cdca114fb6b10865814128ba (patch)
treec71d829e657aac658b0d2af2f2d32cab9d057c7f
parent488f0c646666a3ed9fe2524d53bc9360e2a97695 (diff)
downloademacs-5e33ba39fe60ea21cdca114fb6b10865814128ba.tar.gz
emacs-5e33ba39fe60ea21cdca114fb6b10865814128ba.zip
Initial revision
-rw-r--r--lisp/emulation/crisp.el189
1 files changed, 189 insertions, 0 deletions
diff --git a/lisp/emulation/crisp.el b/lisp/emulation/crisp.el
new file mode 100644
index 00000000000..93afde2b3ca
--- /dev/null
+++ b/lisp/emulation/crisp.el
@@ -0,0 +1,189 @@
1;; crisp.el -- Emulator for CRiSP/Brief key bindings
2
3;; Author: Gary D. Foster <Gary.Foster@corp.sun.com>
4;; Keywords: emulations brief crisp
5
6;; This file is part of GNU Emacs.
7
8;; GNU Emacs is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation; either version 2, or (at your option)
11;; any later version.
12
13;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with GNU Emacs; see the file COPYING. If not, write to the
20;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21;; Boston, MA 02111-1307, USA.
22
23;;; Commentary:
24
25;; This file provides keybindings and minor functions to duplicate the
26;; functionality and finger-feel of the CRiSP/Brief editor. This
27;; package is designed to facilitate transitioning from Brief to Emacs
28;; with a minimum amount of hassles.
29
30;; Enable this package by putting the following in your .emacs
31;; (require 'crisp)
32
33;; This package will automatically default to loading the scroll-lock.el
34;; package unless you put (setq crisp-load-scroll-lock nil) in your
35;; .emacs. If this feature is enabled, it will bind meta-f1 to the
36;; scroll-lock mode toggle.
37
38;; Also, the default keybindings for brief override the Meta-x key to
39;; exit the editor. If you don't like this functionality, you can
40;; prevent this key from being rebound with
41;; (setq crisp-override-meta-x nil) in your .emacs.
42
43;; All these overrides should go *before* the (require 'crisp) statement.
44
45;; local variables
46
47(defvar crisp-mode-map (copy-keymap (current-global-map))
48 "Keymap for CRiSP emulation.
49All the emulation bindings are done here instead of globally.")
50
51(defvar crisp-override-meta-x t
52 "Controls overriding the normal Emacs M-x key binding in the CRiSP emulator.
53Normally the CRiSP emulator rebinds M-x to save-buffers-exit-emacs
54and provides the usual M-x functionality on the F10 key.
55
56If this variable is nil when you start the CRiSP emulator, it
57does not alter the binding of M-x.")
58
59(defvar crisp-load-scroll-lock t
60 "Controls loading of Scroll Lock in the CRiSP emulator.
61Its default behavior is to load and enable the Scroll Lock minor mode
62package when enabling the CRiSP emulator.
63
64If this variable is nil when you start the CRiSP emulator, it
65does not load Scroll Lock.")
66
67(defvar crisp-load-hook nil
68 "Hooks to run after loading the CRiSP emulator package.")
69
70;; and now the keymap defines
71
72(define-key crisp-mode-map [(f1)] 'other-window)
73
74(define-key crisp-mode-map [(f2) (down)] 'enlarge-window)
75(define-key crisp-mode-map [(f2) (left)] 'shrink-window-horizontally)
76(define-key crisp-mode-map [(f2) (right)] 'enlarge-window-horizontally)
77(define-key crisp-mode-map [(f2) (up)] 'shrink-window)
78(define-key crisp-mode-map [(f3) (down)] 'split-window-vertically)
79(define-key crisp-mode-map [(f3) (right)] 'split-window-horizontally)
80
81(define-key crisp-mode-map [(f4)] 'delete-window)
82(define-key crisp-mode-map [(control f4)] 'delete-other-windows)
83
84(define-key crisp-mode-map [(f5)] 'search-forward-regexp)
85(define-key crisp-mode-map [(f19)] 'search-forward-regexp)
86(define-key crisp-mode-map [(meta f5)] 'search-backward-regexp)
87
88(define-key crisp-mode-map [(f6)] 'query-replace)
89
90(define-key crisp-mode-map [(f7)] 'start-kbd-macro)
91(define-key crisp-mode-map [(meta f7)] 'end-kbd-macro)
92
93(define-key crisp-mode-map [(f8)] 'call-last-kbd-macro)
94(define-key crisp-mode-map [(meta f8)] 'save-kbd-macro)
95
96(define-key crisp-mode-map [(f9)] 'find-file)
97(define-key crisp-mode-map [(meta f9)] 'load-library)
98
99(define-key crisp-mode-map [(f10)] 'execute-extended-command)
100(define-key crisp-mode-map [(meta f10)] 'compile)
101
102(define-key crisp-mode-map [(SunF37)] 'kill-buffer)
103(define-key crisp-mode-map [(kp_add)] 'x-copy-primary-selection)
104(define-key crisp-mode-map [(kp_subtract)] 'x-kill-primary-selection)
105(define-key crisp-mode-map [(insert)] 'x-yank-clipboard-selection)
106(define-key crisp-mode-map [(f16)] 'x-copy-primary-selection) ; copy on Sun5 kbd
107(define-key crisp-mode-map [(f20)] 'x-kill-primary-selection) ; cut on Sun5 kbd
108(define-key crisp-mode-map [(f18)] 'x-yank-clipboard-selection) ; paste on Sun5 kbd
109
110(define-key crisp-mode-map [(meta d)] (lambda () (interactive) (beginning-of-line) (kill-line)))
111(define-key crisp-mode-map [(meta e)] 'find-file)
112(define-key crisp-mode-map [(meta g)] 'goto-line)
113(define-key crisp-mode-map [(meta h)] 'help)
114(define-key crisp-mode-map [(meta i)] 'overwrite-mode)
115(define-key crisp-mode-map [(meta u)] 'advertised-undo)
116(define-key crisp-mode-map [(f14)] 'advertised-undo)
117(define-key crisp-mode-map [(meta w)] 'save-buffer)
118(if
119 (eq crisp-override-meta-x 't)
120 (define-key crisp-mode-map [(meta x)] 'save-buffers-kill-emacs))
121
122(define-key crisp-mode-map [(shift right)] 'fkey-forward-word)
123(define-key crisp-mode-map [(shift left)] 'fkey-backward-word)
124(define-key crisp-mode-map [(shift delete)] 'kill-word)
125(define-key crisp-mode-map [(shift backspace)] 'backward-kill-word)
126(define-key crisp-mode-map [(control left)] 'backward-word)
127(define-key crisp-mode-map [(control right)] 'forward-word)
128
129(define-key crisp-mode-map [(home)] 'crisp-home)
130(define-key crisp-mode-map [(end)] 'crisp-end)
131
132
133(defun crisp-home ()
134 "\"Home\" the point, the way CRiSP would do it.
135The first use moves point to beginning of the line. Second
136consecutive use moves point to beginning of the screen. Third
137consecutive use moves point to the beginning of the buffer."
138 (interactive nil)
139 (cond
140 ((and (eq last-command 'crisp-home) (eq last-last-command 'crisp-home))
141 (goto-char (point-min))
142 )
143 ((eq last-command 'crisp-home)
144 (move-to-window-line 0)
145 )
146 (t
147 (beginning-of-line)
148 )
149 )
150 (setq last-last-command last-command)
151)
152
153(defun crisp-end ()
154 "\"End\" the point, the way CRiSP would do it.
155The first use moves point to end of the line. Second
156consecutive use moves point to the end of the screen. Third
157consecutive use moves point to the end of the buffer."
158 (interactive nil)
159 (cond
160 ((and (eq last-command 'crisp-end) (eq last-last-command 'crisp-end))
161 (goto-char (point-max))
162 )
163 ((eq last-command 'crisp-end)
164 (move-to-window-line -1)
165 (end-of-line)
166 )
167 (t
168 (end-of-line)
169 )
170 )
171 (setq last-last-command last-command)
172)
173
174;; Now enable the mode
175
176(kill-all-local-variables)
177(use-global-map crisp-mode-map)
178
179(if (eq crisp-load-scroll-lock t)
180 (require 'scroll-lock))
181
182(if (featurep 'scroll-lock)
183 (define-key crisp-mode-map [(meta f1)] 'scroll-lock-mode))
184
185(run-hooks 'crisp-load-hook) ;; allow for hooks
186
187(provide 'crisp)
188
189;; crisp.el ends here