-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Feature request: simpler api for customizing transient states #5405
Comments
I think you're looking for this if it's just related to customizing bindings. spacemacs/layers/+completion/spacemacs-ivy/packages.el Lines 322 to 328 in 895455d
|
@nixmaniack great, that looks like exactly what I was looking for. Do you know if there's anything to also fix the docstring, then? |
As per my understanding, I don't think there's a way at this moment to customize docstring. You might want to create a feature request for it. |
Ideally, if the customization macro could be in the form I suggested above, one could arbitrarily adjust any part of the transient state transparently, rather than having to create separate functions to touch each piece. Can @justbur comment on the feasibility of this? |
You change the docstring by tweaking the variable (in this case) It's a form that is evaled. |
@TheBB is right. Be aware that if you want the coloring you either need to do it manually or use |
There is a macro now to apply hydra formatting to a string, I'm on mobile and cannot paste the name here for now. |
So to switch
I can confirm that this does work, but isn't it a bit much? Or am I missing a more elegant way to do it? |
You're adjusting the docstring and most of the bindings, so why not just redefine the transient state? |
That seems like the cleaner way. It's not really clear how to do that, though (as in where to add the redefinition). So far, I've tried it in dotspacemacs-user-config, inside a |
try this which should work anywhere in user-config (no hooks) (spacemacs|define-transient-state my-paste
:title "Pasting Transient State"
:doc "\n[%s(length kill-ring-yank-pointer)/%s(length kill-ring)] \
[_M-n_/_M-p_] cycles through yanked text, [_p_/_P_] pastes the same text above or \
below. Anything else exits."
:bindings
("M-n" evil-paste-pop)
("M-p" evil-paste-pop-next)
("p" evil-paste-after)
("P" evil-paste-before)
("0" spacemacs//transient-state-0))
(define-key evil-normal-state-map "p" 'spacemacs/my-paste-transient-state/evil-paste-after)
(define-key evil-normal-state-map "P" 'spacemacs/my-paste-transient-state/evil-paste-before) |
The issue is that the transient-states are all loaded at once at the end of the initialization, so that your definition is probably getting overwritten. This was to allow people to change the key bindings ironically. |
@justbur thanks, my mistake was defining the same While my question is essentially answered, I do wonder what kind of impact all of these patches on patches on patches of elisp has for startup time... |
With the unspoken consensus that for now these two methods answer the issue, I'll close. I do think that as we deal with editing styles molding to user preferences, having transient states be so rigid is a problem in the long term. It'd be amazing if transient state bindings could be as easily editable as evil-define-key for a given state. |
On second thought, no harm in keeping this around as context, and an open ended call for those with the elisp-foo to mull over this api. If we think of transient states as really first class states or "modes", it makes sense that customizing them should be as accessible as something like |
here's an open PR taking a step in the right direction, from @madand – it adds a function that automatically sets or appends to EDIT: I think this may be another good example of a transient state customization that would benefit greatly from something like |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
This issue is still valid and Regarding @braham-snyder's issue with not being able to override I will make PR with the mentioned change later this week. -- Another issue I can think of is abuse of spacemacs/layers/+lang/html/funcs.el Lines 78 to 91 in 09a9273
spacemacs/layers/+frameworks/vue/funcs.el Lines 126 to 139 in 09a9273
spacemacs/layers/+distributions/spacemacs-bootstrap/funcs.el Lines 202 to 214 in 09a9273
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid! |
For example, paste transient state is defined:
Is there a way for me to have in my config:
I suppose I could duplicate the code and redefine it at the end of config load, but I'm hoping for a better approach.
The text was updated successfully, but these errors were encountered: