* bug#2057: 23.0.60; delete key and deletechar
@ 2009-04-16 15:10 Robert Brown
2009-04-16 16:19 ` Dan Nicolaescu
2009-04-16 18:45 ` Stefan Monnier
0 siblings, 2 replies; 7+ messages in thread
From: Robert Brown @ 2009-04-16 15:10 UTC (permalink / raw)
To: 2057; +Cc: emacs-pretest-bug
I believe the following patch may be the right fix for bug 2057. When
looking at the key sequences generated by function keys, Emacs should only
register those that generate two or more ASCII characters.
My termcap entry, xterm-color, contains "kD=\177", which means that the
delete *function* key generates code 177.
The function key mapping code in term.c incorrectly creates a translation
that maps charcter code 177 to deletechar. The translation is incorrect
because the normal backspace/delete key on my keyboard also generates code
177. Once the translation is set up, hitting backspace/delete causes Emacs
to delete characters to the right instead of to the left, since Emacs thinks
I'm hitting the delete *function* key.
bob
====================
--- src/term.c.~1~ 2009-04-13 14:57:19.000000000 -0400
+++ src/term.c 2009-04-16 10:59:32.000000000 -0400
@@ -1410,7 +1410,7 @@
for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
{
char *sequence = tgetstr (keys[i].cap, address);
- if (sequence)
+ if (sequence && strlen(sequence) > 1)
Fdefine_key (kboard->Vinput_decode_map, build_string (sequence),
Fmake_vector (make_number (1),
intern (keys[i].name)));
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2057: 23.0.60; delete key and deletechar
2009-04-16 15:10 bug#2057: 23.0.60; delete key and deletechar Robert Brown
@ 2009-04-16 16:19 ` Dan Nicolaescu
2009-04-16 17:54 ` Robert Brown
2009-04-16 18:45 ` Stefan Monnier
1 sibling, 1 reply; 7+ messages in thread
From: Dan Nicolaescu @ 2009-04-16 16:19 UTC (permalink / raw)
To: Robert Brown; +Cc: 2057
Robert Brown <brown@google.com> writes:
> I believe the following patch may be the right fix for bug 2057. When
> looking at the key sequences generated by function keys, Emacs should only
> register those that generate two or more ASCII characters.
>
> My termcap entry, xterm-color, contains "kD=\177", which means that the
> delete *function* key generates code 177.
Interesting, it seems that you have a modified termcap database, the normal one
has kD=\E[3~ for xterm-color.
What you are seeing is probably the effect of what
`normal-erase-is-backspace' does.
Can you try setting TERM to xterm-256color and see if that the delete
key works better then? (It's quite likely that nowadays terminal
emulators are compiled with 256 color support)
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2057: 23.0.60; delete key and deletechar
2009-04-16 16:19 ` Dan Nicolaescu
@ 2009-04-16 17:54 ` Robert Brown
0 siblings, 0 replies; 7+ messages in thread
From: Robert Brown @ 2009-04-16 17:54 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: 2057
Dan Nicolaescu writes:
> Robert Brown <brown@google.com> writes:
>
> > I believe the following patch may be the right fix for bug 2057. When
> > looking at the key sequences generated by function keys, Emacs should only
> > register those that generate two or more ASCII characters.
> >
> > My termcap entry, xterm-color, contains "kD=\177", which means that the
> > delete *function* key generates code 177.
>
> Interesting, it seems that you have a modified termcap database, the normal one
> has kD=\E[3~ for xterm-color.
Yes, it's definitely a bug in the termcap entry. Hitting the delete
function key generates \E[3~ for me. I can fix the termcap.
> Can you try setting TERM to xterm-256color and see if that the delete
> key works better then?
Switching to a different termcap works well.
I still think it may incorrect for Emacs to map single character function
key sequences. But perhaps these just never occur in practice.
bob
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2057: 23.0.60; delete key and deletechar
2009-04-16 15:10 bug#2057: 23.0.60; delete key and deletechar Robert Brown
2009-04-16 16:19 ` Dan Nicolaescu
@ 2009-04-16 18:45 ` Stefan Monnier
2009-04-16 18:54 ` Robert Brown
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2009-04-16 18:45 UTC (permalink / raw)
To: Robert Brown; +Cc: emacs-pretest-bug, 2057
> My termcap entry, xterm-color, contains "kD=\177", which means that the
> delete *function* key generates code 177.
Why does the termcap data have such an entry for kD? That looks like a bug.
Does it also have a similar entry for the backspace key?
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2057: 23.0.60; delete key and deletechar
2009-04-16 18:45 ` Stefan Monnier
@ 2009-04-16 18:54 ` Robert Brown
0 siblings, 0 replies; 7+ messages in thread
From: Robert Brown @ 2009-04-16 18:54 UTC (permalink / raw)
To: Stefan Monnier; +Cc: @gnu.org, 2057
Stefan Monnier writes:
> > My termcap entry, xterm-color, contains "kD=\177", which means that the
> > delete *function* key generates code 177.
>
> Why does the termcap data have such an entry for kD? That looks like a bug.
> Does it also have a similar entry for the backspace key?
It's definitely a bug in the termcap entry. The odd thing is what happened
afterward. Emacs created an input mapping that converts 177 into
deletechar, messing up the action of the normal delete/backspace key.
There's an assumption that function keys never generate a single character
that's the same as some normal key. Or alternatively, function keys take
precedence over normal keys if there's any overlap in generated codes.
bob
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2057: 23.0.60; delete key and deletechar
@ 2009-04-16 15:33 Robert Brown
0 siblings, 0 replies; 7+ messages in thread
From: Robert Brown @ 2009-04-16 15:33 UTC (permalink / raw)
To: 2057; +Cc: emacs-pretest-bug
On second thought, maybe the real bug is with the termcap entry. Hitting
the function key labeled delete on my keyboard generates:
escape [ 3 ~
not character 177. Maybe function keys always generate multi-character
sequences, so there's generally no confusion between the function key and a
normal key.
bob
====================
--- src/term.c.~1~ 2009-04-13 14:57:19.000000000 -0400
+++ src/term.c 2009-04-16 10:59:32.000000000 -0400
@@ -1410,7 +1410,7 @@
for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
{
char *sequence = tgetstr (keys[i].cap, address);
- if (sequence)
+ if (sequence && strlen(sequence) > 1)
Fdefine_key (kboard->Vinput_decode_map, build_string (sequence),
Fmake_vector (make_number (1),
intern (keys[i].name)));
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#2057: 23.0.60; delete key and deletechar
@ 2009-01-25 23:01 Robert Brown
0 siblings, 0 replies; 7+ messages in thread
From: Robert Brown @ 2009-01-25 23:01 UTC (permalink / raw)
To: emacs-pretest-bug
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.
Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list.
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
I start Emacs 23.0.60.2 on Ubuntu 8.10 inside a gnome-terminal emulation
window using the command "emacs -q -nw". The backspace key on my keyboard is
set up to generate ASCII code 127, but Emacs incorrectly maps this code to
deletechar with input-decode-map which is:
(keymap (127 . [deletechar]) (27 keymap (79 keymap (83 . ....
I believe this input translation is set up by term_get_fkeys_1 in term.c when
it looks at the termcap/terminfo function key definitions for my terminal
type, xterm-color, and sees that the termcap description contains:
kD=\177
which means that the delete *function* key produces ASCII code 127.
Emacs should look at both kD and kb. If they are the same ASCII character,
then Emacs should not install a translation in input-decode-map for delete.
If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
`bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/local/software/package/emacs-23.0.60.2/share/emacs/23.0.60/etc/DEBUG
for instructions.
In GNU Emacs 23.0.60.2 (i686-pc-linux-gnu)
of 2009-01-18 on ugg
configured using `configure '--without-x'
'--prefix=/local/software/package/emacs-23.0.60.2''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: C
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: C
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: nil
locale-coding-system: utf-8-unix
default-enable-multibyte-characters: t
Major mode: Info
Minor modes in effect:
savehist-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
global-auto-composition-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
ESC [ > 1 ; 1 7 0 4 ; 0 c C-h i m e m a c s RET C-s
b u g SPC C-a C-n C-f C-f C-f C-f C-f C-f RET SPC SPC
ESC x r e p o r t - e m a c s - b u g RET
Recent messages:
("emacs")
Composing main Info directory...done
Mark saved where search started
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-04-16 18:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-16 15:10 bug#2057: 23.0.60; delete key and deletechar Robert Brown
2009-04-16 16:19 ` Dan Nicolaescu
2009-04-16 17:54 ` Robert Brown
2009-04-16 18:45 ` Stefan Monnier
2009-04-16 18:54 ` Robert Brown
-- strict thread matches above, loose matches on Subject: below --
2009-04-16 15:33 Robert Brown
2009-01-25 23:01 Robert Brown
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).