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 test for \C-w using prefix arg #646

Merged
merged 8 commits into from
Jan 19, 2025
Merged

Conversation

matsl
Copy link
Collaborator

@matsl matsl commented Jan 14, 2025

What

  • Add test for hui-kill-region
  • Refactored and simplified
  • Use prefix arg for interactive call
  • Refactor to have base behavior as kill-region
  • Fix non-interactive behavior

Why

Tests.

Note

The inspiration for using an argument for identification of
interactive call or not comes from the comment in

{C-hf called-interactively-p RET}

It says:

Instead of using this function, it is cleaner and more reliable to
give your function an extra optional argument whose ‘interactive’ spec
specifies non-nil unconditionally ("p" is a good way to do this), or
via (not (or executing-kbd-macro noninteractive)).

@matsl matsl changed the title add test for c w use prefix arg add test for \C-w using prefix arg Jan 14, 2025
@matsl matsl mentioned this pull request Jan 14, 2025
@rswgnu
Copy link
Owner

rswgnu commented Jan 18, 2025

Be sure to test for 2 kills in a row that they append as one kill properly:
case 1: kill based on matching pair at point followed by a regular C-k line kill
case 2: regular C-k line kill followed by a matching pair at point kill.

@rswgnu
Copy link
Owner

rswgnu commented Jan 18, 2025

And we'll review this when we chat.

@matsl
Copy link
Collaborator Author

matsl commented Jan 18, 2025

Be sure to test for 2 kills in a row that they append as one kill properly: case 1: kill based on matching pair at point followed by a regular C-k line kill

There is no validation of what is actually saved in the current tests so will add that in one or more separate tests I think.

case 2: regular C-k line kill followed by a matching pair at point kill.

That is an interesting case. Will take a look.

@rswgnu
Copy link
Owner

rswgnu commented Jan 18, 2025

I think the signature of our overriding kill-region command should match the signature of kill-region as best as possible as well.

@matsl
Copy link
Collaborator Author

matsl commented Jan 19, 2025

Added some tests for kill-region-type of functionality.

@rswgnu rswgnu merged commit bb7909e into master Jan 19, 2025
4 checks passed
@matsl matsl deleted the add-test-for-c-w-use-prefix-arg branch January 21, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants