[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] speed commands: error message when a key is not associated w
From: |
Juan Manuel Macías |
Subject: |
Re: [PATCH] speed commands: error message when a key is not associated with a command |
Date: |
Tue, 03 May 2022 23:08:58 +0000 |
Ihor Radchenko writes:
> It is more complex and I do not see a clear benefit of introducing a
> whole new hook. It would only be useful for people who define a large
> number of extra speed command handlers.
Yes, I agree. Also I'm afraid that this idea of mine added a drawback as
a bonus track: it would be necessary to modify all the functions that
activate the speed commands because, otherwise, it would return an error
anywhere outside the activation contexts. Precisely because of this:
(pcase (run-hook-with-args-until-success 'org-speed-command-strict-hook _)
('nil (error "Command not defined: \"?\" for help"))
(symbol (run-hook-with-args-until-success
'org-speed-command-strict-hook _)))
And I suppose that the functions should consist of a conditional of the
type: "if the context is given -> activate the speed commands, otherwise
-> self-insert-command". Or something like that. Too hacky.
On the other hand, I now seriously doubt whether a patch would be worth
it, even if a defcustom was added. I think you're also right about what
you said at the beginning: considering how speed commands are designed,
it's hard to implement a clean, general solution. I think I'm going to
leave this patch in the fridge for now, though I also encourage other
potential users of speed commands to join the discussion.
(Perhaps, instead of a patch, some tips could be added to the manual (or
to any other relevant site) so that users who want to extend this
functionality apply this type of hacks, as I have done in my particular
case...).
Best regards,
Juan Manuel