-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
Make swiper-query-replace a standalone command #2777
base: master
Are you sure you want to change the base?
Conversation
I realized that providing candidates in the replacement text query isn't a great idea, because it's too easy to mistakenly select one of them instead of the current input. (If More importantly, though, I implemented the idea sketched in my previous comment, and
There's still something awry with the overlays (sometimes they stick around after the command quits). Unfortunately that part of the code looks quite arcane to me. If you like the general idea, we can see what to do about that part. |
Thanks. I can't say whether or in what form these changes will be accepted, but I just wanted to inform you that large contributions require copyright to be assigned to the Free Software Foundation, as Ivy is copyrighted by the FSF. Do you have such a CA on file already? If not, would you be willing to submit one? If you're unfamiliar with this, the process is relatively straightforward, and there's more info at |
Of course I'm willing to sign the CA papers (which I haven't done so far), as long as there is some indication I'll need them :-) |
Hi. The PR looks good to me. Please proceed with the CA 👍 |
Ok, I completed the CA paperwork. I've also pushed a commit to refine the start point of the replacement. With that in place, I think the logic of the command is good, but of course I'm happy to discuss all the details. It remains to sort out some issues with the overlays. I think you can address those things more effectively and reliably, @abo-abo. How should we organize this? |
swiper.el
Outdated
"Swiper query replace: " | ||
#'swiper-isearch-function | ||
:initial-input initial-regexp | ||
:keymap swiper-isearch-map |
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 gives a "reference to free variable swiper-isearch-map
" byte-compiler warning, which probably means you need to define that variable before this function.
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've replaced this with swiper-map
. Then M-n
will not quote the query, but at least no large reorganizing of the code is needed.
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 don't know which is better, but FWIW moving a defvar
verbatim doesn't qualify as "large reorganizing of the code".
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.
True; but then a random piece of swiper-isearch will be outside of the corresponding ;;*
-section of the file. I was assuming this is undesired.
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.
Rules are made to be broken ;).
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.
Or rather, there are always exceptions that prove the rule.
Apparently it's not possible to resume a previous
swiper-query-replace
operartion, so I would like to propose the attached change.The candidates in the
swiper-query-replace
prompt will be the previous replacement texts used for the given replacement subject. The history in that query will be the full history of replacement texts.I frankly never understood what that old
:def
parameter in theivy-read
call is supposed to be telling me, and I removed it. If I'm missing something clever here, let me know :-).Another idea, which I could work on if there is interest, would be to modify
swiper-query-replace
so that it also makes sense when called outside of swiper. This would be a variant of swiper where hittingRET
asks for a replacement text instead of just exiting the search. This is closer to the usualquery-replace
and might feel more familiar to some people.