summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-01-05 11:23:26 -0600
committerCase Duckworth2022-01-05 11:23:26 -0600
commit710dfe7cd5620d6bec2ddc7b776cddacf2c640a1 (patch)
tree73f43b788d589361460e36de7f0c1a998854e2c3 /lisp
parentChanges (diff)
downloademacs-710dfe7cd5620d6bec2ddc7b776cddacf2c640a1.tar.gz
emacs-710dfe7cd5620d6bec2ddc7b776cddacf2c640a1.zip
Add wrap-region and modify expand-region to match
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+expand-region.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/+expand-region.el b/lisp/+expand-region.el new file mode 100644 index 0000000..8aac3ce --- /dev/null +++ b/lisp/+expand-region.el
@@ -0,0 +1,24 @@
1;;; +expand-region.el -*- lexical-binding: t; -*-
2
3;;; Commentary:
4
5;;
6
7;;; Code:
8
9;; Because of `wrap-region', I can't use `expand-region-fast-keys-enabled'. So
10;; instead of that, I'm adding this to the binding to C--, but I also want to be
11;; able to use the negative argument. So there's this.
12(defun +er/contract-or-negative-argument (arg)
13 "Contract the region if the last command expanded it.
14Otherwise, pass the ARG as a negative argument."
15 (interactive "p")
16 (cond ((memq last-command '(er/expand-region
17 er/contract-region
18 +er/contract-or-negative-argument))
19
20 (er/contract-region arg))
21 (t (call-interactively #'negative-argument))))
22
23(provide '+expand-region)
24;;; +expand-region.el ends here