expand-region-custom.el (4117B)
1 ;;; expand-region-custom.el --- Increase selected region by semantic units. -*- lexical-binding: t; -*- 2 3 ;; Copyright (C) 2012-2023 Free Software Foundation, Inc 4 5 ;; Author: Magnar Sveen <magnars@gmail.com> 6 ;; Keywords: marking region 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 <http://www.gnu.org/licenses/>. 20 21 ;;; Commentary: 22 23 ;; This file holds customization variables. 24 25 ;;; Code: 26 27 ;;;###autoload 28 (defgroup expand-region nil 29 "Increase selected region by semantic units." 30 :group 'tools) 31 32 ;;;###autoload 33 (defcustom expand-region-preferred-python-mode 'python 34 "The name of your preferred python mode" 35 :type '(choice (const :tag "Emacs' python.el" python) 36 (const :tag "fgallina's python.el" fgallina-python) 37 (const :tag "python-mode.el" python-mode))) 38 39 ;;;###autoload 40 (defcustom expand-region-guess-python-mode t 41 "If expand-region should attempt to guess your preferred python mode" 42 :type '(choice (const :tag "Guess" t) 43 (const :tag "Do not guess" nil))) 44 45 (defun expand-region-guess-python-mode () 46 "Guess the user's preferred python mode." 47 (setq expand-region-preferred-python-mode 48 (if (fboundp 'python-setup-brm) 49 'python 50 'fgallina-python))) 51 52 ;;;###autoload 53 (defcustom expand-region-autocopy-register "" 54 "If set to a string of a single character (try \"e\"), then the 55 contents of the most recent expand or contract command will 56 always be copied to the register named after that character." 57 :type 'string) 58 59 ;;;###autoload 60 (defcustom expand-region-skip-whitespace t 61 "If expand-region should skip past whitespace on initial expansion" 62 :type '(choice (const :tag "Skip whitespace" t) 63 (const :tag "Do not skip whitespace" nil))) 64 65 ;;;###autoload 66 (defcustom expand-region-fast-keys-enabled t 67 "If expand-region should bind fast keys after initial expand/contract" 68 :type '(choice (const :tag "Enable fast keys" t) 69 (const :tag "Disable fast keys" nil))) 70 71 ;;;###autoload 72 (defcustom expand-region-contract-fast-key "-" 73 "Key to use after an initial expand/contract to contract once more." 74 :type 'string) 75 76 ;;;###autoload 77 (defcustom expand-region-reset-fast-key "0" 78 "Key to use after an initial expand/contract to undo." 79 :type 'string) 80 81 ;;;###autoload 82 (defcustom expand-region-exclude-text-mode-expansions 83 '(html-mode nxml-mode) 84 "List of modes which derive from `text-mode' for which text mode expansions are not appropriate." 85 :type '(repeat (symbol :tag "Major Mode" unknown))) 86 87 ;;;###autoload 88 (defcustom expand-region-smart-cursor nil 89 "Defines whether the cursor should be placed intelligently after expansion. 90 91 If set to t, and the cursor is already at the beginning of the new region, 92 keep it there; otherwise, put it at the end of the region. 93 94 If set to nil, always place the cursor at the beginning of the region." 95 :type '(choice (const :tag "Smart behaviour" t) 96 (const :tag "Standard behaviour" nil))) 97 98 ;;;###autoload 99 (define-obsolete-variable-alias 'er/enable-subword-mode? 100 'expand-region-subword-enabled "2019-03-23") 101 102 ;;;###autoload 103 (defcustom expand-region-subword-enabled nil 104 "Whether expand-region should use subword expansions." 105 :type '(choice (const :tag "Enable subword expansions" t) 106 (const :tag "Disable subword expansions" nil))) 107 108 (defcustom expand-region-show-usage-message t 109 "Whether expand-region should show usage message." 110 :group 'expand-region 111 :type 'boolean) 112 113 (provide 'expand-region-custom) 114 115 ;;; expand-region-custom.el ends here