Port counsel-kmacro to OClosures #3067
Merged
+200
−182
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Also fix action functions to support being
ivy-called without exiting the completion session.counsel-kmacro-kill: Try to prevent being called outside ofcounsel-kmacrominibuffer completion.counsel-kmacro: Fix docstring. Ensurekmacro.elis loaded before evaluating any variables it defines. Removekmacro-counterfrom prompt; it is already listed per-kmacro in ring. Do not default tokmacro-initial-counter-value; defer to kmacro-specific counter. Reword docs and action labels to avoid confusion betweenkmacro-initial-counter-valueandkmacro-counter.counsel--kmacro-format-function: Simplify.counsel--with-kmacro: New macro for destructuring a kmacro object.counsel--format-kmacro: New function.counsel--kmacro-candidates: Use it andcounsel--with-kmacroto format kmacro ring objects. Usekmacro-ring-head. Fix staleedmacro-fix-menu-commandswarning message. Clarify docstring.counsel--kmacro-exec: New compatibility shim forkmacro-exec-ring-item.counsel-kmacro-action-run: Improve docstring. Fixcurrent-prefix-argusage and letivy-current-prefix-argoverride it. Usecounsel--kmacro-exec. Updateivy-lastfor non-exitingivy-call.counsel-kmacro-action-delete-kmacro: Check whether candidate is inkmacro-ringbefore deleting, instead of comparing tolast-kbd-macro. Usekmacro-delete-ring-head. Updateivy-laststate forivy-call.counsel-kmacro-action-copy-initial-counter-value,counsel-kmacro-action-copy-counter-format-for-new-macro: Usecounsel--with-kmacrofor slot access. Clarify docstrings.counsel--kmacro-cycle-until: New function.counsel-kmacro-action-cycle-ring-to-macro: Use it for bounded ring cycling. Updateivy-lastfor non-exitingivy-call.counsel-kmacro-action-set-saved-starting-counter: Clarify docstring. Avoid having to construct a kmacro object directly by cycling ring, reading new counter, and cycling back. Useread-number. Updateivy-laststate forivy-call.counsel-kmacro-action-execute-after-prompt: Improve docstring. Fixcurrent-prefix-argusage and letivy-current-prefix-argoverride it. Useread-number,read-string, andformat-prompt. Avoid kmacro destructuring viacounsel--kmacro-exec.Fixes: #3066
Cc: @okamsn