Skip to content

Fix god-mode-upper-p's use of god-mode-alist#116

Merged
darth10 merged 2 commits intoemacsorphanage:masterfrom
acowley:patch-1
Jul 4, 2020
Merged

Fix god-mode-upper-p's use of god-mode-alist#116
darth10 merged 2 commits intoemacsorphanage:masterfrom
acowley:patch-1

Conversation

@acowley
Copy link
Contributor

@acowley acowley commented Jul 3, 2020

The relatively recent change to remove hard-coding the ?G character broke handling of that character. It impacted me because if I set mark, then moved point forward by a word, and then moved point forward by a sexp using G f, mark would be reset to the location of point when I issued the G f command.

For example, say you have the string "Here we go" in a buffer. Put point before the word "Here", then, in god-mode, hit space to activate mark, then hit "g f" to move point forward by a word. The region will cover the word "Here". If you then hit "G f", the region will move forward but no longer include include the word "Here".

Looking at the code, there is a problem because the keys of god-mode-alist are strings while key in god-mode-upper-p is a character. We could either make the change I have made here, or make the keys of god-mode-alist characters.

The relatively recent change to remove hard-coding the `?G` character broke handling of that character. It impacted me because if I set mark, then moved point forward by a word, and then moved point forward by a sexp using `G f`, mark would be reset to the location of point when I issued the `G f` command.

For example, say you have the string "Here we go" in a buffer. Put point before the word "Here", then, in `god-mode`, hit space to activate mark, then hit "g f" to move point forward by a word. The region will cover the word "Here". If you then hit "G f", the region will move forward but no longer include include the word "Here".

Looking at the code, there is a problem because the keys of `god-mode-alist` are strings while `key` in `god-mode-upper-p` is a character. We could either make the change I have made here, or make the keys of `god-mode-alist` characters.
@darth10 darth10 added the bug label Jul 3, 2020
@darth10
Copy link
Collaborator

darth10 commented Jul 3, 2020

Thanks for the contribution @acowley!

The changes look good after a quick test.
Would it be possible for you to add a few tests to validate this behaviour?

@acowley
Copy link
Contributor Author

acowley commented Jul 4, 2020

I have added a test implementing the scenario I described in the original commit message.

@darth10
Copy link
Collaborator

darth10 commented Jul 4, 2020

Thanks again @acowley!

@darth10 darth10 merged commit dc6bab5 into emacsorphanage:master Jul 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants