bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13471: 24.3.50; S-up does not work in xterm: <select> is undefined


From: Thomas Dickey
Subject: bug#13471: 24.3.50; S-up does not work in xterm: <select> is undefined
Date: Thu, 17 Jan 2013 19:02:21 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

On Thu, Jan 17, 2013 at 12:37:19PM -0500, Stefan Monnier wrote:
> Hi Thomas,
> 
> I'm not familiar enough to follow your argument and/or suggestion and
> I'm especially unable to relate your email's body with its subject.
> Could you try to help me understand?

There are several things to discuss:

        + this thread started in Debian #698299
          http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698299

        + the original report cited a few urls, including a previous
          thread for Emacs:

          
http://stackoverflow.com/questions/10871745/shift-up-arrow-doesnt-highlight-text-emacs-iterm2
          http://lists.gnu.org/archive/html/help-gnu-emacs/2011-05/msg00211.html
          http://forums.vandyke.com/showpost.php?p=26580&postcount=25

        + Sven commented that removing the line with "kU" fixed the
          reported problem.

        + I commented that the mailing-list thread discussing this had
          quoted a comment from the Emacs source code indicating that
          the chunk of code had been written for a "non-standard dialect
          of terminfo".

          I'd read that thread before, noting (to myself) only that
          the comment was incorrect since the mnemonics in quotes
          are all termcap.  The first parameter (F1, F2, %1) is
          a conventional termcap name (there are no standards for
          termcap - it owes its existing convention to documentation
          in the terminfo manual), while the others were unfamiliar
          to me.

          You can see the names in terminfo(5).

        + however, as a bug report against ncurses I pay more attention.
          The problem is to infer where the problem is, and possible
          causes.

        + Emacs uses the termcap interface provided by ncurses, which
          means that Emacs calls tgetstr, tgetnum, tgetflag to obtain
          string, numeric, boolean values.  The termcap interface
          matches only the first 2 characters of capability names.

          (The reason for not requiring that the names have a trailing
          null, I seem to recall being for compatibility with termcap
          libraries which do this, leading to applications that rely
          upon the behavior).

        + this behavior was commented on in a different thread:
          http://lists.gnu.org/archive/html/emacs-devel/2012-10/msg00012.html

        + tgetstr looks for each name, starting with the predefined
          termcap names, and then the extended names - unless one calls
          the ncurses function
                use_extended_names(FALSE);

          That's been the behavior since 1999.  The current data for the
          extended keys for xterm dates from April 2005.

        + uses for the above features (and quirks) are long established.
          That leads to considering how the problem arises in Emacs,
          and whether Emacs needs the problematic code.

        + The thread from October suggests that the problem is that Emacs
          is calling tgetstr with "kU" as a parameter.   That will return
          data for kUP (an extended key).  Schwab comments that kR is
          the same as kri - though there's a pitfall there.  Quoting from
          terminfo(5):

       key_sf                        kind       kF        scroll-forward key
       key_sr                        kri        kR        scroll-backward key
       key_sleft                     kLFT       #4        shifted left-arrow
                                                          key
       key_sright                    kRIT       %i        shifted right-arrow
                                                          key

          You may notice that terminfo(5) does not define a shifted up or
          down-arrow.  (Whether kind and kri should fill that role is arguable
          - I decided they would, and in October 2005 modified xterm-new to
          provided that connection but have found no prior art to establish
          that connection in usage by others).
          
          I retained kUP because it fits a pattern of names for extended keys.

          So... if Emacs looks for "kU" and gets "kUP" data, and then sees
          that it is the same string as an existing key kR, then it could
          conclude that the assignment for "kU" was ineffective and that
          "select" is not defined.

        + Emacs could of course solve the problem by calling
                use_extended_names(FALSE);

          I recall making that suggestion to someone working on Emacs a
          few years ago - that's apparently not been done.

        + Alternatively (as suggested in the threads mentioned), one could
          remove the problematic call from Emacs.  That could be done if
          it serves no useful purpose.  From discussion and examining the
          source code, it appears that the "non-standard terminfo" cited
          in the comment is unlikely to be in use by anyone some 18
          years later - it dates from 1994-10-14.  AIX 4 was released in
          1994; the code was for AIX 4 (early) or AIX 3 (late).
          In either case it's old.  AIX 5 is more than ten years old.
          
          The entire chunk relating to that comment could be removed.

          There is other obsolete code in term.c, e.g., the Teleray code,
          the Hazeltine code, not to mention Emacs insistence on using
          termcap names on a terminfo system :-)

        + Schwab's comments this morning seemed to be focused on retaining
          the code because (a) it was related to terminfo and (b) ncurses
          uses terminfo.  My viewpoint on it is that the code is useful
          only if there is a system whose users rely upon it, that a tie
          to ncurses is pointless.  The data in ncurses exposes some code
          which is no longer useful.

> >>>>> "dickey" == dickey  <dickey@his.com> writes:
> 
> > On Thursday, January 17, 2013 3:53:15 AM UTC-5, Sven Joachim wrote:
> >> --8<---------------cut here---------------start------------->8---
> >> === modified file 'src/term.c'
> >> --- src/term.c     2013-01-11 02:40:58 +0000
> >> +++ src/term.c     2013-01-17 08:49:20 +0000
> >> @@ -1415,7 +1415,6 @@ term_get_fkeys_1 (void)
> >> CONDITIONAL_REASSIGN ("F1", "k<", "f11");
> >> CONDITIONAL_REASSIGN ("F2", "k>", "f12");
> >> CONDITIONAL_REASSIGN ("%1", "kq", "help");
> >> -      CONDITIONAL_REASSIGN ("*6", "kU", "select");
> >> 
> >> #undef CONDITIONAL_REASSIGN
> >> 
> >> }
> 
> > A follow message says that there is a comment
> 
> >       /* IBM has their own non-standard dialect of terminfo.
> >          If the standard name isn't found, try the IBM name.  */
> 
> > which is interesting: the code fragment is dealing with termcap
> > names (the first parameter is conventional termcap names, the
> > second is not).  It is not dealing with terminfo (there is a
> > difference...).  AIX has been terminfo-only for a long time
> > (I don't have access to a machine old enough to provide an
> > example of termcap in use - that would have to be from the
> > early 1990s.
> 
> > I would suggest researching the history of this fragment,
> > and probably discarding the entire chunk as obsolete,
> > e.g., if it referred to AIX 3 or 4.
> 
> 
> 

-- 
Thomas E. Dickey <dickey@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]