On 8/16/24 11:11 AM, Reuben Thomas wrote:

    If you'regoing to have meta-p (however you enter it on your keyboard)


    What I'm saying is that on macOS, the option key is the meta key, in that
    it can be configured to either send meta characters (option-p emits "π",
    for example) or be used as a meta key in the way you mean it with the
    escape meta-prefix.


I think this may be the nub of the issue: you are defining the Meta key as "the key that sends meta characters", whereas I'm defining it as "the key (if any) ascribed the Meta function". So in particular, it's a certain key on the keyboard.

Kind of. I'm saying the option key on macOS can be configured -- for
Terminal -- to either send meta characters, as readline defines them, or
"perform the meta function" as you define it.


    I think it's just a terminology difference. If you think meta means to
    unconditionally send the meta-prefix (escape), that's fine, but is that
    the same as the `meta character' (characters with the eighth bit set) that
    convert-meta refers to?


So, I don't mean any of that. I think Meta refers to a key on the keyboard.

OK, so it's a key on the keyboard that performs a particular function: to
compose with another character/keypress and send ESC before that other key,
as if you had pressed the ESC key and this other key separately. Let's use
that as the basis for something new.


     >   * Even in Emacs, on which readline is modelled, even when running
    in the
     >     terminal, one doesn't have to write keybindings in different ways
     >     depending on the terminal setup.

    How does it do that? Or does it simply default to the equivalent of
    setting convert-meta to on, whatever it is?


I have no idea, and as a user, I don't care. That's my point here, really: most users don't care about the minutiae of what pressing the Meta key does, under the hood.

Sure, but you're making the base assumption here about the behavior of
pressing the meta key.


    So you want the \M- portion of the key sequence to reflect what the meta
    key on your keyboard does (whichever one that is, since lots of keyboards
    on windows laptops, for instance, don't have a meta key, either), without
    telling readline explicitly. It's a new capability, basically defaulting
    convert-meta to on for key bindings while being careful not to strip the
    eighth bit from any multibyte characters (which I think we already do, to
    be clear).


It sounds like it is indeed a new capability!

OK, then let's figure out the new behavior. It will obviously require a new
settable readline variable, name to be determined (maybe something like
`force-meta-prefix' or similar). If this variable is set, Meta-C and "\M-C"
in key bindings act as if convert-meta were on and actually bind "\eC". If
it's unset, the key binding code behaves as if convert-meta were unset in
the current readline release.

Should the variable have a default value? Should it depend on the locale?
Should it be ignored if the user has not set it explicitly, so the behavior
is backwards compatible?


    set convert-meta on

    in your .inputrc before any key bindings and see if that gets you where you
    want? If there are no negative effects when entering multibyte characters
    from the keyboard, we can talk about defaulting convert-meta to on in a
    locale with UTF-8 encoding.


I tried setting convert-meta to "on", but this breaks entering e.g. accented characters. Unsurprisingly, since now it is converting all my ≥8- bit characters to multiple 7-bit characters; for example, a (UK) pound sign (£) comes out as hash followed by newline.

That's what I figured would happen.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to