On 2024-08-10 15:50:55 +0100, Reuben Thomas wrote:
> On Sat, 10 Aug 2024 at 10:03, Debian Bug Tracking System <
> ow...@bugs.debian.org> wrote:
> > ---------- Forwarded message ----------
> > From: Gioele Barabucci <gio...@svario.it>
> > To: 708979-d...@bugs.debian.org
> > Cc:
> > Bcc:
> > Date: Sat, 10 Aug 2024 11:01:07 +0200
> > Subject: Re: Bug#708979: bash (readline): Something is wrong with binding
> > keys to functions
> > Version: 5.2.21-2.1
> >
> > On Wed, 19 Apr 2006 15:11:20 +0100 Reuben Thomas <r...@sc3d.org> wrote:
> > > In my .inputrc I have the following lines:
> > >
> > > "\M-n": history-search-forward
> > > "\M-p": history-search-backward
> > > "\C-u": kill-whole-line
> > >
> > > With readline 5.0 they work fine, but with 5.1 they don't work.
> >
> > this issue does not seem to affect version 5.2.21 of bash and
> > libreadline8 version 8.2-4.
> 
> Thank for looking into this issue!
> 
> I just tried on my Bookworm system (bash 5.2.15-2+b7) and the bug
> with \M-p and \M-n still seems present there.

For \M-p and \M-n, this may be a documentation inaccuracy. The
readline(3readline) man page says

  An Emacs-style notation is used to denote keystrokes.  Control keys are
  denoted by C-key, e.g., C-n means Control-N.  Similarly, meta keys  are
  denoted  by  M-key,  so M-x means Meta-X.  (On keyboards without a meta
  key, M-x means ESC x, i.e., press the Escape key then the x key.   This
  makes  ESC the meta prefix.  The combination M-C-x means ESC-Control-x,
  or press the Escape key then hold the Control key while pressing the  x
  key.)

However, even if the keyboard has a Meta key, it has the effect to
generate an Escape character, so that one should use the \e form in
the .inputrc file. For instance, with

"\ep": history-search-backward

M-p does a history-search-backward with libreadline8 (I've tried with
gp from the pari-gp package).

I think that this is just a notation issue. In GNU Emacs, if I type
ESC x, then M-x is displayed.

Perhaps readline should make \M- equivalent to \e for the .inputrc
file.

The behavior is the same in bash. BTW, with the default bindings,
"bind -p" shows only \e forms; there are no bindings with "\M-".
And note that if I use

"\M-p": history-search-backward

in the .inputrc file, "bind -p" gives for this binding:

"\360": history-search-backward

This is the octal value of the ASCII code of the character "p" (\160)
with the 8th bit set (→ \360). AFAIK, setting the 8th bit was an old,
optional way the Meta key was behaving with xterm, but with the
non-ASCII locales, this is now completely obsolete.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to