unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Thomas Dickey <dickey@his.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: gnu.emacs.bug@googlegroups.com, Sven Joachim <svenjoac@gmx.de>,
	dickey@his.com, 13471@debbugs.gnu.org
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	[thread overview]
Message-ID: <20130118000221.GA9212@aerie.jexium-island.net> (raw)
In-Reply-To: <jwvlibrbtn2.fsf-monnier+bug#13471@gnu.org>

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

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2013-01-18  0:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.17669.1358412868.855.bug-gnu-emacs@gnu.org>
2013-01-17  9:33 ` bug#13471: 24.3.50; S-up does not work in xterm: <select> is undefined dickey
2013-01-17  9:55   ` Andreas Schwab
2013-01-17 10:06     ` Thomas Dickey
2013-01-17 10:22       ` Thomas Dickey
2013-01-17 10:28       ` Andreas Schwab
2013-01-17 10:38         ` Thomas Dickey
2013-01-17 10:49           ` Andreas Schwab
2013-01-17 10:53             ` Thomas Dickey
2013-01-17 11:11               ` Andreas Schwab
2013-01-17 11:00   ` Andreas Schwab
2013-01-17 11:45     ` Thomas Dickey
2013-01-17 17:37   ` Stefan Monnier
2013-01-18  0:02     ` Thomas Dickey [this message]
2013-01-18 14:12       ` Andreas Schwab
     [not found]       ` <mailman.17815.1358518404.855.bug-gnu-emacs@gnu.org>
2013-01-18 23:30         ` dickey
2013-01-19 10:29           ` Juri Linkov
2013-01-19 14:20             ` Stefan Monnier
2013-01-19 19:19               ` Thomas Dickey
2013-12-11  0:32               ` Juri Linkov
2013-01-17  8:53 Sven Joachim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130118000221.GA9212@aerie.jexium-island.net \
    --to=dickey@his.com \
    --cc=13471@debbugs.gnu.org \
    --cc=gnu.emacs.bug@googlegroups.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=svenjoac@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).