Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add keep-active-mark property to states #1821

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions evil-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,8 @@ the local keymap will be `evil-test-state-local-map', and so on.
(modes (intern (format "%s-modes" toggle)))
(predicate (intern (format "%s-p" toggle)))
arg cursor-value enable entry-hook-value exit-hook-value
input-method key message-value suppress-keymap tag-value)
input-method key message-value suppress-keymap tag-value
keep-active-mark)
;; collect keywords
(while (keywordp (car-safe body))
(setq key (pop body)
Expand All @@ -1193,7 +1194,9 @@ the local keymap will be `evil-test-state-local-map', and so on.
((eq key :input-method)
(setq input-method arg))
((eq key :suppress-keymap)
(setq suppress-keymap arg))))
(setq suppress-keymap arg))
((eq key :keep-active-mark)
(setq keep-active-mark arg))))

;; macro expansion
`(progn
Expand Down Expand Up @@ -1235,7 +1238,8 @@ cursor, or a list of the above." name))
,(format "Modes that should come up in %s." name))
:input-method ',input-method
:predicate ',predicate
:enable ',enable)))
:enable ',enable
:keep-active-mark ',keep-active-mark)))
(evil--add-to-alist evil-state-properties ',state plist))

,@(when suppress-keymap
Expand Down
9 changes: 5 additions & 4 deletions evil-states.el
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ commands opening a new line."
:entry-hook (evil-start-track-last-insertion)
:exit-hook (evil-cleanup-insert-state evil-stop-track-last-insertion)
:input-method t
:keep-active-mark t
(cond
((evil-insert-state-p)
(add-hook 'post-command-hook #'evil-maybe-remove-spaces)
Expand Down Expand Up @@ -278,6 +279,7 @@ the selection is enabled.
:tag 'evil-visual-tag
:enable (motion normal)
:message 'evil-visual-message
:keep-active-mark t
(cond
((evil-visual-state-p)
(evil-save-transient-mark-mode)
Expand Down Expand Up @@ -384,9 +386,7 @@ otherwise exit Visual state."
(evil-delay nil
;; the activation may only be momentary, so re-check
;; in `post-command-hook' before entering Visual state
'(unless (or (evil-visual-state-p)
(evil-insert-state-p)
(evil-emacs-state-p))
'(unless (evil-state-property evil-state :keep-active-mark)
(when (and (region-active-p)
(not deactivate-mark))
(evil-visual-state)))
Expand Down Expand Up @@ -909,7 +909,8 @@ Decrement recorded position by optional offset, or 0."
:tag " <E> "
:message "-- EMACS --"
:input-method t
:intercept-esc nil)
:intercept-esc nil
:keep-active-mark t)

(provide 'evil-states)

Expand Down