Mercurial > emacs
changeset 17448:b0fb37e0d14b
Install the proper version.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 14 Apr 1997 10:35:17 +0000 |
parents | dc2cb454b330 |
children | 9a9062be968a |
files | lisp/emulation/crisp.el |
diffstat | 1 files changed, 79 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emulation/crisp.el Mon Apr 14 08:51:18 1997 +0000 +++ b/lisp/emulation/crisp.el Mon Apr 14 10:35:17 1997 +0000 @@ -1,7 +1,9 @@ -;; crisp.el -- Emulator for CRiSP/Brief key bindings +;;; crisp.el --- Emulator for CRiSP and Brief key bindings + +;; Copyright (C) 1997 Free Software Foundation, Inc. ;; Author: Gary D. Foster <Gary.Foster@corp.sun.com> -;; Keywords: emulations brief crisp +;; Keywords: emulations ;; This file is part of GNU Emacs. @@ -29,25 +31,44 @@ ;; Enable this package by putting the following in your .emacs ;; (require 'crisp) +;; and use M-x crisp-mode to toggle it on or off. ;; This package will automatically default to loading the scroll-lock.el ;; package unless you put (setq crisp-load-scroll-lock nil) in your -;; .emacs. If this feature is enabled, it will bind meta-f1 to the +;; .emacs. If this feature is enabled, it will bind Meta-F1 to the ;; scroll-lock mode toggle. -;; Also, the default keybindings for brief override the Meta-x key to -;; exit the editor. If you don't like this functionality, you can +;; Also, the default keybindings for this mode override the Meta-x key to +;; make it exit the editor. If you don't like this change, you can ;; prevent this key from being rebound with ;; (setq crisp-override-meta-x nil) in your .emacs. +;; Finally, if you want to change the string displayed in the modeline +;; when this mode is in effect, override the definition of +;; `crisp-mode-modeline-string' in your .emacs. The default value is +;; " *Crisp*" which may be a bit lengthy if you have a lot of things +;; being displayed there. + ;; All these overrides should go *before* the (require 'crisp) statement. ;; local variables (defvar crisp-mode-map (copy-keymap (current-global-map)) - "Keymap for CRiSP emulation. + "Local keymap for CRiSP emulation mode. All the emulation bindings are done here instead of globally.") +(defvar crisp-mode-modeline-string " *CRiSP*" + "String to display in the modeline when CRiSP emulation mode is enabled.") + +(defvar crisp-mode-original-keymap (copy-keymap (current-global-map)) + "The original keymap before CRiSP emulation mode remaps anything. +This keymap is restored when CRiSP emulation mode is disabled.") + +(defvar crisp-mode-enabled nil + "Track status of CRiSP emulation mode. +A value of nil means CRiSP mode is not enabled. A value of t +indicates CRiSP mode is enabled.") + (defvar crisp-override-meta-x t "Controls overriding the normal Emacs M-x key binding in the CRiSP emulator. Normally the CRiSP emulator rebinds M-x to save-buffers-exit-emacs @@ -57,15 +78,24 @@ does not alter the binding of M-x.") (defvar crisp-load-scroll-lock t - "Controls loading of Scroll Lock in the CRiSP emulator. -Its default behavior is to load and enable the Scroll Lock minor mode + "Controls loading of the Scroll Lock in the CRiSP emulator. +Its Default behavior is to load and enable the Scroll Lock minor mode package when enabling the CRiSP emulator. If this variable is nil when you start the CRiSP emulator, it does not load Scroll Lock.") (defvar crisp-load-hook nil - "Hooks to run after loading the CRiSP emulator package.") + "Hooks to run after loadint the CRiSP emulator package.") + +(defvar crisp-version "crisp.el release 1.1/$Revision: 1.17 $" + "The release number and RCS version for the CRiSP emulator.") + +(if (string-match "XEmacs\\Lucid" emacs-version) + (add-minor-mode 'crisp-mode-enabled crisp-mode-modeline-string) + (or (assq 'crisp-mode-enabled minor-mode-alist) + (setq minor-mode-alist + (cons '(crisp-mode-enabled crisp-mode-modeline-string) minor-mode-alist)))) ;; and now the keymap defines @@ -100,8 +130,8 @@ (define-key crisp-mode-map [(meta f10)] 'compile) (define-key crisp-mode-map [(SunF37)] 'kill-buffer) -(define-key crisp-mode-map [(kp_add)] 'x-copy-primary-selection) -(define-key crisp-mode-map [(kp_subtract)] 'x-kill-primary-selection) +(define-key crisp-mode-map [(kp-add)] 'x-copy-primary-selection) +(define-key crisp-mode-map [(kp-subtract)] 'x-kill-primary-selection) (define-key crisp-mode-map [(insert)] 'x-yank-clipboard-selection) (define-key crisp-mode-map [(f16)] 'x-copy-primary-selection) ; copy on Sun5 kbd (define-key crisp-mode-map [(f20)] 'x-kill-primary-selection) ; cut on Sun5 kbd @@ -112,12 +142,23 @@ (define-key crisp-mode-map [(meta g)] 'goto-line) (define-key crisp-mode-map [(meta h)] 'help) (define-key crisp-mode-map [(meta i)] 'overwrite-mode) +(define-key crisp-mode-map [(meta j)] 'bookmark-jump) (define-key crisp-mode-map [(meta u)] 'advertised-undo) (define-key crisp-mode-map [(f14)] 'advertised-undo) (define-key crisp-mode-map [(meta w)] 'save-buffer) (if (eq crisp-override-meta-x 't) - (define-key crisp-mode-map [(meta x)] 'save-buffers-kill-emacs)) + (define-key crisp-mode-map [(meta x)] 'save-buffers-kill-emacs)) +(define-key crisp-mode-map [(meta ?0)] (lambda () (interactive) (bookmark-set "0"))) +(define-key crisp-mode-map [(meta ?1)] (lambda () (interactive) (bookmark-set "1"))) +(define-key crisp-mode-map [(meta ?2)] (lambda () (interactive) (bookmark-set "2"))) +(define-key crisp-mode-map [(meta ?3)] (lambda () (interactive) (bookmark-set "3"))) +(define-key crisp-mode-map [(meta ?4)] (lambda () (interactive) (bookmark-set "4"))) +(define-key crisp-mode-map [(meta ?5)] (lambda () (interactive) (bookmark-set "5"))) +(define-key crisp-mode-map [(meta ?6)] (lambda () (interactive) (bookmark-set "6"))) +(define-key crisp-mode-map [(meta ?7)] (lambda () (interactive) (bookmark-set "7"))) +(define-key crisp-mode-map [(meta ?8)] (lambda () (interactive) (bookmark-set "8"))) +(define-key crisp-mode-map [(meta ?9)] (lambda () (interactive) (bookmark-set "9"))) (define-key crisp-mode-map [(shift right)] 'fkey-forward-word) (define-key crisp-mode-map [(shift left)] 'fkey-backward-word) @@ -129,61 +170,56 @@ (define-key crisp-mode-map [(home)] 'crisp-home) (define-key crisp-mode-map [(end)] 'crisp-end) - (defun crisp-home () - "\"Home\" the point, the way CRiSP would do it. + "\"Home\" point, the way CRiSP would do it. The first use moves point to beginning of the line. Second consecutive use moves point to beginning of the screen. Third consecutive use moves point to the beginning of the buffer." (interactive nil) (cond ((and (eq last-command 'crisp-home) (eq last-last-command 'crisp-home)) - (goto-char (point-min)) - ) + (goto-char (point-min))) ((eq last-command 'crisp-home) - (move-to-window-line 0) - ) + (move-to-window-line 0)) (t - (beginning-of-line) - ) - ) - (setq last-last-command last-command) -) + (beginning-of-line))) + (setq last-last-command last-command)) (defun crisp-end () - "\"End\" the point, the way CRiSP would do it. + "\"End\" point, the way CRiSP would do it. The first use moves point to end of the line. Second consecutive use moves point to the end of the screen. Third consecutive use moves point to the end of the buffer." (interactive nil) (cond ((and (eq last-command 'crisp-end) (eq last-last-command 'crisp-end)) - (goto-char (point-max)) - ) + (goto-char (point-max))) ((eq last-command 'crisp-end) (move-to-window-line -1) - (end-of-line) - ) + (end-of-line)) (t - (end-of-line) - ) - ) - (setq last-last-command last-command) -) + (end-of-line))) + (setq last-last-command last-command)) ;; Now enable the mode -(kill-all-local-variables) -(use-global-map crisp-mode-map) - -(if (eq crisp-load-scroll-lock t) - (require 'scroll-lock)) - -(if (featurep 'scroll-lock) - (define-key crisp-mode-map [(meta f1)] 'scroll-lock-mode)) - -(run-hooks 'crisp-load-hook) ;; allow for hooks +(defun crisp-mode () + "Toggle CRiSP emulation minor mode." + (interactive nil) + (setq crisp-mode-enabled (not crisp-mode-enabled)) + (cond + ((eq crisp-mode-enabled 't) + (use-global-map crisp-mode-map) + (if crisp-load-scroll-lock + (require 'scroll-lock)) + (if (featurep 'scroll-lock) + (define-key crisp-mode-map [(meta f1)] 'scroll-lock-mode)) + (run-hooks 'crisp-load-hook)) + ((eq crisp-mode-enabled 'nil) + (use-global-map crisp-mode-original-keymap)))) (provide 'crisp) ;;; crisp.el ends here + +