-
-
Notifications
You must be signed in to change notification settings - Fork 338
Description
https://github.com/abo-abo/swiper/blob/0e62f0d1f61b825ca5eb4b55e47ecb37b3e2834e/counsel.el#L5379+
I've noticed this recently when trying to use compile targets not in the generated list. We fall-over because we look for the cmd property and unless the new target is exactly the same length it will get it wrong. I've thought of something like the following:
(if (get-char-property 0 'cmd cmd)
(setq cmd (substring-no-properties
cmd 0 (next-single-property-change 0 'cmd cmd)))
(setq cmd (substring-no-properties
cmd 0 (next-single-property-change 0 'face cmd))))
i.e. fall-back to searching for the change to the face used for in/with to extract the command. However for this to work I should really strip out the 'cmd property on M-i invocations. So this issue is to discuss what the best approach is. I can think of:
- custom M-i that replicates
ivy-insert-currentbut with special handling - wrapper M-i that messes with
(ivy-state-current ivy-last)somehow - I'm not familiar with how the cl-defstruct stuff works before callingivy-insert-current - add a hook that
ivy-insert-currentcan process the text with before inserting the string
So @abo-abo which do you think is the best approach? Is there already a mechanism for this sort of thing or is my case too much of a special snowflake because of its heavy use of propertised strings?