[tex-k] A way to obtain filename for editor in TeX

Igor Liferenko igor.liferenko at gmail.com
Wed Dec 23 07:31:28 CET 2020

Hi all,

Fact #1: In §537 the name of file being \input from main file is removed from
string pool:

    if name=str_ptr-1 then {we can conserve string pool space now}
      begin flush_string; name:=cur_name;

Fact #2: In §84 the name of file for editor is invalid due to Fact #1.

Let us *not* change §537 (as all implementations do). After all,
§537 is *not* in "system dependencies". We are left with one
option - change §84 (which *is* in "system dependencies").

You can't deny that either it is a bug that §537 is not in "system
or it is a bug in TeX, because an implementation of
TeX which is required to open editor when given
the command `E' fails to do it (because filename is invalid).

I will sum up what I found out so far:

On the TOPS-20 systems where TeX was developed was
that an open alpha_file could be queried to get
the filename. It seems this could be the solution: use
current input file handle to get filename.

But which file handle corresponds to the file to be opened in editor?

I asked this question a lot of people, but *nobody* could answer.

Also, I found out by trial-and-error that "cur_file" cannot be used to
obtain filename for editor:

While using "cur_file" to obtain the filename works for input like


it fails for input like

    \centerline{A SHORT \ERROR STORY}

Therefore, using "cur_file" is not the answer.

Karl, please don't miss this chance to ask Prof. Knuth this question.


More information about the tex-k mailing list.