annotate lisp/emulators/crisp.el @ 74:54cc21c15cbb r20-0b32

Import from CVS: tag r20-0b32
author cvs
date Mon, 13 Aug 2007 09:04:33 +0200
parents b82b59fe008d
children cca96a509cfe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;; @(#) crisp.el -- Crisp/Brief Emacs emulator
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
3 ;; Author: Gary D. Foster <Gary.Foster@corp.sun.com>
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 4
diff changeset
4 ;; $Revision: 1.1.1.2 $
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Keywords: emulations brief crisp
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
6
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12 ;; any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;;; Commentary:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;; Keybindings and minor functions to duplicate the functionality and
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27 ;; finger-feel of the Crisp/Brief editor. This package is designed to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
28 ;; facilitate transitioning from Brief to (XE|E)macs with a minimum
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
29 ;; amount of hassles.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
30
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
31 ;; Enable this package by putting the following in your .emacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
32 ;; (require 'crisp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
33 ;; and use M-x crisp-mode to toggle it on or off.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
34
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
35 ;; This package will automatically default to loading the scroll-lock.el
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
36 ;; package unless you put (setq crisp-load-scroll-lock nil) in your
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
37 ;; .emacs. If this feature is enabled, it will bind meta-f1 to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
38 ;; scroll-lock mode toggle.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
39
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
40 ;; Also, the default keybindings for brief override the meta-x key to
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
41 ;; exit the editor. If you don't like this functionality, you can
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
42 ;; prevent this key from being rebound with
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
43 ;; (setq crisp-override-meta-x nil) in your .emacs.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
44
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
45 ;; Finally, if you want to change the string displayed in the modeline
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
46 ;; when this mode is in effect, override the definition of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
47 ;; `crisp-mode-modeline-string' in your .emacs. The default value is
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
48 ;; " *Crisp*" which may be a bit lengthy if you have a lot of things
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
49 ;; being displayed there.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
50
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
51 ;; All these overrides should go *before* the (require 'crisp) statement.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
52
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
53 ;; local variables
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (defvar crisp-mode-map (copy-keymap (current-global-map))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 "Local keymap for Crisp mode.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 All the bindings are done here instead of globally to try and be
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 nice to the world.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 (defvar crisp-mode-modeline-string " *Crisp*"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 "String to display in the modeline when Crisp mode is enabled.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63 (defvar crisp-mode-original-keymap (copy-keymap (current-global-map))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 "The original keymap before Crisp mode remaps anything.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 This keymap is restored when Crisp mode is disabled.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (defvar crisp-mode-enabled 'nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 "Track status of Crisp mode.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 A value of nil means Crisp mode is not enabled. A value of t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70 indicates Crisp mode is enabled.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (defvar crisp-override-meta-x 't
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 "Controls overriding the normal Emacs M-x key binding.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 The normal binding for M-x is `execute-extended-command', however
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75 the normal Crisp keybinding for M-x is to exit the editor, while
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 the F10 key is used to execute extended commands. If you don't
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 want M-x to dump you out of emacs, set this to nil before loading
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 the package.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (defvar crisp-load-scroll-lock 't
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 "Controls loading of the Scroll Lock minor mode package.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 Default behavior is to load the scroll lock minor mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83 package when Crisp mode is enabled. Set to nil prior
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 to loading this package to prevent it.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 (defvar crisp-load-hook nil
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87 "Hooks to run after Crisp mode is enabled.")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 (defvar crisp-mode-running-xemacs (string-match "XEmacs\\Lucid" emacs-version))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 (if crisp-mode-running-xemacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 (add-minor-mode 'crisp-mode-enabled crisp-mode-modeline-string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 (or (assq 'crisp-mode-enabled minor-mode-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (setq minor-mode-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 (cons '(crisp-mode-enabled crisp-mode-modeline-string) minor-mode-alist))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 ;; and now the keymap defines
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 (define-key crisp-mode-map [(f1)] 'other-window)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 (define-key crisp-mode-map [(f2) (down)] 'enlarge-window)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 (define-key crisp-mode-map [(f2) (left)] 'shrink-window-horizontally)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 (define-key crisp-mode-map [(f2) (right)] 'enlarge-window-horizontally)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104 (define-key crisp-mode-map [(f2) (up)] 'shrink-window)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105 (define-key crisp-mode-map [(f3) (down)] 'split-window-vertically)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 (define-key crisp-mode-map [(f3) (right)] 'split-window-horizontally)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108 (define-key crisp-mode-map [(f4)] 'delete-window)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 (define-key crisp-mode-map [(control f4)] 'delete-other-windows)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 (define-key crisp-mode-map [(f5)] 'search-forward-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 (define-key crisp-mode-map [(f19)] 'search-forward-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (define-key crisp-mode-map [(meta f5)] 'search-backward-regexp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (define-key crisp-mode-map [(f6)] 'query-replace)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (define-key crisp-mode-map [(f7)] 'start-kbd-macro)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 (define-key crisp-mode-map [(meta f7)] 'end-kbd-macro)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (define-key crisp-mode-map [(f8)] 'call-last-kbd-macro)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 (define-key crisp-mode-map [(meta f8)] 'save-kbd-macro)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (define-key crisp-mode-map [(f9)] 'find-file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 (define-key crisp-mode-map [(meta f9)] 'load-library)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 (define-key crisp-mode-map [(f10)] 'execute-extended-command)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (define-key crisp-mode-map [(meta f10)] 'compile)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 (define-key crisp-mode-map [(SunF37)] 'kill-buffer)
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 4
diff changeset
130 (define-key crisp-mode-map [(kp-add)] 'x-copy-primary-selection)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 4
diff changeset
131 (define-key crisp-mode-map [(kp-subtract)] 'x-kill-primary-selection)
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 (define-key crisp-mode-map [(insert)] 'x-yank-clipboard-selection)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 (define-key crisp-mode-map [(f16)] 'x-copy-primary-selection) ; copy on Sun5 kbd
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 (define-key crisp-mode-map [(f20)] 'x-kill-primary-selection) ; cut on Sun5 kbd
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135 (define-key crisp-mode-map [(f18)] 'x-yank-clipboard-selection) ; paste on Sun5 kbd
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
137 (define-key crisp-mode-map [(meta d)] (lambda () (interactive) (beginning-of-line) (kill-line)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138 (define-key crisp-mode-map [(meta e)] 'find-file)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139 (define-key crisp-mode-map [(meta g)] 'goto-line)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
140 (define-key crisp-mode-map [(meta h)] 'help)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
141 (define-key crisp-mode-map [(meta i)] 'overwrite-mode)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142 (define-key crisp-mode-map [(meta u)] 'advertised-undo)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
143 (define-key crisp-mode-map [(f14)] 'advertised-undo)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
144 (define-key crisp-mode-map [(meta w)] 'save-buffer)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
145 (if
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
146 (eq crisp-override-meta-x 't)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
147 (define-key crisp-mode-map [(meta x)] 'save-buffers-kill-emacs))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
148
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
149 (define-key crisp-mode-map [(shift right)] 'fkey-forward-word)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
150 (define-key crisp-mode-map [(shift left)] 'fkey-backward-word)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
151 (define-key crisp-mode-map [(shift delete)] 'kill-word)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
152 (define-key crisp-mode-map [(shift backspace)] 'backward-kill-word)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
153 (define-key crisp-mode-map [(control left)] 'backward-word)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
154 (define-key crisp-mode-map [(control right)] 'forward-word)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
155
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
156 (define-key crisp-mode-map [(home)] 'crisp-home)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
157 (define-key crisp-mode-map [(end)] 'crisp-end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
158
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
159 (defun crisp-home ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
160 "Home the point according to Crisp conventions.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
161 First call to this moves point to beginning of the line. Second
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162 consecutive call moves point to beginning of the screen. Third
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 consecutive call moves the point to the beginning of the buffer."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164 (interactive nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166 ((and (eq last-command 'crisp-home) (eq last-last-command 'crisp-home))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 (goto-char (point-min)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 ((eq last-command 'crisp-home)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169 (move-to-window-line 0))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 (beginning-of-line)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 (setq last-last-command last-command))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
174 (defun crisp-end ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 "End the point according to Crisp conventions.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 First call to this moves point to end of the line. Second
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177 consecutive call moves point to the end of the screen. Third
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178 consecutive call moves point to the end of the buffer."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
179 (interactive nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
180 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
181 ((and (eq last-command 'crisp-end) (eq last-last-command 'crisp-end))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
182 (goto-char (point-max)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
183 ((eq last-command 'crisp-end)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
184 (move-to-window-line -1)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
185 (end-of-line))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 (end-of-line)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 (setq last-last-command last-command))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
189
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
190 ;; Now enable the mode
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
191
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
192 (defun crisp-mode ()
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
193 "Toggle Crisp minor mode."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194 (interactive nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 (setq crisp-mode-enabled (not crisp-mode-enabled))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 (cond
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197 ((eq crisp-mode-enabled 't)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 (use-global-map crisp-mode-map)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 (if crisp-load-scroll-lock
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 (require 'scroll-lock))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 (if (featurep 'scroll-lock)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202 (define-key crisp-mode-map [(meta f1)] 'scroll-lock-mode))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 (run-hooks 'crisp-load-hook))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
204 ((eq crisp-mode-enabled 'nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205 (use-global-map crisp-mode-original-keymap))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207 (provide 'crisp)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 ;;; crisp.el ends here