[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 37/56: * emulation/crisp.el (crisp-mode-map): Move initialization
From: |
Luke Lee |
Subject: |
[elpa] 37/56: * emulation/crisp.el (crisp-mode-map): Move initialization into declaration. (crisp-mode): Use define-minor-mode. |
Date: |
Thu, 28 Aug 2014 02:21:53 +0000 |
lukelee pushed a commit to branch master
in repository elpa.
commit 21247afcc9e7618db97b5c89858a92f7add7dd78
Author: Stefan Monnier <address@hidden>
Date: Fri Sep 11 01:00:37 2009 +0000
* emulation/crisp.el (crisp-mode-map): Move initialization into
declaration. (crisp-mode): Use define-minor-mode.
---
lisp/emulation/crisp.el | 235 ++++++++++++++++++++++-------------------------
1 files changed, 110 insertions(+), 125 deletions(-)
diff --git a/lisp/emulation/crisp.el b/lisp/emulation/crisp.el
index a53adf0..870e879 100644
--- a/lisp/emulation/crisp.el
+++ b/lisp/emulation/crisp.el
@@ -64,8 +64,112 @@
:prefix "crisp-"
:group 'emulations)
-(defvar crisp-mode-map (let ((map (make-sparse-keymap)))
- map)
+(defvar crisp-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map [(f1)] 'other-window)
+
+ (define-key map [(f2) (down)] 'enlarge-window)
+ (define-key map [(f2) (left)] 'shrink-window-horizontally)
+ (define-key map [(f2) (right)] 'enlarge-window-horizontally)
+ (define-key map [(f2) (up)] 'shrink-window)
+ (define-key map [(f3) (down)] 'split-window-vertically)
+ (define-key map [(f3) (right)] 'split-window-horizontally)
+
+ (define-key map [(f4)] 'delete-window)
+ (define-key map [(control f4)] 'delete-other-windows)
+
+ (define-key map [(f5)] 'search-forward-regexp)
+ (define-key map [(f19)] 'search-forward-regexp)
+ (define-key map [(meta f5)] 'search-backward-regexp)
+
+ (define-key map [(f6)] 'query-replace)
+
+ (define-key map [(f7)] 'start-kbd-macro)
+ (define-key map [(meta f7)] 'end-kbd-macro)
+
+ (define-key map [(f8)] 'call-last-kbd-macro)
+ (define-key map [(meta f8)] 'save-kbd-macro)
+
+ (define-key map [(f9)] 'find-file)
+ (define-key map [(meta f9)] 'load-library)
+
+ (define-key map [(f10)] 'execute-extended-command)
+ (define-key map [(meta f10)] 'compile)
+
+ (define-key map [(SunF37)] 'kill-buffer)
+ (define-key map [(kp-add)] 'crisp-copy-line)
+ (define-key map [(kp-subtract)] 'crisp-kill-line)
+ ;; just to cover all the bases (GNU Emacs, for instance)
+ (define-key map [(f24)] 'crisp-kill-line)
+ (define-key map [(insert)] 'crisp-yank-clipboard)
+ (define-key map [(f16)] 'crisp-set-clipboard) ; copy on Sun5 kbd
+ (define-key map [(f20)] 'crisp-kill-region) ; cut on Sun5 kbd
+ (define-key map [(f18)] 'crisp-yank-clipboard) ; paste on Sun5 kbd
+
+ (define-key map [(control f)] 'fill-paragraph-or-region)
+ (define-key map [(meta d)] (lambda ()
+ (interactive)
+ (beginning-of-line) (kill-line)))
+ (define-key map [(meta e)] 'find-file)
+ (define-key map [(meta g)] 'goto-line)
+ (define-key map [(meta h)] 'help)
+ (define-key map [(meta i)] 'overwrite-mode)
+ (define-key map [(meta j)] 'bookmark-jump)
+ (define-key map [(meta l)] 'crisp-mark-line)
+ (define-key map [(meta m)] 'set-mark-command)
+ (define-key map [(meta n)] 'bury-buffer)
+ (define-key map [(meta p)] 'crisp-unbury-buffer)
+ (define-key map [(meta u)] 'undo)
+ (define-key map [(f14)] 'undo)
+ (define-key map [(meta w)] 'save-buffer)
+ (define-key map [(meta x)] 'crisp-meta-x-wrapper)
+ (define-key map [(meta ?0)] (lambda ()
+ (interactive)
+ (bookmark-set "0")))
+ (define-key map [(meta ?1)] (lambda ()
+ (interactive)
+ (bookmark-set "1")))
+ (define-key map [(meta ?2)] (lambda ()
+ (interactive)
+ (bookmark-set "2")))
+ (define-key map [(meta ?3)] (lambda ()
+ (interactive)
+ (bookmark-set "3")))
+ (define-key map [(meta ?4)] (lambda ()
+ (interactive)
+ (bookmark-set "4")))
+ (define-key map [(meta ?5)] (lambda ()
+ (interactive)
+ (bookmark-set "5")))
+ (define-key map [(meta ?6)] (lambda ()
+ (interactive)
+ (bookmark-set "6")))
+ (define-key map [(meta ?7)] (lambda ()
+ (interactive)
+ (bookmark-set "7")))
+ (define-key map [(meta ?8)] (lambda ()
+ (interactive)
+ (bookmark-set "8")))
+ (define-key map [(meta ?9)] (lambda ()
+ (interactive)
+ (bookmark-set "9")))
+
+ (define-key map [(shift delete)] 'kill-word)
+ (define-key map [(shift backspace)] 'backward-kill-word)
+ (define-key map [(control left)] 'backward-word)
+ (define-key map [(control right)] 'forward-word)
+
+ (define-key map [(home)] 'crisp-home)
+ (define-key map [(control home)] (lambda ()
+ (interactive)
+ (move-to-window-line 0)))
+ (define-key map [(meta home)] 'beginning-of-line)
+ (define-key map [(end)] 'crisp-end)
+ (define-key map [(control end)] (lambda ()
+ (interactive)
+ (move-to-window-line -1)))
+ (define-key map [(meta end)] 'end-of-line)
+ map)
"Local keymap for CRiSP emulation mode.
All the bindings are done here instead of globally to try and be
nice to the world.")
@@ -152,112 +256,6 @@ does not load the scroll-all package."
zmacs-region-active-p
mark-active))
-;; and now the keymap defines
-
-(define-key crisp-mode-map [(f1)] 'other-window)
-
-(define-key crisp-mode-map [(f2) (down)] 'enlarge-window)
-(define-key crisp-mode-map [(f2) (left)] 'shrink-window-horizontally)
-(define-key crisp-mode-map [(f2) (right)] 'enlarge-window-horizontally)
-(define-key crisp-mode-map [(f2) (up)] 'shrink-window)
-(define-key crisp-mode-map [(f3) (down)] 'split-window-vertically)
-(define-key crisp-mode-map [(f3) (right)] 'split-window-horizontally)
-
-(define-key crisp-mode-map [(f4)] 'delete-window)
-(define-key crisp-mode-map [(control f4)] 'delete-other-windows)
-
-(define-key crisp-mode-map [(f5)] 'search-forward-regexp)
-(define-key crisp-mode-map [(f19)] 'search-forward-regexp)
-(define-key crisp-mode-map [(meta f5)] 'search-backward-regexp)
-
-(define-key crisp-mode-map [(f6)] 'query-replace)
-
-(define-key crisp-mode-map [(f7)] 'start-kbd-macro)
-(define-key crisp-mode-map [(meta f7)] 'end-kbd-macro)
-
-(define-key crisp-mode-map [(f8)] 'call-last-kbd-macro)
-(define-key crisp-mode-map [(meta f8)] 'save-kbd-macro)
-
-(define-key crisp-mode-map [(f9)] 'find-file)
-(define-key crisp-mode-map [(meta f9)] 'load-library)
-
-(define-key crisp-mode-map [(f10)] 'execute-extended-command)
-(define-key crisp-mode-map [(meta f10)] 'compile)
-
-(define-key crisp-mode-map [(SunF37)] 'kill-buffer)
-(define-key crisp-mode-map [(kp-add)] 'crisp-copy-line)
-(define-key crisp-mode-map [(kp-subtract)] 'crisp-kill-line)
-;; just to cover all the bases (GNU Emacs, for instance)
-(define-key crisp-mode-map [(f24)] 'crisp-kill-line)
-(define-key crisp-mode-map [(insert)] 'crisp-yank-clipboard)
-(define-key crisp-mode-map [(f16)] 'crisp-set-clipboard) ; copy on
Sun5 kbd
-(define-key crisp-mode-map [(f20)] 'crisp-kill-region) ; cut on Sun5
kbd
-(define-key crisp-mode-map [(f18)] 'crisp-yank-clipboard) ; paste on
Sun5 kbd
-
-(define-key crisp-mode-map [(control f)] 'fill-paragraph-or-region)
-(define-key crisp-mode-map [(meta d)] (lambda ()
- (interactive)
- (beginning-of-line) (kill-line)))
-(define-key crisp-mode-map [(meta e)] 'find-file)
-(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 l)] 'crisp-mark-line)
-(define-key crisp-mode-map [(meta m)] 'set-mark-command)
-(define-key crisp-mode-map [(meta n)] 'bury-buffer)
-(define-key crisp-mode-map [(meta p)] 'crisp-unbury-buffer)
-(define-key crisp-mode-map [(meta u)] 'undo)
-(define-key crisp-mode-map [(f14)] 'undo)
-(define-key crisp-mode-map [(meta w)] 'save-buffer)
-(define-key crisp-mode-map [(meta x)] 'crisp-meta-x-wrapper)
-(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 delete)] 'kill-word)
-(define-key crisp-mode-map [(shift backspace)] 'backward-kill-word)
-(define-key crisp-mode-map [(control left)] 'backward-word)
-(define-key crisp-mode-map [(control right)] 'forward-word)
-
-(define-key crisp-mode-map [(home)] 'crisp-home)
-(define-key crisp-mode-map [(control home)] (lambda ()
- (interactive)
- (move-to-window-line 0)))
-(define-key crisp-mode-map [(meta home)] 'beginning-of-line)
-(define-key crisp-mode-map [(end)] 'crisp-end)
-(define-key crisp-mode-map [(control end)] (lambda ()
- (interactive)
- (move-to-window-line -1)))
-(define-key crisp-mode-map [(meta end)] 'end-of-line)
-
(defun crisp-version (&optional arg)
"Version number of the CRiSP emulator package.
If ARG, insert results at point."
@@ -351,13 +349,11 @@ normal CRiSP binding) and when it is nil M-x will run
(call-interactively 'execute-extended-command)))
;;;###autoload
-(defun crisp-mode (&optional arg)
+(define-minor-mode crisp-mode
"Toggle CRiSP/Brief emulation minor mode.
With ARG, turn CRiSP mode on if ARG is positive, off otherwise."
- (interactive "P")
- (setq crisp-mode (if (null arg)
- (not crisp-mode)
- (> (prefix-numeric-value arg) 0)))
+ :keymap crisp-mode-map
+ :lighter crisp-mode-modeline-string
(when crisp-mode
;; Make menu entries show M-u or f14 in preference to C-x u.
(put 'undo :advertised-binding
@@ -372,23 +368,12 @@ With ARG, turn CRiSP mode on if ARG is positive, off
otherwise."
(if crisp-load-scroll-all
(require 'scroll-all))
(if (featurep 'scroll-all)
- (define-key crisp-mode-map [(meta f1)] 'scroll-all-mode))
- (run-hooks 'crisp-mode-hook)))
+ (define-key crisp-mode-map [(meta f1)] 'scroll-all-mode))))
;; People might use Apropos on `brief'.
;;;###autoload
(defalias 'brief-mode 'crisp-mode)
-(if (fboundp 'add-minor-mode)
- (add-minor-mode 'crisp-mode 'crisp-mode-modeline-string
- crisp-mode-map nil 'crisp-mode)
- (or (assq 'crisp-mode minor-mode-alist)
- (setq minor-mode-alist
- (cons '(crisp-mode crisp-mode-modeline-string) minor-mode-alist)))
- (or (assq 'crisp-mode minor-mode-map-alist)
- (setq minor-mode-map-alist (cons (cons 'crisp-mode crisp-mode-map)
- minor-mode-map-alist))))
-
;; Interaction with other packages.
(put 'crisp-home 'CUA 'move)
(put 'crisp-end 'CUA 'move)
- [elpa] 31/56: Add 2008 to copyright years., (continued)
- [elpa] 31/56: Add 2008 to copyright years., Luke Lee, 2014/08/27
- [elpa] 33/56: Fix up comment convention on the arch-tag lines., Luke Lee, 2014/08/27
- [elpa] 30/56: Switch license to GPLv3 or later., Luke Lee, 2014/08/27
- [elpa] 34/56: Switch to recommended form of GPLv3 permissions notice., Luke Lee, 2014/08/27
- [elpa] 35/56: Add 2009 to copyright years., Luke Lee, 2014/08/27
- [elpa] 38/56: Add 2010 to copyright years., Luke Lee, 2014/08/27
- [elpa] 36/56: * keymap.c (QCadvertised_binding): New constant. (syms_of_keymap): Initialize it. (Fwhere_is_internal): Try and use bindings from :advertised-binding if applicable., Luke Lee, 2014/08/27
- [elpa] 40/56: Add 2011 to FSF/AIST copyright years., Luke Lee, 2014/08/27
- [elpa] 39/56: Remove leading `*' from docs of some defcustoms etc., Luke Lee, 2014/08/27
- [elpa] 42/56: Refill some copyright headers., Luke Lee, 2014/08/27
- [elpa] 37/56: * emulation/crisp.el (crisp-mode-map): Move initialization into declaration. (crisp-mode): Use define-minor-mode.,
Luke Lee <=
- [elpa] 41/56: Nuke arch-tags., Luke Lee, 2014/08/27
- [elpa] 47/56: Add 2012 to FSF copyright years for Emacs files, Luke Lee, 2014/08/27
- [elpa] 50/56: Replace version 24.2 with 24.3 where appropriate (hopefully), Luke Lee, 2014/08/27
- [elpa] 43/56: Convert consecutive FSF copyright years to ranges., Luke Lee, 2014/08/27
- [elpa] 49/56: Reduce use of (require 'cl). * admin/bzrmerge.el: Use cl-lib. * leim/quail/hangul.el: Don't require CL. * leim/quail/ipa.el: Use cl-lib. * vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el: * vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el: * register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el: * msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el: * international/quail.el, info-xref.el, imenu.el, image-mode.el: * font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el: * battery.el, avoid.el, abbrev.el: Use cl-lib. * vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el: * vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el: * jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el: * emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el: * calculator.el, autorevert.el, apropos.el: Don't require CL. * emacs-bytecomp.el (byte-recompile-directory, display-call-tree) (byte-compile-unfold-bcf, byte-compile-check-variable): * emacs-byte-opt.el (byte-compile-trueconstp) (byte-compile-nilconstp): * emacs-autoload.el (make-autoload): Use pcase. * face-remap.el (text-scale-adjust): Simplify pcase patterns., Luke Lee, 2014/08/27
- [elpa] 51/56: Aliases to defcustoms must come before the defcustom., Luke Lee, 2014/08/27
- [elpa] 05/56: (crisp-last-last-command): Renamed from last-last-command and defvar added., Luke Lee, 2014/08/27
- [elpa] 01/56: Initial revision, Luke Lee, 2014/08/27
- [elpa] 04/56: (crisp-load-scroll-all): Renamed from ...-lock. (crisp-mode): Use scroll-all... not scroll-lock..., Luke Lee, 2014/08/27
- [elpa] 03/56: Install the proper version., Luke Lee, 2014/08/27