-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Target highlight #279
Target highlight #279
Conversation
This changes makes the API slightly more uniform and we can reuse the tofu function in embark-consult. I don't expect breakage from this change.
* They are an implementation detail, like the setup hooks * The Consult transformers are already private
007abb8
to
def2bf8
Compare
Mind? Are you kidding? On the contrary, I'm very grateful! This is great stuff. |
Thanks ❤️ |
Expanding where the sexp and defun targets match broke all the actions. :( |
Uh right, the primitive movement to the beginning does not work anymore. What about using the target finder itself to find the boundaries, now that the finder returns them? |
The defun map should also not inhert the expression map anymore I guess. Or alternatively the map should still inherit but the expression finder should not find a target when the defun finder matches (EDIT: You already did this, I didn't notice when I wrote this comment). I have to think a bit about this. |
If we expose the bounds, say put them in an |
Sounds like a good and simple idea. Otherwise the action would not know which finder to call. And since we have the information readily available, this sounds about right. |
I'll add the variable. I don't like adding variables, but it's probably worth it for this. |
Me too. But I think this sounds right. This may even bring us a step closer to unifying the region actions too. |
The embark--target-bounds variable is basically the means to inject boundaries into an action. We have been lacking this. It is not pretty, but there is probably no reasonable alternative. If there is the "r" interactive specification, we could pass the region arguments directly. But I am not fond of complicating the Embark calling convention. |
OK, I added the variable and fixed the sexp actions. 478ffcc Now we just need to decide what the right level of generality is for those actions. I guess I could move them to the general map now. What do you think? |
I mean, not raise, but indent, kill and mark could use the region functions and operate on any target. |
Right, now the indent/kill/mark are more general. But having it in the general map is not a good idea because it does not work in the minibuffer. Now I would like to have some automatic keymap derivation mechanism again. Hmm. Maybe introduce an embark-bounds-map which contains these actions which require target bounds. When acting at point and if the action keymap derives from the general map also merge in the embark-bounds-map automatically, such that the inheritance is action-keymap>bounds-map>general-map. Then the question is if the embark-bounds-map could ultimately be the same as the embark-region-map. |
Okay, it should be like I described above, but embark-region-map/=embark-bounds-map. But the region finder should also return the boundaries of the region, and the region-map should inherit from the new bounds-map, since the bounds-map is more general. |
I was thinking that maybe if the action name ends in |
I've also considered adjusting the region, but it does not seem like a good idea. I also don't like the magic of checking if the action name ends with We could also call the bounds map |
|
You know, we could also just leave things as they are for a bit. I don't think I've ever really wanted to indent the region consisting of the file name at point. 😉 Maybe only kill would really be useful to generalize. |
I agree. But it would work in principle and it would unify things. At the same time it wouldn't make much sense, since marking the region again is nonsense 😆
Okay, I agree. Better than reintroducing the auto inheritance mess again. We will regret it later. |
By the way, the commands in the region map that also prompt at the minibuffer, and which therefore wouldn't work with a string target, seem to be only three: |
I hope you don't mind me throwing another PR at you. I am a big fan of the universal Embark at point functionality! Addresses #269 partially. Some of the finders must still be overhauled, but this is also due to #278/#92.
EDIT: I think all the at point target finders work properly with highlighting now. I also deprioritized and broadened the sexp and defun finders.