aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman1997-04-14 10:35:17 +0000
committerRichard M. Stallman1997-04-14 10:35:17 +0000
commitd21b20858f2fee967028f92ab42d05b029f92ffa (patch)
tree2629ea996100f82c92dace601aa10a2195df94d2 /lisp
parentb2adc409373e9fbdd667c594fd4b0e04dcf48f23 (diff)
downloademacs-d21b20858f2fee967028f92ab42d05b029f92ffa.tar.gz
emacs-d21b20858f2fee967028f92ab42d05b029f92ffa.zip
Install the proper version.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emulation/crisp.el122
1 files changed, 79 insertions, 43 deletions
diff --git a/lisp/emulation/crisp.el b/lisp/emulation/crisp.el
index dfa60bde823..306fd3ba84a 100644
--- a/lisp/emulation/crisp.el
+++ b/lisp/emulation/crisp.el
@@ -1,7 +1,9 @@
1;; crisp.el -- Emulator for CRiSP/Brief key bindings 1;;; crisp.el --- Emulator for CRiSP and Brief key bindings
2
3;; Copyright (C) 1997 Free Software Foundation, Inc.
2 4
3;; Author: Gary D. Foster <Gary.Foster@corp.sun.com> 5;; Author: Gary D. Foster <Gary.Foster@corp.sun.com>
4;; Keywords: emulations brief crisp 6;; Keywords: emulations
5 7
6;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
7 9
@@ -29,25 +31,44 @@
29 31
30;; Enable this package by putting the following in your .emacs 32;; Enable this package by putting the following in your .emacs
31;; (require 'crisp) 33;; (require 'crisp)
34;; and use M-x crisp-mode to toggle it on or off.
32 35
33;; This package will automatically default to loading the scroll-lock.el 36;; This package will automatically default to loading the scroll-lock.el
34;; package unless you put (setq crisp-load-scroll-lock nil) in your 37;; 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 38;; .emacs. If this feature is enabled, it will bind Meta-F1 to the
36;; scroll-lock mode toggle. 39;; scroll-lock mode toggle.
37 40
38;; Also, the default keybindings for brief override the Meta-x key to 41;; Also, the default keybindings for this mode override the Meta-x key to
39;; exit the editor. If you don't like this functionality, you can 42;; make it exit the editor. If you don't like this change, you can
40;; prevent this key from being rebound with 43;; prevent this key from being rebound with
41;; (setq crisp-override-meta-x nil) in your .emacs. 44;; (setq crisp-override-meta-x nil) in your .emacs.
42 45
46;; Finally, if you want to change the string displayed in the modeline
47;; when this mode is in effect, override the definition of
48;; `crisp-mode-modeline-string' in your .emacs. The default value is
49;; " *Crisp*" which may be a bit lengthy if you have a lot of things
50;; being displayed there.
51
43;; All these overrides should go *before* the (require 'crisp) statement. 52;; All these overrides should go *before* the (require 'crisp) statement.
44 53
45;; local variables 54;; local variables
46 55
47(defvar crisp-mode-map (copy-keymap (current-global-map)) 56(defvar crisp-mode-map (copy-keymap (current-global-map))
48 "Keymap for CRiSP emulation. 57 "Local keymap for CRiSP emulation mode.
49All the emulation bindings are done here instead of globally.") 58All the emulation bindings are done here instead of globally.")
50 59
60(defvar crisp-mode-modeline-string " *CRiSP*"
61 "String to display in the modeline when CRiSP emulation mode is enabled.")
62
63(defvar crisp-mode-original-keymap (copy-keymap (current-global-map))
64 "The original keymap before CRiSP emulation mode remaps anything.
65This keymap is restored when CRiSP emulation mode is disabled.")
66
67(defvar crisp-mode-enabled nil
68 "Track status of CRiSP emulation mode.
69A value of nil means CRiSP mode is not enabled. A value of t
70indicates CRiSP mode is enabled.")
71
51(defvar crisp-override-meta-x t 72(defvar crisp-override-meta-x t
52 "Controls overriding the normal Emacs M-x key binding in the CRiSP emulator. 73 "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 74Normally the CRiSP emulator rebinds M-x to save-buffers-exit-emacs
@@ -57,15 +78,24 @@ If this variable is nil when you start the CRiSP emulator, it
57does not alter the binding of M-x.") 78does not alter the binding of M-x.")
58 79
59(defvar crisp-load-scroll-lock t 80(defvar crisp-load-scroll-lock t
60 "Controls loading of Scroll Lock in the CRiSP emulator. 81 "Controls loading of the Scroll Lock in the CRiSP emulator.
61Its default behavior is to load and enable the Scroll Lock minor mode 82Its Default behavior is to load and enable the Scroll Lock minor mode
62package when enabling the CRiSP emulator. 83package when enabling the CRiSP emulator.
63 84
64If this variable is nil when you start the CRiSP emulator, it 85If this variable is nil when you start the CRiSP emulator, it
65does not load Scroll Lock.") 86does not load Scroll Lock.")
66 87
67(defvar crisp-load-hook nil 88(defvar crisp-load-hook nil
68 "Hooks to run after loading the CRiSP emulator package.") 89 "Hooks to run after loadint the CRiSP emulator package.")
90
91(defvar crisp-version "crisp.el release 1.1/$Revision: 1.17 $"
92 "The release number and RCS version for the CRiSP emulator.")
93
94(if (string-match "XEmacs\\Lucid" emacs-version)
95 (add-minor-mode 'crisp-mode-enabled crisp-mode-modeline-string)
96 (or (assq 'crisp-mode-enabled minor-mode-alist)
97 (setq minor-mode-alist
98 (cons '(crisp-mode-enabled crisp-mode-modeline-string) minor-mode-alist))))
69 99
70;; and now the keymap defines 100;; and now the keymap defines
71 101
@@ -100,8 +130,8 @@ does not load Scroll Lock.")
100(define-key crisp-mode-map [(meta f10)] 'compile) 130(define-key crisp-mode-map [(meta f10)] 'compile)
101 131
102(define-key crisp-mode-map [(SunF37)] 'kill-buffer) 132(define-key crisp-mode-map [(SunF37)] 'kill-buffer)
103(define-key crisp-mode-map [(kp_add)] 'x-copy-primary-selection) 133(define-key crisp-mode-map [(kp-add)] 'x-copy-primary-selection)
104(define-key crisp-mode-map [(kp_subtract)] 'x-kill-primary-selection) 134(define-key crisp-mode-map [(kp-subtract)] 'x-kill-primary-selection)
105(define-key crisp-mode-map [(insert)] 'x-yank-clipboard-selection) 135(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 136(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 137(define-key crisp-mode-map [(f20)] 'x-kill-primary-selection) ; cut on Sun5 kbd
@@ -112,12 +142,23 @@ does not load Scroll Lock.")
112(define-key crisp-mode-map [(meta g)] 'goto-line) 142(define-key crisp-mode-map [(meta g)] 'goto-line)
113(define-key crisp-mode-map [(meta h)] 'help) 143(define-key crisp-mode-map [(meta h)] 'help)
114(define-key crisp-mode-map [(meta i)] 'overwrite-mode) 144(define-key crisp-mode-map [(meta i)] 'overwrite-mode)
145(define-key crisp-mode-map [(meta j)] 'bookmark-jump)
115(define-key crisp-mode-map [(meta u)] 'advertised-undo) 146(define-key crisp-mode-map [(meta u)] 'advertised-undo)
116(define-key crisp-mode-map [(f14)] 'advertised-undo) 147(define-key crisp-mode-map [(f14)] 'advertised-undo)
117(define-key crisp-mode-map [(meta w)] 'save-buffer) 148(define-key crisp-mode-map [(meta w)] 'save-buffer)
118(if 149(if
119 (eq crisp-override-meta-x 't) 150 (eq crisp-override-meta-x 't)
120 (define-key crisp-mode-map [(meta x)] 'save-buffers-kill-emacs)) 151 (define-key crisp-mode-map [(meta x)] 'save-buffers-kill-emacs))
152(define-key crisp-mode-map [(meta ?0)] (lambda () (interactive) (bookmark-set "0")))
153(define-key crisp-mode-map [(meta ?1)] (lambda () (interactive) (bookmark-set "1")))
154(define-key crisp-mode-map [(meta ?2)] (lambda () (interactive) (bookmark-set "2")))
155(define-key crisp-mode-map [(meta ?3)] (lambda () (interactive) (bookmark-set "3")))
156(define-key crisp-mode-map [(meta ?4)] (lambda () (interactive) (bookmark-set "4")))
157(define-key crisp-mode-map [(meta ?5)] (lambda () (interactive) (bookmark-set "5")))
158(define-key crisp-mode-map [(meta ?6)] (lambda () (interactive) (bookmark-set "6")))
159(define-key crisp-mode-map [(meta ?7)] (lambda () (interactive) (bookmark-set "7")))
160(define-key crisp-mode-map [(meta ?8)] (lambda () (interactive) (bookmark-set "8")))
161(define-key crisp-mode-map [(meta ?9)] (lambda () (interactive) (bookmark-set "9")))
121 162
122(define-key crisp-mode-map [(shift right)] 'fkey-forward-word) 163(define-key crisp-mode-map [(shift right)] 'fkey-forward-word)
123(define-key crisp-mode-map [(shift left)] 'fkey-backward-word) 164(define-key crisp-mode-map [(shift left)] 'fkey-backward-word)
@@ -129,61 +170,56 @@ does not load Scroll Lock.")
129(define-key crisp-mode-map [(home)] 'crisp-home) 170(define-key crisp-mode-map [(home)] 'crisp-home)
130(define-key crisp-mode-map [(end)] 'crisp-end) 171(define-key crisp-mode-map [(end)] 'crisp-end)
131 172
132
133(defun crisp-home () 173(defun crisp-home ()
134 "\"Home\" the point, the way CRiSP would do it. 174 "\"Home\" point, the way CRiSP would do it.
135The first use moves point to beginning of the line. Second 175The first use moves point to beginning of the line. Second
136consecutive use moves point to beginning of the screen. Third 176consecutive use moves point to beginning of the screen. Third
137consecutive use moves point to the beginning of the buffer." 177consecutive use moves point to the beginning of the buffer."
138 (interactive nil) 178 (interactive nil)
139 (cond 179 (cond
140 ((and (eq last-command 'crisp-home) (eq last-last-command 'crisp-home)) 180 ((and (eq last-command 'crisp-home) (eq last-last-command 'crisp-home))
141 (goto-char (point-min)) 181 (goto-char (point-min)))
142 )
143 ((eq last-command 'crisp-home) 182 ((eq last-command 'crisp-home)
144 (move-to-window-line 0) 183 (move-to-window-line 0))
145 )
146 (t 184 (t
147 (beginning-of-line) 185 (beginning-of-line)))
148 ) 186 (setq last-last-command last-command))
149 )
150 (setq last-last-command last-command)
151)
152 187
153(defun crisp-end () 188(defun crisp-end ()
154 "\"End\" the point, the way CRiSP would do it. 189 "\"End\" point, the way CRiSP would do it.
155The first use moves point to end of the line. Second 190The first use moves point to end of the line. Second
156consecutive use moves point to the end of the screen. Third 191consecutive use moves point to the end of the screen. Third
157consecutive use moves point to the end of the buffer." 192consecutive use moves point to the end of the buffer."
158 (interactive nil) 193 (interactive nil)
159 (cond 194 (cond
160 ((and (eq last-command 'crisp-end) (eq last-last-command 'crisp-end)) 195 ((and (eq last-command 'crisp-end) (eq last-last-command 'crisp-end))
161 (goto-char (point-max)) 196 (goto-char (point-max)))
162 )
163 ((eq last-command 'crisp-end) 197 ((eq last-command 'crisp-end)
164 (move-to-window-line -1) 198 (move-to-window-line -1)
165 (end-of-line) 199 (end-of-line))
166 )
167 (t 200 (t
168 (end-of-line) 201 (end-of-line)))
169 ) 202 (setq last-last-command last-command))
170 )
171 (setq last-last-command last-command)
172)
173 203
174;; Now enable the mode 204;; Now enable the mode
175 205
176(kill-all-local-variables) 206(defun crisp-mode ()
177(use-global-map crisp-mode-map) 207 "Toggle CRiSP emulation minor mode."
178 208 (interactive nil)
179(if (eq crisp-load-scroll-lock t) 209 (setq crisp-mode-enabled (not crisp-mode-enabled))
180 (require 'scroll-lock)) 210 (cond
181 211 ((eq crisp-mode-enabled 't)
182(if (featurep 'scroll-lock) 212 (use-global-map crisp-mode-map)
183 (define-key crisp-mode-map [(meta f1)] 'scroll-lock-mode)) 213 (if crisp-load-scroll-lock
184 214 (require 'scroll-lock))
185(run-hooks 'crisp-load-hook) ;; allow for hooks 215 (if (featurep 'scroll-lock)
216 (define-key crisp-mode-map [(meta f1)] 'scroll-lock-mode))
217 (run-hooks 'crisp-load-hook))
218 ((eq crisp-mode-enabled 'nil)
219 (use-global-map crisp-mode-original-keymap))))
186 220
187(provide 'crisp) 221(provide 'crisp)
188 222
189;;; crisp.el ends here 223;;; crisp.el ends here
224
225