Mercurial > emacs
comparison lisp/emulation/crisp.el @ 24839:c67fe81fd9ed
(crisp-mode): (defcustom) Initialize with
custom-initialize-default to avoid infinite loop.
(crisp-mode): (defun) Call transient-mark-mode here, not when
loading the file. Run crisp-mode-hook here, and run
crisp-load-hook when loading the file.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sun, 13 Jun 1999 02:37:28 +0000 |
parents | 0b882049980c |
children | 47cdb31c3a62 |
comparison
equal
deleted
inserted
replaced
24838:38c24ff1f1c6 | 24839:c67fe81fd9ed |
---|---|
82 indicates CRiSP mode is enabled. | 82 indicates CRiSP mode is enabled. |
83 | 83 |
84 Setting this variable directly does not take effect; | 84 Setting this variable directly does not take effect; |
85 use either M-x customize or the function `crisp-mode'." | 85 use either M-x customize or the function `crisp-mode'." |
86 :set (lambda (symbol value) (crisp-mode (if value 1 0))) | 86 :set (lambda (symbol value) (crisp-mode (if value 1 0))) |
87 :initialize 'custom-initialize-default | |
87 :require 'crisp | 88 :require 'crisp |
88 :version "20.4" | 89 :version "20.4" |
89 :type 'boolean | 90 :type 'boolean |
90 :group 'crisp) | 91 :group 'crisp) |
91 | 92 |
142 | 143 |
143 (defalias 'crisp-yank-clipboard | 144 (defalias 'crisp-yank-clipboard |
144 (if (fboundp 'clipboard-yank) | 145 (if (fboundp 'clipboard-yank) |
145 'clipboard-yank | 146 'clipboard-yank |
146 'yank-clipboard-selection)) | 147 'yank-clipboard-selection)) |
147 | |
148 ;; force transient-mark-mode in Emacs, so that the marking routines | |
149 ;; work as expected. If the user turns off transient mark mode, | |
150 ;; most things will still work fine except the crisp-(copy|kill) | |
151 ;; functions won't work quite as nicely when regions are marked | |
152 ;; differently and could really confuse people. Caveat emptor. | |
153 | |
154 (if (fboundp 'transient-mark-mode) | |
155 (transient-mark-mode t)) | |
156 | 148 |
157 (defun crisp-region-active () | 149 (defun crisp-region-active () |
158 "Compatibility function to test for an active region." | 150 "Compatibility function to test for an active region." |
159 (if (boundp 'zmacs-region-active-p) | 151 (if (boundp 'zmacs-region-active-p) |
160 zmacs-region-active-p | 152 zmacs-region-active-p |
356 (interactive) | 348 (interactive) |
357 (if crisp-override-meta-x | 349 (if crisp-override-meta-x |
358 (save-buffers-kill-emacs) | 350 (save-buffers-kill-emacs) |
359 (call-interactively 'execute-extended-command))) | 351 (call-interactively 'execute-extended-command))) |
360 | 352 |
361 ;; Now enable the mode | |
362 | |
363 ;;;###autoload | 353 ;;;###autoload |
364 (defun crisp-mode (&optional arg) | 354 (defun crisp-mode (&optional arg) |
365 "Toggle CRiSP emulation minor mode. | 355 "Toggle CRiSP emulation minor mode. |
366 With ARG, turn CRiSP mode on if ARG is positive, off otherwise." | 356 With ARG, turn CRiSP mode on if ARG is positive, off otherwise." |
367 (interactive "P") | 357 (interactive "P") |
368 (setq crisp-mode (if (null arg) | 358 (setq crisp-mode (if (null arg) |
369 (not crisp-mode) | 359 (not crisp-mode) |
370 (> (prefix-numeric-value arg) 0))) | 360 (> (prefix-numeric-value arg) 0))) |
371 (when crisp-mode | 361 (when crisp-mode |
362 ;; Force transient-mark-mode, so that the marking routines work as | |
363 ;; expected. If the user turns off transient mark mode, most | |
364 ;; things will still work fine except the crisp-(copy|kill) | |
365 ;; functions won't work quite as nicely when regions are marked | |
366 ;; differently and could really confuse people. Caveat emptor. | |
367 (if (fboundp 'transient-mark-mode) | |
368 (transient-mark-mode t)) | |
372 (if crisp-load-scroll-all | 369 (if crisp-load-scroll-all |
373 (require 'scroll-all)) | 370 (require 'scroll-all)) |
374 (if (featurep 'scroll-all) | 371 (if (featurep 'scroll-all) |
375 (define-key crisp-mode-map [(meta f1)] 'scroll-all-mode)) | 372 (define-key crisp-mode-map [(meta f1)] 'scroll-all-mode)) |
376 (run-hooks 'crisp-load-hook))) | 373 (run-hooks 'crisp-mode-hook))) |
377 | 374 |
378 (if (fboundp 'add-minor-mode) | 375 (if (fboundp 'add-minor-mode) |
379 (add-minor-mode 'crisp-mode 'crisp-mode-modeline-string | 376 (add-minor-mode 'crisp-mode 'crisp-mode-modeline-string |
380 crisp-mode-map nil 'crisp-mode) | 377 crisp-mode-map nil 'crisp-mode) |
381 (or (assq 'crisp-mode minor-mode-alist) | 378 (or (assq 'crisp-mode minor-mode-alist) |
383 (cons '(crisp-mode crisp-mode-modeline-string) minor-mode-alist))) | 380 (cons '(crisp-mode crisp-mode-modeline-string) minor-mode-alist))) |
384 (or (assq 'crisp-mode minor-mode-map-alist) | 381 (or (assq 'crisp-mode minor-mode-map-alist) |
385 (setq minor-mode-map-alist (cons (cons 'crisp-mode crisp-mode-map) | 382 (setq minor-mode-map-alist (cons (cons 'crisp-mode crisp-mode-map) |
386 minor-mode-map-alist)))) | 383 minor-mode-map-alist)))) |
387 | 384 |
385 (run-hooks 'crisp-load-hook) | |
388 (provide 'crisp) | 386 (provide 'crisp) |
389 | 387 |
390 ;;; crisp.el ends here | 388 ;;; crisp.el ends here |