Saturday, May 27, 2017

Re: Bug/non-determinism in output of maparg() and map commands

Nikolay Pavlov wrote:

[..]

> >> Enable, disable, query, execute plus two callbacks. *Four* functions
> >> and two callbacks in place of just two simple functions, mostly using
> >> the functionality that is already there. Five if you remember about
> >> :mkvimrc and that somebody may want to replace that on top of new API:
> >> query will need a mirror function for creating a mapping then.
> >
> > You are completely missing the point: those two functions don't provide
> > the functionality we are talking about here.
>
> Why do you think so? They provide everything what is needed to
> implement the functionality we are talking about here in VimL.

This whole discussion started about the difficutly of using the result
of maparg(). As far as I can see you only provide a function to get more
mappings, it doesn't help with disabling and restoring mappings.
Dealing with that is not easy at all (dealing with modes,
escaping/unescaping, etc). I would not want every plugin writer to
re-invent the wheel.

The basic discussion first need to be held is whether to refer to a
mapping just by its LHS (plus mode) or a unique handle can be used. The
latter is useful if we disable a mapping but not delete it, it can then
be shadowed by another mapping.

We probably also need some kind of re-enable or restore function, that
takes the result of maparg() and defines a mapping with it. That avoids
string manipulation and using :exe (this is tricky because of the way
mappings need some characters to be escaped).

--
A village. Sound of chanting of Latin canon, punctuated by short, sharp
cracks. It comes nearer. We see it is a line of MONKS ala SEVENTH SEAL
flagellation scene, chanting and banging themselves on the foreheads with
wooden boards.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment