region off-by-one when evil mode
I first noticed this in one of my embark-keymap-alist entries, but it's reproducible with e.g. DEL on the region. If you have evil-mode and mark a region and use embark from the minibuffer, the end of the region will be one shorter compared to what it is before you hit M-o.
Here e.g. without evil it deletes the whole word, with evil it doesn't:
where foo.el was
(add-to-list 'load-path "~/src/evil")
(add-to-list 'load-path "~/src/embark")
(require 'evil)
(require 'embark)
(evil-mode 1)
(define-key minibuffer-local-map (kbd "M-o") 'embark-act)
; now mark a word and M-o DEL
If I do (buffer-substring (region-beginning) (region-end)) with the word marked, I do get the whole "word", while if I define my own embark-keymap-alist action and (message "%S" (buffer-substring (region-beginning) (region-end))) in there I see only "wor".
This is on
- embark https://github.com/oantolin/embark/commit/5bad2fd6b56344b42a46a71bb5bd5def01610c70
- https://github.com/emacs-evil/evil/commit/3e41a823334abbba9cf16e482855699054d9dfe0
- https://github.com/emacs-mirror/emacs/commit/f0ac4b7797fb16833a7a0c49593f36d88c69d2d5
I could not reproduce this with that version of Embark and Evil 1.1.4.0 (which I got from MELPA). I tried 6 different combinations:
Three ways of marking the word: (1) using M-@, (2) using visual state: ve, (3) double-clicking with the mouse (which I think is what you did in the gif).
Two ways of deleting the region: (1) C-. DEL, (2) M-x C-. DEL (which I think is what you did in the gif). (Here C-. is the key bindings for embark-act.)
All 6 combinations deleted the word correctly.
Well that is odd. (For me, it doesn't seem to matter how I mark the word). I'll try some different emacses, maybe the bug isn't in embark/evil at all :O
Did you remove a comment saying the bug did not appear with Evil 1.14.0? Does that mean you can reproduce it with 1.14.0?
yes and no, sorry for the noise. I first thought I could, but then I noticed that even though I can evil-mode 1 with 1.14.0, the require 'evil actually fails (because of use of a deprecated form in evil-ex.el). So if I only partially load evil-mode, it works great! But if I remove that deprecated form (a define-obsolete-function-alias with just 2 args) so that evil fully loads, I can reproduce with 1.14.0.
With emacs 27.2, the require evil goes through and I can reproduce in evil 1.14.0.
@oantolin you don't get any errors on (require 'evil)?
It's fixed if I
diff --git a/evil-types.el b/evil-types.el
index c23fd59..9cdcf29 100644
--- a/evil-types.el
+++ b/evil-types.el
@@ -88,7 +88,7 @@ If the end position is at the beginning of a line, then:
(format "%s character%s" width
(if (= width 1) "" "s")))))
-(evil-define-type inclusive
+(evil-define-type inclusiveremoved
"Include the character under point.
If the end position is at the beginning of a line or the end of a
line and `evil-want-visual-char-semi-exclusive', then:
but I don't know evil enough to know what that means
I don't know enough about evil to know exactly what this means either.