diff options
| author | Richard M. Stallman | 1999-05-24 22:23:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-05-24 22:23:35 +0000 |
| commit | 3da6cc26558f8d2cbf18be79879e7eaf991e032d (patch) | |
| tree | df59af37720766f6d7b67c84662ed0180d2676d6 /lisp/emulation | |
| parent | ba20f077029e770dcb348b4a0a4acb69c83a394f (diff) | |
| download | emacs-3da6cc26558f8d2cbf18be79879e7eaf991e032d.tar.gz emacs-3da6cc26558f8d2cbf18be79879e7eaf991e032d.zip | |
(crisp-mode-map): Don't inherit global-map.
Enter it on minor-mode-map-alist.
(crisp-mode): Re-named from `crsip-mode-enabled'. Users changed.
Autoload. Add custom setter.
(crisp-mark-line): Doc fix.
(crisp-mode): Autoload. Re-write not to frob keymaps directly.
(crisp-mode-hook): Define.
Diffstat (limited to 'lisp/emulation')
| -rw-r--r-- | lisp/emulation/crisp.el | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/lisp/emulation/crisp.el b/lisp/emulation/crisp.el index 8e38dfe99c1..39b3ff85017 100644 --- a/lisp/emulation/crisp.el +++ b/lisp/emulation/crisp.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; crisp.el --- CRiSP/Brief Emacs emulator | 1 | ;;; crisp.el --- CRiSP/Brief Emacs emulator |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1997, 1998 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Gary D. Foster <gfoster@suzieq.ml.org> | 5 | ;; Author: Gary D. Foster <gfoster@suzieq.ml.org> |
| 6 | ;; Keywords: emulations brief crisp | 6 | ;; Keywords: emulations brief crisp |
| @@ -42,9 +42,9 @@ | |||
| 42 | ;; key to exit the editor. If you don't like this functionality, you | 42 | ;; key to exit the editor. If you don't like this functionality, you |
| 43 | ;; can prevent this behavior (or redefine it dynamically) by setting | 43 | ;; can prevent this behavior (or redefine it dynamically) by setting |
| 44 | ;; the value of `crisp-override-meta-x' either in your .emacs or | 44 | ;; the value of `crisp-override-meta-x' either in your .emacs or |
| 45 | ;; interactively. The default setting is nil, which means that M-x will | 45 | ;; interactively. The default setting is t, which means that M-x will |
| 46 | ;; by default run `execute-extended-command' instead of the command | 46 | ;; by default run `save-buffers-kill-emacs' instead of the command |
| 47 | ;; `save-buffers-kill-emacs'. | 47 | ;; `execute-extended-command'. |
| 48 | 48 | ||
| 49 | ;; Finally, if you want to change the string displayed in the modeline | 49 | ;; Finally, if you want to change the string displayed in the modeline |
| 50 | ;; when this mode is in effect, override the definition of | 50 | ;; when this mode is in effect, override the definition of |
| @@ -64,7 +64,6 @@ | |||
| 64 | :group 'emulations) | 64 | :group 'emulations) |
| 65 | 65 | ||
| 66 | (defvar crisp-mode-map (let ((map (make-sparse-keymap))) | 66 | (defvar crisp-mode-map (let ((map (make-sparse-keymap))) |
| 67 | (set-keymap-parent map (current-global-map)) | ||
| 68 | map) | 67 | map) |
| 69 | "Local keymap for CRiSP emulation mode. | 68 | "Local keymap for CRiSP emulation mode. |
| 70 | All the bindings are done here instead of globally to try and be | 69 | All the bindings are done here instead of globally to try and be |
| @@ -75,14 +74,17 @@ nice to the world.") | |||
| 75 | :type 'string | 74 | :type 'string |
| 76 | :group 'crisp) | 75 | :group 'crisp) |
| 77 | 76 | ||
| 78 | (defvar crisp-mode-original-keymap (current-global-map) | 77 | ;;;###autoload |
| 79 | "The original keymap before CRiSP emulation mode remaps anything. | 78 | (defcustom crisp-mode nil |
| 80 | This keymap is restored when CRiSP emulation mode is disabled.") | ||
| 81 | |||
| 82 | (defcustom crisp-mode-enabled nil | ||
| 83 | "Track status of CRiSP emulation mode. | 79 | "Track status of CRiSP emulation mode. |
| 84 | A value of nil means CRiSP mode is not enabled. A value of t | 80 | A value of nil means CRiSP mode is not enabled. A value of t |
| 85 | indicates CRiSP mode is enabled." | 81 | indicates CRiSP mode is enabled. |
| 82 | |||
| 83 | Setting this variable directly does not take effect; | ||
| 84 | use either M-x customize or the function `crisp-mode'." | ||
| 85 | :set (lambda (symbol value) (crisp-mode (if value 1 0))) | ||
| 86 | :require 'crisp | ||
| 87 | :version "20.4" | ||
| 86 | :type 'boolean | 88 | :type 'boolean |
| 87 | :group 'crisp) | 89 | :group 'crisp) |
| 88 | 90 | ||
| @@ -109,7 +111,12 @@ does not load the scroll-all package." | |||
| 109 | :type 'hook | 111 | :type 'hook |
| 110 | :group 'crisp) | 112 | :group 'crisp) |
| 111 | 113 | ||
| 112 | (defconst crisp-version "1.33" | 114 | (defcustom crisp-mode-hook nil |
| 115 | "Hook run by the function `crisp-mode'." | ||
| 116 | :type 'hook | ||
| 117 | :group 'crisp) | ||
| 118 | |||
| 119 | (defconst crisp-version "1.34" | ||
| 113 | "The version of the CRiSP emulator.") | 120 | "The version of the CRiSP emulator.") |
| 114 | 121 | ||
| 115 | (defconst crisp-mode-help-address "gfoster@suzieq.ml.org" | 122 | (defconst crisp-mode-help-address "gfoster@suzieq.ml.org" |
| @@ -191,7 +198,7 @@ does not load the scroll-all package." | |||
| 191 | (define-key crisp-mode-map [(f24)] 'crisp-kill-line) | 198 | (define-key crisp-mode-map [(f24)] 'crisp-kill-line) |
| 192 | (define-key crisp-mode-map [(insert)] 'crisp-yank-clipboard) | 199 | (define-key crisp-mode-map [(insert)] 'crisp-yank-clipboard) |
| 193 | (define-key crisp-mode-map [(f16)] 'crisp-set-clipboard) ; copy on Sun5 kbd | 200 | (define-key crisp-mode-map [(f16)] 'crisp-set-clipboard) ; copy on Sun5 kbd |
| 194 | (define-key crisp-mode-map [(f20)] 'crisp-kill-region) ; cut on Sun5 kbd | 201 | (define-key crisp-mode-map [(f20)] 'crisp-kill-region) ; cut on Sun5 kbd |
| 195 | (define-key crisp-mode-map [(f18)] 'crisp-yank-clipboard) ; paste on Sun5 kbd | 202 | (define-key crisp-mode-map [(f18)] 'crisp-yank-clipboard) ; paste on Sun5 kbd |
| 196 | 203 | ||
| 197 | (define-key crisp-mode-map [(control f)] 'fill-paragraph-or-region) | 204 | (define-key crisp-mode-map [(control f)] 'fill-paragraph-or-region) |
| @@ -270,7 +277,8 @@ If ARG, insert results at point." | |||
| 270 | (message foo)))) | 277 | (message foo)))) |
| 271 | 278 | ||
| 272 | (defun crisp-mark-line (arg) | 279 | (defun crisp-mark-line (arg) |
| 273 | "Set mark at the end of the line. Arg works as in `end-of-line'." | 280 | "Set mark at the end of the line. |
| 281 | Arg works as in `end-of-line'." | ||
| 274 | (interactive "p") | 282 | (interactive "p") |
| 275 | (let (newmark) | 283 | (let (newmark) |
| 276 | (save-excursion | 284 | (save-excursion |
| @@ -337,7 +345,7 @@ consecutive use moves point to the end of the buffer." | |||
| 337 | (setq crisp-last-last-command last-command)) | 345 | (setq crisp-last-last-command last-command)) |
| 338 | 346 | ||
| 339 | (defun crisp-unbury-buffer () | 347 | (defun crisp-unbury-buffer () |
| 340 | "Go back one buffer" | 348 | "Go back one buffer." |
| 341 | (interactive) | 349 | (interactive) |
| 342 | (switch-to-buffer (car (last (buffer-list))))) | 350 | (switch-to-buffer (car (last (buffer-list))))) |
| 343 | 351 | ||
| @@ -374,30 +382,30 @@ normal CRiSP binding) and when it is nil M-x will run | |||
| 374 | 382 | ||
| 375 | ;; Now enable the mode | 383 | ;; Now enable the mode |
| 376 | 384 | ||
| 385 | ;;;###autoload | ||
| 377 | (defun crisp-mode (&optional arg) | 386 | (defun crisp-mode (&optional arg) |
| 378 | "Toggle CRiSP emulation minor mode. | 387 | "Toggle CRiSP emulation minor mode. |
| 379 | With ARG, turn CRiSP mode on if ARG is positive, off otherwise." | 388 | With ARG, turn CRiSP mode on if ARG is positive, off otherwise." |
| 380 | (interactive "P") | 389 | (interactive "P") |
| 381 | (setq crisp-mode-enabled (if (null arg) | 390 | (setq crisp-mode (if (null arg) |
| 382 | (not crisp-mode-enabled) | 391 | (not crisp-mode) |
| 383 | (> (prefix-numeric-value arg) 0))) | 392 | (> (prefix-numeric-value arg) 0))) |
| 384 | (cond | 393 | (when crisp-mode |
| 385 | ((eq crisp-mode-enabled 't) | ||
| 386 | (use-global-map crisp-mode-map) | ||
| 387 | (if crisp-load-scroll-all | 394 | (if crisp-load-scroll-all |
| 388 | (require 'scroll-all)) | 395 | (require 'scroll-all)) |
| 389 | (if (featurep 'scroll-all) | 396 | (if (featurep 'scroll-all) |
| 390 | (define-key crisp-mode-map [(meta f1)] 'scroll-all-mode)) | 397 | (define-key crisp-mode-map [(meta f1)] 'scroll-all-mode)) |
| 391 | (run-hooks 'crisp-load-hook)) | 398 | (run-hooks 'crisp-load-hook))) |
| 392 | ((eq crisp-mode-enabled 'nil) | ||
| 393 | (use-global-map crisp-mode-original-keymap)))) | ||
| 394 | 399 | ||
| 395 | (if (fboundp 'add-minor-mode) | 400 | (if (fboundp 'add-minor-mode) |
| 396 | (add-minor-mode 'crisp-mode-enabled 'crisp-mode-modeline-string | 401 | (add-minor-mode 'crisp-mode 'crisp-mode-modeline-string |
| 397 | nil nil 'crisp-mode) | 402 | crisp-mode-map nil 'crisp-mode) |
| 398 | (or (assq 'crisp-mode-enabled minor-mode-alist) | 403 | (or (assq 'crisp-mode minor-mode-alist) |
| 399 | (setq minor-mode-alist | 404 | (setq minor-mode-alist |
| 400 | (cons '(crisp-mode-enabled crisp-mode-modeline-string) minor-mode-alist)))) | 405 | (cons '(crisp-mode crisp-mode-modeline-string) minor-mode-alist))) |
| 406 | (or (assq 'crisp-mode minor-mode-map-alist) | ||
| 407 | (setq minor-mode-map-alist (cons (cons 'crisp-mode crisp-mode-map) | ||
| 408 | minor-mode-map-alist)))) | ||
| 401 | 409 | ||
| 402 | (provide 'crisp) | 410 | (provide 'crisp) |
| 403 | 411 | ||