summary refs log tree commit diff stats
path: root/init.el
diff options
context:
space:
mode:
authorCase Duckworth2021-08-15 22:08:25 -0500
committerCase Duckworth2021-08-15 22:08:25 -0500
commit61e81d749f4eb8102504fd9b40696d20ac64173b (patch)
treecb9b7bb411a6af9bd2d8e46821daa4fb6eb20a0e /init.el
parentMerge branch 'main' of tildegit.org:acdw/emacs (diff)
downloademacs-61e81d749f4eb8102504fd9b40696d20ac64173b.tar.gz
emacs-61e81d749f4eb8102504fd9b40696d20ac64173b.zip
Add `acdw/set-mark-or-expand-region' function and binding
A combination of `set-mark-command' and `er/expand-region' that is pretty
useful IMO.  I'm going to keep testing it and see if it's a-ok to keep using.
Diffstat (limited to 'init.el')
-rw-r--r--init.el23
1 files changed, 22 insertions, 1 deletions
diff --git a/init.el b/init.el index cbdec9a..d60915b 100644 --- a/init.el +++ b/init.el
@@ -1135,7 +1135,28 @@ if ripgrep is installed, otherwise `consult-grep'."
1135 )) 1135 ))
1136 1136
1137(setup (:straight expand-region) 1137(setup (:straight expand-region)
1138 (:global "C-=" er/expand-region)) 1138
1139 (defun acdw/set-mark-or-expand-region (arg)
1140 "Set mark at point and activate, jump to mark, or expand region.
1141See `set-mark-command' and `expand-region'.
1142
1143With no prefix argument, either run `set-mark-command' on first
1144invocation and `er/expand-region' on each successive invocation.
1145
1146With any prefix argument
1147(e.g., \\[universal-argument] \\[set-mark-command]), act as with
1148`set-mark-command' (i.e., pop the mark). Don't care about
1149successive invocations."
1150 (interactive "P")
1151 (cond
1152 (arg
1153 (setq this-command 'set-mark-command)
1154 (set-mark-command arg))
1155 ((eq last-command 'acdw/set-mark-or-expand-region)
1156 (er/expand-region 1))
1157 (t (set-mark-command arg))))
1158
1159 (:global "C-SPC" acdw/set-mark-or-expand-region))
1139 1160
1140(setup (:straight fennel-mode) 1161(setup (:straight fennel-mode)
1141 (:needs "fennel") 1162 (:needs "fennel")