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

CHARPOS on input files in general, and on the TTY in particular

In general, CHARPOS is apparently not defined on input files ("(CHARPOS TYI)"
returns an error, for example).  Since it would very useful for such tasks as
writing parsers for formatted input, this seems unfortunate, especially since
there doesn't seem to be any deep reason why reasonable and straightforward
behaviour could not be defined (even if EXACTLY matching the assumed behaviour
on a display device might be an impossible ideal).  More anomalous, however, is
its behaviour on the TTY: READ apparently updates what CHARPOS returns, whereas
READCH and TYI don't.  What is particularly odd is that TYI and READCH must
update SOMETHING, since calls to READ following calls to TYI know the character
position, including how it was modified by the TYI input.  For example, if one

    (progn (setq a (charpos t))
	   (setq b (charpos t))
	   (setq c (charpos t)))

B is always the same as A, whereas C reflects the character position reached by
BOTH the TYI input and the READ input (READCH and TYIPEEK are just like TYI in
this respect).  This seems simply odd: if TYI and READCH affect some indicator
of character position to which READ is able to refer, shouldn't CHARPOS be
expected to reflect it?

My desire, of course, would be to have CHARPOS work on input files in general;
a smaller request would be to have it behave more rationally on the TTY.