diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-06-01 11:18:43 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-06-01 11:18:43 -0700 |
commit | e76082a2bed8d533988281555e1b2f1da500538b (patch) | |
tree | 29714c3529fbbf2f7fb8f1d470fbd556c1061521 | |
parent | 322865563df37fc62f89f1fbd913e342859907d8 (diff) | |
download | dotfiles-e76082a2bed8d533988281555e1b2f1da500538b.tar.gz |
also bind a key simply to activate the mark
-rw-r--r-- | .emacs.d/init-spw.el | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el index 0ca7f30b..1b545686 100644 --- a/.emacs.d/init-spw.el +++ b/.emacs.d/init-spw.el @@ -175,7 +175,24 @@ add places the library might be available to `load-path'." (beginning-of-line) (set-mark (save-excursion (goto-char (mark)) (beginning-of-line 2) (point))) (activate-mark transient-mark-mode)) -(global-set-key "\M-=" #'spw/expand-region-to-whole-lines-and-activate) +(global-set-key "\M-+" #'spw/expand-region-to-whole-lines-and-activate) + +;; Also bind a key simply to (re-)activate the mark which does not +;; involve moving point, as `exchange-point-and-mark' does. This is +;; useful if you use isearch to select a region but realise only after +;; you've left the intended start of the region that you need to do a +;; second isearch to extend it far enough: e.g. C-s first M-= second RET +;; +;; Activating the region prevents the second isearch from resetting +;; the mark. Having this binding removes the need to activate the +;; region before entering the first isearch, which is useful both with +;; and without `transient-mark-mode'. +(defun spw/activate-mark (&rest ignore) + (interactive) + (activate-mark)) +(global-set-key "\M-=" #'spw/activate-mark) +(with-eval-after-load 'notmuch-show + (define-key notmuch-show-mode-map "\M-=" nil)) ;; ... and resettle the former occupant of M-= (isearch replaces ;; `move-to-window-line-top-bottom', so we can help ourselves to M-r) |