From da4ae81c4bddda519c700236e1da19149d5e4f66 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 25 Sep 2013 13:09:05 -0700 Subject: [PATCH] Add no-easy-keys. --- .../no-easy-keys-autoloads.el | 18 +++++ elpa/no-easy-keys-1.0.2/no-easy-keys-pkg.el | 1 + elpa/no-easy-keys-1.0.2/no-easy-keys.el | 77 +++++++++++++++++++ init.el | 33 +++----- 4 files changed, 105 insertions(+), 24 deletions(-) create mode 100644 elpa/no-easy-keys-1.0.2/no-easy-keys-autoloads.el create mode 100644 elpa/no-easy-keys-1.0.2/no-easy-keys-pkg.el create mode 100644 elpa/no-easy-keys-1.0.2/no-easy-keys.el diff --git a/elpa/no-easy-keys-1.0.2/no-easy-keys-autoloads.el b/elpa/no-easy-keys-1.0.2/no-easy-keys-autoloads.el new file mode 100644 index 00000000..4f1fa99f --- /dev/null +++ b/elpa/no-easy-keys-1.0.2/no-easy-keys-autoloads.el @@ -0,0 +1,18 @@ +;;; no-easy-keys-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + + +;;;### (autoloads nil nil ("no-easy-keys-pkg.el" "no-easy-keys.el") +;;;;;; (21059 16366 939830)) + +;;;*** + +(provide 'no-easy-keys-autoloads) +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; no-easy-keys-autoloads.el ends here diff --git a/elpa/no-easy-keys-1.0.2/no-easy-keys-pkg.el b/elpa/no-easy-keys-1.0.2/no-easy-keys-pkg.el new file mode 100644 index 00000000..0fbb3439 --- /dev/null +++ b/elpa/no-easy-keys-1.0.2/no-easy-keys-pkg.el @@ -0,0 +1 @@ +(define-package "no-easy-keys" "1.0.2" "Learn the proper Emacs movement keys" (quote nil)) diff --git a/elpa/no-easy-keys-1.0.2/no-easy-keys.el b/elpa/no-easy-keys-1.0.2/no-easy-keys.el new file mode 100644 index 00000000..26630164 --- /dev/null +++ b/elpa/no-easy-keys-1.0.2/no-easy-keys.el @@ -0,0 +1,77 @@ +;;; no-easy-keys.el --- Learn the proper Emacs movement keys + +;; Copyright (C) 2009-2012 Dan Amlund Thomsen + +;; Author: Dan Amlund Thomsen +;; URL: http://danamlund.dk/emacs/no-easy-keys.html +;; Version: 1.0.2 +;; Created: 2009-12-12 +;; By: Dan Amlund Thomsen +;; Keywords: training, pinky + +;;; Commentary: + +;; This mode teaches you to use the proper Emacs movement keys in a +;; rather harsh manner. + +;; No-easy-keys disables arrow, end, home and delete keys, as well as +;; their control and meta prefixes. When using any of these keys, you +;; instead get a message informing you of the proper Emacs shortcut +;; you should use instead (e.g. pressing down informs you to use C-n). + +;; The easy keys are not disabled in the minibuffer. The minibuffer +;; has different proper keys replacements than regular buffers and +;; depending on various extensions such as icicles, ido, etc. + +;; To install, save no-easy-keys.el in your load path and add the +;; following to your .emacs file: +;; +;; (require 'no-easy-keys) +;; (no-easy-keys 1) + +;; You can toggle no-easy-keys using 'M-x no-easy-keys'. + +;;; Code: + +(defvar no-easy-keys-minor-mode-map (make-keymap) + "no-easy-keys-minor-mode keymap.") + +(let ((f (lambda (m) + `(lambda () (interactive) + (message (concat "No! use " ,m " instead.")))))) + (dolist (l '(("" . "C-b") ("" . "C-f") ("" . "C-p") + ("" . "C-n") + ("" . "M-b") ("" . "M-f") ("" . "M-{") + ("" . "M-}") + ("" . "M-b") ("" . "M-f") ("" . "M-{") + ("" . "M-}") + ("" . "C-d") ("" . "M-d") + ("" . "M-d") ("" . "C-v") ("" . "M-x <") + ("" . "M-v") ("" . "M-x >") + ("" . "C-a") ("" . "M->") + ("" . "M-<") ("" . "C-e") ("" . "M->"))) + (define-key no-easy-keys-minor-mode-map + (read-kbd-macro (car l)) (funcall f (cdr l))))) + +(define-minor-mode no-easy-keys-minor-mode + "A minor mode that disables the arrow-keys, pg-up/down, delete +and backspace. + +Use 'M-x no-easy-keys' to toggle this mode in all buffers except +the minibuffer. + +Add (no-easy-keys 1) to your .emacs to enable no-easy-keys by +default." + +nil nil 'no-easy-keys-minor-mode-map) + +(defun no-easy-keys-hook () + (interactive) + (unless (minibufferp) + (no-easy-keys-minor-mode 1))) + +(define-globalized-minor-mode no-easy-keys + no-easy-keys-minor-mode no-easy-keys-hook) + +(provide 'no-easy-keys) +;;; no-easy-keys.el ends here diff --git a/init.el b/init.el index 761aa5f0..6d17b611 100644 --- a/init.el +++ b/init.el @@ -52,6 +52,10 @@ (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil) +;; Don't allow arrow keys +(require 'no-easy-keys) +(no-easy-keys 1) + ;; Change the behavior of M- so that it stops on underscores. (defun change-major-mode-hook () (modify-syntax-entry ?_ "_")) (setq c-subword-mode t) @@ -122,10 +126,10 @@ ;; ============================================================================= ;; Fast cursor movement in vertical direction with Meta. -(global-set-key (kbd "M-") (lambda () (interactive) (next-line 5))) -(global-set-key (kbd "M-") (lambda () (interactive) (previous-line 5))) -(global-set-key (kbd "ESC ") (lambda () (interactive) (next-line 5))) -(global-set-key (kbd "ESC ") (lambda () (interactive) (previous-line 5))) +(global-set-key (kbd "M-n") (lambda () (interactive) (next-line 5))) +(global-set-key (kbd "M-p") (lambda () (interactive) (previous-line 5))) +(global-set-key (kbd "ESC n") (lambda () (interactive) (next-line 5))) +(global-set-key (kbd "ESC p") (lambda () (interactive) (previous-line 5))) ;; Macros (fset 'ipdb "import ipdb; ipdb.set_trace()") @@ -135,8 +139,7 @@ (global-set-key "\C-xw" 'whitespace-mode) (global-set-key "\C-cw" 'tmux-copy) (global-set-key "\C-x\C-r" (lambda () (interactive) (revert-buffer t t))) -(global-set-key "\C-x\C-i" 'increase-left-margin) -(global-set-key "\C-x\C-d" 'decrease-left-margin) +(global-set-key "\M-g" 'goto-line) (global-set-key "\C-c\C-c" 'comment-region) (global-set-key "\C-ct" 'testify-run-test) (global-set-key "\C-c\C-o" 'testify-run-case) @@ -240,21 +243,3 @@ ;; ============================================================================= ;; Customize ;; ============================================================================= -<<<<<<< HEAD -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(ansi-color-names-vector ["black" "red" "green" "yellow" "blue" "magenta" "cyan" "yellow"]) - '(ansi-term-color-vector ["#3f3f3f" "#cc9393" "#7f9f7f" "#f0dfaf" "#8cd0d3" "#dc8cc3" "#93e0e3" "#dcdccc"]) - '(background-color nil) - '(background-mode dark) - '(cursor-color nil) - '(custom-safe-themes (quote ("36a309985a0f9ed1a0c3a69625802f87dee940767c9e200b89cdebdb737e5b29" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" default))) - '(fci-rule-color "#383838") - '(foreground-color nil)) -======= - - ->>>>>>> origin/yelp