emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: Ihor Radchenko <yantar92@gmail.com>
Cc: orgmode <emacs-orgmode@gnu.org>
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	[thread overview]
Message-ID: <871qxai585.fsf@posteo.net> (raw)
In-Reply-To: <87czgwvce1.fsf@localhost> (Ihor Radchenko's message of "Mon, 02 May 2022 11:31:18 +0800")

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 


      reply	other threads:[~2022-05-03 23:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-30 11:25 Juan Manuel Macías
2022-04-30 13:06 ` Ihor Radchenko
2022-04-30 14:41   ` Juan Manuel Macías
2022-04-30 19:39     ` Juan Manuel Macías
2022-05-01  4:01     ` Ihor Radchenko
2022-05-01 11:00       ` Juan Manuel Macías
2022-05-02  3:31         ` Ihor Radchenko
2022-05-03 23:08           ` Juan Manuel Macías [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qxai585.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    --subject='Re: [PATCH] speed commands: error message when a key is not associated with a command' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).