├── README.md └── hardcore-mode.el /README.md: -------------------------------------------------------------------------------- 1 | # hardcore-mode.el 2 | 3 | Entering hardcore-mode will disable arrow keys, backspace and return. 4 | 5 | * Use C-f/b/p/n instead of right/left/up/down 6 | * Use C-h instead of backspace 7 | * Use C-m or C-j instead of return 8 | 9 | To use C-h instead of backspace, you might need to redefine C-h: 10 | 11 | ;; Use shell-like backspace C-h, rebind help to F1 12 | (define-key key-translation-map [?\C-h] [?\C-?]) 13 | (global-set-key (kbd "") 'help-command) 14 | 15 | If hardcore-mode is too hardcore for you, you can add these before 16 | you require the mode: 17 | 18 | (setq too-hardcore-backspace t) 19 | (setq too-hardcore-return t) 20 | (require 'hardcore-mode) 21 | (global-hardcore-mode) 22 | 23 | These are the settings I am using at the time. Still not hardcore enough. ^^ 24 | 25 | ## License 26 | 27 | Copyright (C) 2011 Magnar Sveen 28 | 29 | Author: Magnar Sveen 30 | Keywords: marking region 31 | 32 | This program is free software; you can redistribute it and/or modify 33 | it under the terms of the GNU General Public License as published by 34 | the Free Software Foundation, either version 3 of the License, or 35 | (at your option) any later version. 36 | 37 | This program is distributed in the hope that it will be useful, 38 | but WITHOUT ANY WARRANTY; without even the implied warranty of 39 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 40 | GNU General Public License for more details. 41 | 42 | You should have received a copy of the GNU General Public License 43 | along with this program. If not, see . 44 | -------------------------------------------------------------------------------- /hardcore-mode.el: -------------------------------------------------------------------------------- 1 | ;;; hardcore-mode.el --- Disable arrow keys + optionally backspace and return 2 | 3 | ;; Copyright (C) 2011 Magnar Sveen 4 | 5 | ;; Author: Magnar Sveen 6 | ;; Version: 0.1.0 7 | 8 | ;; This program is free software; you can redistribute it and/or modify 9 | ;; it under the terms of the GNU General Public License as published by 10 | ;; the Free Software Foundation, either version 3 of the License, or 11 | ;; (at your option) any later version. 12 | 13 | ;; This program is distributed in the hope that it will be useful, 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | ;; GNU General Public License for more details. 17 | 18 | ;; You should have received a copy of the GNU General Public License 19 | ;; along with this program. If not, see . 20 | 21 | ;;; Commentary: 22 | 23 | ;; Entering hardcore-mode will disable arrow keys, backspace and return. 24 | 25 | ;; * Use C-f/b/p/n instead of right/left/up/down 26 | ;; * Use C-h instead of backspace 27 | ;; * Use C-m or C-j instead of return 28 | 29 | ;; To use C-h instead of backspace, you might need to redefine C-h: 30 | ;; 31 | ;; ;; Use shell-like backspace C-h, rebind help to F1 32 | ;; (define-key key-translation-map [?\C-h] [?\C-?]) 33 | ;; (global-set-key (kbd "") 'help-command) 34 | 35 | ;; If hardcore-mode is too hardcore for you, you can add these before 36 | ;; you require the mode: 37 | ;; 38 | ;; (setq too-hardcore-backspace t) 39 | ;; (setq too-hardcore-return t) 40 | ;; (require 'hardcore-mode) 41 | ;; (global-hardcore-mode) 42 | ;; 43 | ;; These are the settings I am using at the time. Still not hardcore enough. ^^ 44 | 45 | ;; Code: 46 | 47 | (defgroup hardcore-mode nil 48 | "Disable arrow keys + optionally backspace and return." 49 | :group 'keyboard) 50 | 51 | (defcustom too-hardcore-backspace nil 52 | "On non-nil value, don't disable backspace in hardcore mode.") 53 | 54 | (defcustom too-hardcore-return nil 55 | "On non-nil value, don't disable return in hardcore mode.") 56 | 57 | (defvar hardcore-mode-map nil 58 | "Keymap for hardcore emacs minor mode.") 59 | 60 | (if hardcore-mode-map 61 | nil 62 | (setq hardcore-mode-map (make-sparse-keymap)) 63 | (define-key hardcore-mode-map 64 | (kbd "") (lambda () 65 | (interactive) 66 | (message "Arrow key navigation is disabled. Use C-p instead."))) 67 | (define-key hardcore-mode-map 68 | (kbd "") (lambda () 69 | (interactive) 70 | (message "Arrow key navigation is disabled. Use C-n instead."))) 71 | (define-key hardcore-mode-map 72 | (kbd "") (lambda () 73 | (interactive) 74 | (message "Arrow key navigation is disabled. Use C-b instead."))) 75 | (define-key hardcore-mode-map 76 | (kbd "") (lambda () 77 | (interactive) 78 | (message "Arrow key navigation is disabled. Use C-f instead."))) 79 | (unless too-hardcore-backspace 80 | (define-key hardcore-mode-map 81 | (kbd "") (lambda () 82 | (interactive) 83 | (message "Backspace is disabled. Use C-h instead.")))) 84 | (unless too-hardcore-return 85 | (define-key hardcore-mode-map 86 | (kbd "") (lambda () 87 | (interactive) 88 | (message "Return is disabled. Use C-m or C-j instead."))))) 89 | 90 | ;;;###autoload 91 | (define-minor-mode hardcore-mode 92 | "Hardcore emacs minor mode." 93 | nil " hc" hardcore-mode-map) 94 | 95 | ;;;###autoload 96 | (define-globalized-minor-mode global-hardcore-mode 97 | hardcore-mode hardcore-mode) 98 | 99 | (provide 'hardcore-mode) 100 | ;;; hardcore-mode.el ends here 101 | --------------------------------------------------------------------------------