aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-07-25 20:58:03 +0000
committerRichard M. Stallman1998-07-25 20:58:03 +0000
commit28085971fa313fe6960f8d010b951fbbeef20eb1 (patch)
tree3fceaefbbd7c0886c39565584dc5eb8ead928b2a
parent7fed493a8650bc8404f734bd1e0c4818f87bc052 (diff)
downloademacs-28085971fa313fe6960f8d010b951fbbeef20eb1.tar.gz
emacs-28085971fa313fe6960f8d010b951fbbeef20eb1.zip
Don't require cl.
(crisp-override-meta-x): Doc fix. (crisp-last-last-command): Doc fix. (mark-something): Function deleted. (crisp-mark-line): Avoid using mark-something. (crisp-region-active): Renamed from region-active. (crisp-set-clipboard): Renamed from copy-primary-selection. (crisp-kill-region): Renamed from kill-primary-selection. (crisp-yank-clipboard): Renamed from yank-clipboard-selection.
-rw-r--r--lisp/emulation/crisp.el89
1 files changed, 38 insertions, 51 deletions
diff --git a/lisp/emulation/crisp.el b/lisp/emulation/crisp.el
index 48bd2bb62a5..4f7d9766745 100644
--- a/lisp/emulation/crisp.el
+++ b/lisp/emulation/crisp.el
@@ -22,8 +22,6 @@
22;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23;; Boston, MA 02111-1307, USA. 23;; Boston, MA 02111-1307, USA.
24 24
25;; CRiSP is a registered trademark of Foxtrot Systems Ltd.
26
27;;; Commentary: 25;;; Commentary:
28 26
29;; Keybindings and minor functions to duplicate the functionality and 27;; Keybindings and minor functions to duplicate the functionality and
@@ -58,8 +56,6 @@
58 56
59;; Code: 57;; Code:
60 58
61(require 'cl)
62
63;; local variables 59;; local variables
64 60
65(defgroup crisp nil 61(defgroup crisp nil
@@ -92,7 +88,7 @@ indicates CRiSP mode is enabled."
92 88
93(defcustom crisp-override-meta-x t 89(defcustom crisp-override-meta-x t
94 "*Controls overriding the normal Emacs M-x key binding in the CRiSP emulator. 90 "*Controls overriding the normal Emacs M-x key binding in the CRiSP emulator.
95Normally the CRiSP emulator rebinds M-x to save-buffers-exit-emacs and 91Normally the CRiSP emulator rebinds M-x to `save-buffers-exit-emacs', and
96provides the usual M-x functionality on the F10 key. If this variable 92provides the usual M-x functionality on the F10 key. If this variable
97is non-nil, M-x will exit Emacs." 93is non-nil, M-x will exit Emacs."
98 :type 'boolean 94 :type 'boolean
@@ -121,44 +117,25 @@ does not load the scroll-all package."
121 117
122;; Silence the byte-compiler. 118;; Silence the byte-compiler.
123(defvar crisp-last-last-command nil 119(defvar crisp-last-last-command nil
124 "The previous value of last-command.") 120 "The previous value of `last-command'.")
125 121
126;; The cut and paste routines are different between XEmacs and Emacs 122;; The cut and paste routines are different between XEmacs and Emacs
127;; so we need to set up aliases for the functions. 123;; so we need to set up aliases for the functions.
128 124
129(if (and (not (fboundp 'copy-primary-selection)) 125(defalias 'crisp-set-clipboard
130 (fboundp 'clipboard-kill-ring-save)) 126 (if (fboundp 'clipboard-kill-ring-save)
131 (defalias 'copy-primary-selection 'clipboard-kill-ring-save)) 127 'clipboard-kill-ring-save
132 128 'copy-primary-selection))
133(if (and (not (fboundp 'kill-primary-selection)) 129
134 (fboundp 'clipboard-kill-region)) 130(defalias 'crisp-kill-region
135 (defalias 'kill-primary-selection 'clipboard-kill-region)) 131 (if (fboundp 'clipboard-kill-region)
136 132 'clipboard-kill-region
137(if (and (not (fboundp 'yank-clipboard-selection)) 133 'kill-primary-selection))
138 (fboundp 'clipboard-yank)) 134
139 (defalias 'yank-clipboard-selection 'clipboard-yank)) 135(defalias 'crisp-yank-clipboard
140 136 (if (fboundp 'clipboard-yank)
141;; 'mark-something is very useful for marking arbitrary areas 137 'clipboard-yank
142;; so I stole it from simple.el in XEmacs. 138 'yank-clipboard-selection))
143
144(if (not (fboundp 'mark-something))
145 (defun mark-something (mark-fn movement-fn arg)
146 "Compatibility function swiped from XEmacs."
147 (let (newmark (pushp t))
148 (save-excursion
149 (if (and (eq last-command mark-fn) (mark))
150 ;; Extend the previous state in the same direction:
151 (progn
152 (if (< (mark) (point)) (setq arg (- arg)))
153 (goto-char (mark))
154 (setq pushp nil)))
155 (funcall movement-fn arg)
156 (setq newmark (point)))
157 (if pushp
158 (push-mark newmark nil t)
159 ;; Do not mess with the mark stack, but merely adjust the previous state:
160 (set-mark newmark)
161 (activate-region)))))
162 139
163;; force transient-mark-mode in Emacs, so that the marking routines 140;; force transient-mark-mode in Emacs, so that the marking routines
164;; work as expected. If the user turns off transient mark mode, 141;; work as expected. If the user turns off transient mark mode,
@@ -169,7 +146,7 @@ does not load the scroll-all package."
169(if (fboundp 'transient-mark-mode) 146(if (fboundp 'transient-mark-mode)
170 (transient-mark-mode t)) 147 (transient-mark-mode t))
171 148
172(defun region-active () 149(defun crisp-region-active ()
173 "Compatibility function to test for an active region." 150 "Compatibility function to test for an active region."
174 (if (boundp 'zmacs-region-active-p) 151 (if (boundp 'zmacs-region-active-p)
175 zmacs-region-active-p 152 zmacs-region-active-p
@@ -212,10 +189,10 @@ does not load the scroll-all package."
212(define-key crisp-mode-map [(kp-subtract)] 'crisp-kill-line) 189(define-key crisp-mode-map [(kp-subtract)] 'crisp-kill-line)
213;; just to cover all the bases (GNU Emacs, for instance) 190;; just to cover all the bases (GNU Emacs, for instance)
214(define-key crisp-mode-map [(f24)] 'crisp-kill-line) 191(define-key crisp-mode-map [(f24)] 'crisp-kill-line)
215(define-key crisp-mode-map [(insert)] 'yank-clipboard-selection) 192(define-key crisp-mode-map [(insert)] 'crisp-yank-clipboard)
216(define-key crisp-mode-map [(f16)] 'copy-primary-selection) ; copy on Sun5 kbd 193(define-key crisp-mode-map [(f16)] 'crisp-set-clipboard) ; copy on Sun5 kbd
217(define-key crisp-mode-map [(f20)] 'kill-primary-selection) ; cut on Sun5 kbd 194(define-key crisp-mode-map [(f20)] 'crisp-kill-region) ; cut on Sun5 kbd
218(define-key crisp-mode-map [(f18)] 'yank-clipboard-selection) ; paste on Sun5 kbd 195(define-key crisp-mode-map [(f18)] 'crisp-yank-clipboard) ; paste on Sun5 kbd
219 196
220(define-key crisp-mode-map [(control f)] 'fill-paragraph-or-region) 197(define-key crisp-mode-map [(control f)] 'fill-paragraph-or-region)
221(define-key crisp-mode-map [(meta d)] (lambda () 198(define-key crisp-mode-map [(meta d)] (lambda ()
@@ -295,17 +272,27 @@ If ARG, insert results at point."
295(defun crisp-mark-line (arg) 272(defun crisp-mark-line (arg)
296 "Put mark at the end of line. Arg works as in `end-of-line'." 273 "Put mark at the end of line. Arg works as in `end-of-line'."
297 (interactive "p") 274 (interactive "p")
298 (mark-something 'crisp-mark-line 'end-of-line arg)) 275 (save-excursion
276 (if (and (eq last-command 'crisp-mark-line) (mark))
277 ;; Extend the previous state in the same direction:
278 (progn
279 (if (< (mark) (point)) (setq arg (- arg)))
280 (goto-char (mark))
281 (end-of-line arg)
282 ;; Do not mess with the mark stack, but merely adjust the previous state:
283 (set-mark (point)))
284 (end-of-line arg)
285 (push-mark (point) nil t))))
299 286
300(defun crisp-kill-line (arg) 287(defun crisp-kill-line (arg)
301 "Mark and kill line(s). 288 "Mark and kill line(s).
302Marks from point to end of the current line (honoring prefix arguments), 289Marks from point to end of the current line (honoring prefix arguments),
303copies the region to the kill ring and clipboard, and then deletes it." 290copies the region to the kill ring and clipboard, and then deletes it."
304 (interactive "*p") 291 (interactive "*p")
305 (if (region-active) 292 (if (crisp-region-active)
306 (call-interactively 'kill-primary-selection) 293 (call-interactively 'crisp-kill-region)
307 (crisp-mark-line arg) 294 (crisp-mark-line arg)
308 (call-interactively 'kill-primary-selection))) 295 (call-interactively 'crisp-kill-region)))
309 296
310(defun crisp-copy-line (arg) 297(defun crisp-copy-line (arg)
311 "Mark and copy line(s). 298 "Mark and copy line(s).
@@ -313,10 +300,10 @@ Marks from point to end of the current line (honoring prefix arguments),
313copies the region to the kill ring and clipboard, and then deactivates 300copies the region to the kill ring and clipboard, and then deactivates
314the region." 301the region."
315 (interactive "*p") 302 (interactive "*p")
316 (if (region-active) 303 (if (crisp-region-active)
317 (call-interactively 'copy-primary-selection) 304 (call-interactively 'crisp-set-clipboard)
318 (crisp-mark-line arg) 305 (crisp-mark-line arg)
319 (call-interactively 'copy-primary-selection)) 306 (call-interactively 'crisp-set-clipboard))
320 ;; clear the region after the operation is complete 307 ;; clear the region after the operation is complete
321 ;; XEmacs does this automagically, Emacs doesn't. 308 ;; XEmacs does this automagically, Emacs doesn't.
322 (if (boundp 'mark-active) 309 (if (boundp 'mark-active)