public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Why doesn't ~/inputrc work
@ 2011-04-20 17:13 Harry Putnam
  2011-04-20 21:17 ` Eric Blake
  0 siblings, 1 reply; 9+ messages in thread
From: Harry Putnam @ 2011-04-20 17:13 UTC (permalink / raw)
  To: cygwin

setup:  Cygwin (very recent update) on win 7 (64bit)

   ls /etc/setup/*read*
  /etc/setup/libreadline7.lst.gz  /etc/setup/readline.lst.gz

-------        ---------       ---=---       ---------      -------- 

I've never had a cygwin install where using an ~/.inputrc worked.
I've tried quite a few times over the yrs of using cygwin but never
really followed up failed attempts with a dedicated effort to find out
why.

Finally decided to try to find out where the problem is.

Googling this morning has been pretty discouraging, so many things
have the term `inputrc'.  And when coupled with `cygwin', or several
other filtering strings like `broken' or `does not work', etc, I've not
hit on a page that is recognizable as being useful to solve the
problem.

Searching gmane.os.cygwin with similar strings, has not been
productive either.

Lots of commentary about various inputrc entries and such but not
finding much to help find out why it does not work for me.

Searching the last 3000 message subject lines turns up quite a few
announcements about various upgrades to libreadline but scanning the
content hasn't turned up much about troubleshooting.

I know the basics of inputrc and readline from long use of linux OS,
but with readline and libreadline installed, I never see an
/etc/inputrc appear.  Is there no sample /etc/inputrc included? or am
I not installing something necessary for that file to turn up?

Further, when I create an ~/.inputrc and pressing C-x C-r, none of
the entries have any effect whatever.  Restarting bash has no helping
influence either.

Perhaps the keyboard is seen differently on windows and the alt key
does not work, but it appears to work as expected for example in
emacs.

A sample from my ~/.inputrc:

  ## C-x C-r to reread this init file
  "\M-a": "awk 'BEGIN{ print ( )}'"
  "\M-d": "date +\"%s\""
  [...]

Those and a number of other similar cmds work fine on linux but not on
my cygwin installs.   Both on Win7 and WinXp pro. Not to mention
having failed for yrs now.

How might I proceed to determine where the problem is?



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Why doesn't ~/inputrc work
  2011-04-20 17:13 Why doesn't ~/inputrc work Harry Putnam
@ 2011-04-20 21:17 ` Eric Blake
  2011-04-21  5:27   ` Eliot Moss
  2011-04-28 12:36   ` Harry Putnam
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Blake @ 2011-04-20 21:17 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

On 04/20/2011 09:51 AM, Harry Putnam wrote:
> setup:  Cygwin (very recent update) on win 7 (64bit)
> 
>    ls /etc/setup/*read*
>   /etc/setup/libreadline7.lst.gz  /etc/setup/readline.lst.gz
> 
> -------        ---------       ---=---       ---------      -------- 
> 
> I've never had a cygwin install where using an ~/.inputrc worked.

Do you have CRLF line endings on your ~/.inputrc?  That would explain
failures.  To fix it, run 'd2u ~/.inputrc'.  Other than that, it works
for me, so I'm not sure why you're having problems.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 620 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Why doesn't ~/inputrc work
  2011-04-20 21:17 ` Eric Blake
@ 2011-04-21  5:27   ` Eliot Moss
  2011-04-28 12:29     ` Harry Putnam
  2011-04-28 12:36   ` Harry Putnam
  1 sibling, 1 reply; 9+ messages in thread
From: Eliot Moss @ 2011-04-21  5:27 UTC (permalink / raw)
  To: cygwin

On 4/20/2011 12:01 PM, Eric Blake wrote:
> On 04/20/2011 09:51 AM, Harry Putnam wrote:

> Do you have CRLF line endings on your ~/.inputrc?  That would explain
> failures.  To fix it, run 'd2u ~/.inputrc'.  Other than that, it works
> for me, so I'm not sure why you're having problems.

A great suggestion.  I also thought of two other things:

- If the INPUTRC environment variable is set, you may be reading
   something different from what you think

- How and whether a terminal generates meta- keys will clearly affect
   the specific bindings you mentioned. So you may need to dig into
   the specific terminal and into stty settings for the terminal
   driver

Best -- Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Why doesn't ~/inputrc work
  2011-04-21  5:27   ` Eliot Moss
@ 2011-04-28 12:29     ` Harry Putnam
  2011-04-28 12:40       ` Harry Putnam
  0 siblings, 1 reply; 9+ messages in thread
From: Harry Putnam @ 2011-04-28 12:29 UTC (permalink / raw)
  To: cygwin

Eliot Moss <moss@cs.umass.edu> writes:

> On 4/20/2011 12:01 PM, Eric Blake wrote:
>> On 04/20/2011 09:51 AM, Harry Putnam wrote:
>
>> Do you have CRLF line endings on your ~/.inputrc?  That would explain
>> failures.  To fix it, run 'd2u ~/.inputrc'.  Other than that, it works
>> for me, so I'm not sure why you're having problems.
>
> A great suggestion.  I also thought of two other things:
>
> - If the INPUTRC environment variable is set, you may be reading
>   something different from what you think
>
> - How and whether a terminal generates meta- keys will clearly affect
>   the specific bindings you mentioned. So you may need to dig into
>   the specific terminal and into stty settings for the terminal
>   driver

I kind of relied on the fact that emacs responds to Alt-x the same on
windows as it does on linux (its how you enter certain kinds of
commands in emacs) and is usually referred to as `M-x' 

If there was a problem with the meta key, seems like it would show up
then too.

I guess a way to test would be to use a different entry that relies on
something besides the meta (alt) key... I've never used anything else
since my inputrc files are not that complex.

Can you show an example of an entry that uses some other combo?  And
explain how one would enter it into an .inputrc When I see those
Sequences and ctrl char... I get very confused... and not sure how to
create an inputrc entry using them.

Someone mentioned using stty to figure out what is going on.  I've
included the output of `stty -a' and `env' in case anyone can see
something useful there.

-------        ---------       ---=---       ---------      -------- 

,----
|  stty -a
|  
| speed 38400 baud; rows 24; columns 80; line = 0;
| intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
| eol2 = <undef>; swtch = ^Z; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
| werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
| -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
| -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
| -iuclc -ixany -imaxbel
| opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
| isig icanon iexten echo -echoe -echok -echonl -noflsh -tostop -echoctl -echoke
`----

env 

HOMEPATH=\cygwin\home\harry
MANPATH=/usr/local/man:/usr/share/man:/usr/man::/usr/ssl/man
harry=/cygdrive/c/users/harry
HOSTNAME=m2
SHELL=/bin/bash
TERM=screen
WINDIR=C:\Windows
SSH_CLIENT=127.0.0.1 49178 22
USERDOMAIN=m2
ALLUSERSPROFILE=C:\ProgramData
OS=Windows_NT
SSH_TTY=/dev/tty0
USER=harry
HISTFILESIZE=3000
TERMCAP=SC|screen|VT 100/ANSI X3.64 virtual terminal:\
        :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bs:bt=\E[Z:\
        :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:ct=\E[3g:\
        :do=^J:nd=\E[C:pt:rc=\E8:rs=\Ec:sc=\E7:st=\EH:up=\EM:\
        :le=^H:bl=^G:cr=^M:it#8:ho=\E[H:nw=\EE:ta=^I:is=\E)0:\
        :li#24:co#80:am:xn:xv:LP:sr=\EM:al=\E[L:AL=\E[%dL:\
        :cs=\E[%i%d;%dr:dl=\E[M:DL=\E[%dM:dc=\E[P:DC=\E[%dP:\
        :im=\E[4h:ei=\E[4l:mi:IC=\E[%d@:ks=\E[?1h\E=:\
        :ke=\E[?1l\E>:vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l:\
        :ti=\E[?1049h:te=\E[?1049l:us=\E[4m:ue=\E[24m:so=\E[3m:\
        :se=\E[23m:mb=\E[5m:md=\E[1m:mr=\E[7m:me=\E[m:ms:\
        :Co#8:pa#64:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:AX:\
        :vb=\Eg:G0:as=\E(0:ae=\E(B:\
        :ac=\140\140aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++,,hhII00:\
        :po=\E[5i:pf=\E[4i:k0=\E[10~:k1=\EOP:k2=\EOQ:k3=\EOR:\
        :k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:\
        :k9=\E[20~:k;=\E[21~:F1=\E[23~:F2=\E[24~:F3=\E[1;2P:\
        :F4=\E[1;2Q:F5=\E[1;2R:F6=\E[1;2S:F7=\E[15;2~:\
        :F8=\E[17;2~:F9=\E[18;2~:FA=\E[19;2~:kb=^?:K2=\EOE:\
        :kB=\E[Z:kF=\E[1;2B:kR=\E[1;2A:*4=\E[3;2~:*7=\E[1;2F:\
        :#2=\E[1;2H:#3=\E[2;2~:#4=\E[1;2D:%c=\E[6;2~:%e=\E[5;2~:\
        :%i=\E[1;2C:kh=\E[1~:@1=\E[1~:kH=\E[4~:@7=\E[4~:\
        :kN=\E[6~:kP=\E[5~:kI=\E[2~:kD=\E[3~:ku=\EOA:kd=\EOB:\
        :kr=\EOC:kl=\EOD:km:
USERNAME=harry
PATH=/usr/local/bin:/cvsb/m2/home/harry/scripts:/cvsb/m2/home/harry/scripts/perl:/cygdrive/c/users/harry/emacs/bin:/cygdrive/c/cygwin/bin:/cygdrive/c/cygwin/wbin:/wbin:/cygdrive/c/Users/harry/bin:/usr/local/bin:/cvsb/m2/home/harry/scripts:/cvsb/m2/home/harry/scripts/perl:/cygdrive/c/users/harry/emacs/bin:/cygdrive/c/cygwin/bin:/cygdrive/c/cygwin/wbin:/wbin:/cygdrive/c/Users/harry/bin:/usr/local/bin:/usr/bin:/bin:%CommonProgramFiles%/Microsoft Shared/Windows Live:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static:/cygdrive/c/putty:/cygdrive/c/Users/harry/emacs/bin:/cygdrive/c/Program Files (x86)/Common Files/Acronis/SnapAPI:%ProgramFiles%/digieffects/bin:/cygdrive/c/Program Files (x86)/QuickTime/QTSystem:/bin
MAIL=/var/spool/mail/harry
STY=3780.tty0.m2
SYSTEMDRIVE=C:
PWD=/cygdrive/c/Users/harry
CYGWIN=ntsec tty
EDITOR=/cygdrive/c/vim/vim70/vim
USERPROFILE=C:\Users\harry
LANG=C.UTF-8
LOGONSERVER=\\M2
PS1=\[\033[01;31m\]HOST:\h \[\033[01;33m\]\w\n\u > \[\033[00m\]
HOME=/cygdrive/c/Users/harry
LOGONSERVER=\\M2
PS1=\[\033[01;31m\]HOST:\h \[\033[01;33m\]\w\n\u > \[\033[00m\]
HOME=/cygdrive/c/Users/harry
PS4=$LINENO:
SHLVL=2
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
HOMEDRIVE=C:
COMSPEC=C:\Windows\system32\cmd.exe
SYSTEMROOT=C:\Windows
LOGNAME=harry
PRINTER=\\HARVEY\EPSON Stylus CX7800 Series
WINDOW=0
SSH_CONNECTION=127.0.0.1 49178 127.0.0.1 22
INFOPATH=/usr/local/info:/usr/share/info:/usr/info:
COMPUTERNAME=M2
HISTFILE=/cygdrive/c/Users/harry/.bash_history
_=/cygdrive/c/cygwin/bin/env



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Why doesn't ~/inputrc work
  2011-04-20 21:17 ` Eric Blake
  2011-04-21  5:27   ` Eliot Moss
@ 2011-04-28 12:36   ` Harry Putnam
  1 sibling, 0 replies; 9+ messages in thread
From: Harry Putnam @ 2011-04-28 12:36 UTC (permalink / raw)
  To: cygwin

Eric Blake <eblake@redhat.com> writes:

> On 04/20/2011 09:51 AM, Harry Putnam wrote:
>> setup:  Cygwin (very recent update) on win 7 (64bit)
>> 
>>    ls /etc/setup/*read*
>>   /etc/setup/libreadline7.lst.gz  /etc/setup/readline.lst.gz
>> 
>> -------        ---------       ---=---       ---------      -------- 
>> 
>> I've never had a cygwin install where using an ~/.inputrc worked.
>
> Do you have CRLF line endings on your ~/.inputrc?  That would explain
> failures.  To fix it, run 'd2u ~/.inputrc'.  Other than that, it works
> for me, so I'm not sure why you're having problems.

Thanks for the reply... sorry about the big time lapse.

Doesn't appear that CRLF is a problem:

sed -n l < .inputrc

  ## C-x C-r to reread this init file$
  ## "\\M-S": "TERM=vt200;export TERM; ssh root@fwobsd"$
  "\\M-a": "awk 'BEGIN{ print ( )}'"$
  "\\M-d": "date +\\"%s\\""$
  "\\M-e": "ps wwaux|grep emacsc"$
  [...]

All newlines..., plus the times I had init files with CRLF there was
always some kind of error message.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Why doesn't ~/inputrc work
  2011-04-28 12:29     ` Harry Putnam
@ 2011-04-28 12:40       ` Harry Putnam
  2011-04-28 15:26         ` Eliot Moss
  0 siblings, 1 reply; 9+ messages in thread
From: Harry Putnam @ 2011-04-28 12:40 UTC (permalink / raw)
  To: cygwin

Harry Putnam <reader@newsguy.com> writes:

> I guess a way to test would be to use a different entry that relies on
> something besides the meta (alt) key... I've never used anything else
> since my inputrc files are not that complex.
>
> Can you show an example of an entry that uses some other combo?  And
> explain how one would enter it into an .inputrc When I see those
> Sequences and ctrl char... I get very confused... and not sure how to
> create an inputrc entry using them.

I found some really simple examples in man readline.

Something like `Control-o: "some-string"'

Works as expected and inserts `some-string' into the cmdline when I
press ` Ctrl-o', so apparently it IS some problem with the meta
(alt) key.

Any IDEAS as to what to do about it would be welcome.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Why doesn't ~/inputrc work
  2011-04-28 12:40       ` Harry Putnam
@ 2011-04-28 15:26         ` Eliot Moss
  2011-05-07  9:26           ` Meanders
  2011-05-07 18:24           ` Andy Koppe
  0 siblings, 2 replies; 9+ messages in thread
From: Eliot Moss @ 2011-04-28 15:26 UTC (permalink / raw)
  To: cygwin

On 4/28/2011 12:49 AM, Harry Putnam wrote:
> Harry Putnam<reader@newsguy.com>  writes:

I took a while to play around. One thing you may need to
do is set the TERM environment variable to a proper, more
capable, terminal (such as "cygwin").

Beyond that, I found that I needed to:

set convert-meta on

in my .inputrc and also to write the escape sequences as
(for example):

"\M-b": "echo meta b"

Note: *one* backslash, not two!

Best -- Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Why doesn't ~/inputrc work
  2011-04-28 15:26         ` Eliot Moss
@ 2011-05-07  9:26           ` Meanders
  2011-05-07 18:24           ` Andy Koppe
  1 sibling, 0 replies; 9+ messages in thread
From: Meanders @ 2011-05-07  9:26 UTC (permalink / raw)
  To: cygwin



Eliot Moss wrote:
> 
> set convert-meta on
> 
> in my .inputrc and also to write the escape sequences as
> (for example):
> 
> "\M-b": "echo meta b"
> 

I was having exactly the same problem as Harry. 

Using the 'set convert-meta on' worked for me. I've had the same .inputrc
file for years but this problem just appeared recently on a new Window 7
64bit machine with a recent cygwin installed.

Thanks
-- 
View this message in context: http://old.nabble.com/Why-doesn%27t-%7E-inputrc-work-tp31442455p31564891.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Why doesn't ~/inputrc work
  2011-04-28 15:26         ` Eliot Moss
  2011-05-07  9:26           ` Meanders
@ 2011-05-07 18:24           ` Andy Koppe
  1 sibling, 0 replies; 9+ messages in thread
From: Andy Koppe @ 2011-05-07 18:24 UTC (permalink / raw)
  To: moss, cygwin

On 28 April 2011 13:40, Eliot Moss wrote:
> I took a while to play around. One thing you may need to
> do is set the TERM environment variable to a proper, more
> capable, terminal (such as "cygwin").
>
> Beyond that, I found that I needed to:
>
> set convert-meta on

That's not a solution for everyone, because it makes it impossible to
enter characters beyond 7-bit ASCII. The setting means that input
bytes with the eighth bit set have that bit cleared and are prefixed
by an escape character instead.

> in my .inputrc and also to write the escape sequences as
> (for example):
>
> "\M-b": "echo meta b"

To make this work without enabling convert-meta, try using "\eb"
instead of "\M-B". Here's why: back in the olden days, character codes
were 7 bits wide, so there was one bit to spare in your usual 8-bit
byte, and the Meta modifier key could be used to set that. Then those
pesky foreign types came along and claimed the eigth bit for their
ümläüts and other funny characters, which obviously collided with the
Meta bit. Therefore, a different scheme became necessary to encode the
Alt (née Meta) modifier: instead of setting the eighth bit, most
terminal emulators these days send an escape character prefix.
Inevitably, there's confusion on whether "Meta" should only refer to
ye olde eighth-bit scheme, or to the escape prefix scheme too.

In bash/readline's .inputrc without convert-meta on, the "\M-" refers
to the eighth-bit scheme only, so an Alt+b keypress sending Escape
followed by 'b' doesn't match "\M-b". In fact, with Cygwin's default
UTF-8 locale, a byte representing 'b' with the eighth bit set (i.e.
0xE2) actually constitutes an incomplete character sequence, hence
readline simply ignores such a key binding.

Ändy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-05-07 18:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 17:13 Why doesn't ~/inputrc work Harry Putnam
2011-04-20 21:17 ` Eric Blake
2011-04-21  5:27   ` Eliot Moss
2011-04-28 12:29     ` Harry Putnam
2011-04-28 12:40       ` Harry Putnam
2011-04-28 15:26         ` Eliot Moss
2011-05-07  9:26           ` Meanders
2011-05-07 18:24           ` Andy Koppe
2011-04-28 12:36   ` Harry Putnam

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).