evil icon indicating copy to clipboard operation
evil copied to clipboard

point/region-end off-by-one in embark actions when evil-mode

Open unhammer opened this issue 2 years ago • 0 comments

  • Question, possibly bug (not sure if it's here or in embark)

Environment

Emacs version: 29.0.50, but also reproduced with 27.2 Operating System: xubuntu 20.04 Evil version: 3e41a823334abbba9cf16e482855699054d9dfe0, but also reproduced with 1.14.0 on emacs 27.2 Evil installation type: git clone Graphical/Terminal: X Tested in a make emacs session: Yes

Reproduction steps

Clone embark and evil, make emacs, then load this file

(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-x M-o DEL, and it only deletes "wor", not "word".

Expected behavior

Deletes "word"

Actual behavior

Deletes "wor"

Further notes

DEL is just an example, (point) / (region-end) is off by one for any command run by embark, e.g. try

(defun msg () 
  (interactive)
  (message "%S" (list (buffer-substring-no-properties (region-beginning)(region-end))
                      (region-beginning)
                      (region-end)

and M-x msg M-o RET.

If I remove define-type 'inclusive from evil-types, I get the expected behaviour, but that probably messes up other things :)

Originally reported at https://github.com/oantolin/embark/issues/478

unhammer avatar Mar 26 '22 07:03 unhammer