-
Notifications
You must be signed in to change notification settings - Fork 281
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
Setting registers is more in line with VIM #1049
base: master
Are you sure you want to change the base?
Conversation
evil-common.el
Outdated
;; Handle 1-9 registers when deleting | ||
;; http://vimdoc.sourceforge.net/htmldoc/change.html#registers | ||
(when (and evil-is-yank-and-delete (not (eq register ?_))) | ||
(let ((special-delete-motions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be put into a customizable variable, so that other packages can add their own things to it.
This looks pretty good, thanks! Regarding breakage, I've done a quick search and it seems that other than people vendoring their packages (which is totally fine), the rest seems to have copy-pasted the yank commands. They'll have to update them to make use of your code. Nothing much we can do about that. |
An update on this, mainly I've tried to get the behavior as close to Vim's as possible. I think it is essentially identical now.
|
11204f7
to
9785acb
Compare
Force pushed to squash all of the WIP commits. |
@wasamasa do you think we can merge this ? This is a common issue with new Evil users coming from Vim. |
@DZoP Thank you for such a great PR. There is a core dump with Emacs 26.1 in Travis. Which version of Emacs are you using ? |
I think @wasamasa has withdrawn from active participation. I'll see if I can devote some time to this, and other PRs. |
9785acb
to
cf1819b
Compare
I'm using
but I think the issue is related to #945, running |
Friendly bump. I've been using this change without issue for a long time now, but I think before it gets merged I should address the removal of the Maybe it would be better to keep that variable around for compataility... |
@DZoP @TheBB What's the status on this? It would be nice to see this get merged at some point.
The author of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are good changes, and it would be nice to get it merged. (It is unfortunate that text deleted by delete or change commands cannot use the regular kill-ring
instead of evil-delete-kill-ring
, with ""
being the special register. After all, it is kill-ring
and not copy-ring
, and you would then remain able to access text yanked from Emacs commands using the registers "1
through "9
. But I understand that would complicate all paste commands.)
The docstrings could also perhaps be made a bit more understandable.
Bring it back. But don't use it. Should be removed in a future commit.
This adheres to the Vim documentation which states Writing to the "" register writes to register "0. See `:help registers`.
The setting of registers is now handled by the eventual call to `evil-kill-new` when calling `evil-yank`.
cf1819b
to
1bc0af2
Compare
Some of the tests assumed that the delete registers 1-9 store yanked text, this is no longer the case. Those registers now store only deleted text.
1bc0af2
to
45f3ffe
Compare
I've re-worked the documentation and addressed the issues that you mentioned. Please give this another look. I did have to fix some tests that relied on the current behavior of the 1-9 registers. I'm thinking that people may already be used to how those registers worked before this change in that they stored yanked as well as deleted text. Perhaps there should be an option to revert back to the old behavior of those registers before this change? This would also address your concern about using the 1-9 registers to access text yanked by other Emacs commands. |
This fixes the odd behavior of the yank register (0) and delete registers (1-9) described in #864 and makes their behavior identical to Vim. The following changes were made:
evil-delete-kill-ring
, which stores the text for the delete registers.evil-was-yanked-without-register
evil-is-yank-and-delete
which distinguishes between commands that yankand delete text vs commands that just yank text.
evil-set-register-on-yank
which replaces the register setting logic in the yankfunctions.
I tried to figure out how I could keep the
evil-was-yanked-without-register
variable without changing its meaning since I know removing it will break other packages, but it couldn't be done. It was also being used in a confusing way, mainly only to prevent the setting of the yank register inevil-delete
.