dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

expand-region-custom.el (4189B)


      1 ;;; expand-region-custom.el --- Increase selected region by semantic units.
      2 
      3 ;; Copyright (C) 2012-2020  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   :group 'expand-region
     36   :type '(choice (const :tag "Emacs' python.el" 'python)
     37                  (const :tag "fgallina's python.el" 'fgallina-python)
     38                  (const :tag "python-mode.el" 'python-mode)))
     39 
     40 ;;;###autoload
     41 (defcustom expand-region-guess-python-mode t
     42   "If expand-region should attempt to guess your preferred python mode"
     43   :group 'expand-region
     44   :type '(choice (const :tag "Guess" t)
     45                  (const :tag "Do not guess" nil)))
     46 
     47 (defun expand-region-guess-python-mode ()
     48   "Guess the user's preferred python mode."
     49   (setq expand-region-preferred-python-mode
     50         (if (fboundp 'python-setup-brm)
     51             'python
     52           'fgallina-python)))
     53 
     54 ;;;###autoload
     55 (defcustom expand-region-autocopy-register ""
     56   "If set to a string of a single character (try \"e\"), then the
     57 contents of the most recent expand or contract command will
     58 always be copied to the register named after that character."
     59   :group 'expand-region
     60   :type 'string)
     61 
     62 ;;;###autoload
     63 (defcustom expand-region-skip-whitespace t
     64   "If expand-region should skip past whitespace on initial expansion"
     65   :group 'expand-region
     66   :type '(choice (const :tag "Skip whitespace" t)
     67                  (const :tag "Do not skip whitespace" nil)))
     68 
     69 ;;;###autoload
     70 (defcustom expand-region-fast-keys-enabled t
     71   "If expand-region should bind fast keys after initial expand/contract"
     72   :group 'expand-region
     73   :type '(choice (const :tag "Enable fast keys" t)
     74                  (const :tag "Disable fast keys" nil)))
     75 
     76 ;;;###autoload
     77 (defcustom expand-region-contract-fast-key "-"
     78   "Key to use after an initial expand/contract to contract once more."
     79   :group 'expand-region
     80   :type 'string)
     81 
     82 ;;;###autoload
     83 (defcustom expand-region-reset-fast-key "0"
     84   "Key to use after an initial expand/contract to undo."
     85   :group 'expand-region
     86   :type 'string)
     87 
     88 ;;;###autoload
     89 (defcustom expand-region-exclude-text-mode-expansions
     90   '(html-mode nxml-mode)
     91   "List of modes which derive from `text-mode' for which text mode expansions are not appropriate."
     92   :group 'expand-region
     93   :type '(repeat (symbol :tag "Major Mode" unknown)))
     94 
     95 ;;;###autoload
     96 (defcustom expand-region-smart-cursor nil
     97   "Defines whether the cursor should be placed intelligently after expansion.
     98 
     99 If set to t, and the cursor is already at the beginning of the new region,
    100 keep it there; otherwise, put it at the end of the region.
    101 
    102 If set to nil, always place the cursor at the beginning of the region."
    103   :group 'expand-region
    104   :type '(choice (const :tag "Smart behaviour" t)
    105                  (const :tag "Standard behaviour" nil)))
    106 
    107 ;;;###autoload
    108 (define-obsolete-variable-alias 'er/enable-subword-mode?
    109   'expand-region-subword-enabled "2019-03-23")
    110 
    111 ;;;###autoload
    112 (defcustom expand-region-subword-enabled nil
    113   "Whether expand-region should use subword expansions."
    114   :group 'expand-region
    115   :type '(choice (const :tag "Enable subword expansions" t)
    116                  (const :tag "Disable subword expansions" nil)))
    117 
    118 (provide 'expand-region-custom)
    119 
    120 ;;; expand-region-custom.el ends here