Re: [code] [textadept] Filename variants/canonical filenames

From: Mitchell <>
Date: Sun, 22 Dec 2013 21:44:53 -0500 (EST)

Hi Chris,

On Wed, 6 Nov 2013, Chris Emerson wrote:

> Hi Mitchell,
> On Wed, Nov 06, 2013 at 11:10:18AM -0500, Mitchell wrote:
>> On Wed, 6 Nov 2013, Chris Emerson wrote:
>>> I often seem to end up with the same file open in different buffers with
>>> different names, for example:
>>> dir/foo.txt
>>> ./dir/foo.txt
>>> /home/chris/dir/foo.txt
>>> dir//foo.txt
>>> Would it be reasonable for io.open_file() to catch these?
>> It tries to, but appears to fall short in the cases you describe. If
>> you can reproduce those bugs, I'll try and fix them.
> I can reproduce the above just by typing those names into the file open
> dialog. In my real use case the filenames come out of the tags file or
> a recursive grep, etc. and are passed directly to io.open_file().

I've had a chance to look into this. No, I do not believe `io.open_file()`
should be responsible for opening relative paths properly, as it will
probably get it wrong. (For things like tag files, those paths are
probably relative to something other than the current working directory.)

Instead, tools like Find in Files or Run/Compile create absolute paths to
"get it right". Loading files from the command line (`core/args.lua`) does
the same, even though relative paths are specified on the command line.
Thus, your tool should construct the absolute path. On the other hand, if
ta is not passing absolute paths to `io.open_file()`, that is probably a
bug and should be fixed.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sun 22 Dec 2013 - 21:44:53 EST

This archive was generated by hypermail 2.2.0 : Mon 23 Dec 2013 - 06:36:05 EST