Input path to include external files with vim module
![](https://secure.gravatar.com/avatar/02a711d78d02355347d6cff73fda2572.jpg?s=120&d=mm&r=g)
Hi, does the vim module have a feature to specify the input path, similar to \usepath for context files or \setupexternalfigures [directory=…] for graphics? I'm looking for a solution not to hard-code paths into my files. Example: \usemodule [vim] \definevimtyping [XML] [syntax=xml] \starttext \typeXMLfile{code/foo.xml} % what I do now %\typeXMLfile{foo.xml} % what is desired \stoptext Marco
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Mon, 18 Jun 2012, Marco wrote:
does the vim module have a feature to specify the input path, similar to \usepath for context files or \setupexternalfigures [directory=…] for graphics?
Currently, it does not.
I'm looking for a solution not to hard-code paths into my files. Example:
\usemodule [vim] \definevimtyping [XML] [syntax=xml]
\starttext \typeXMLfile{code/foo.xml} % what I do now %\typeXMLfile{foo.xml} % what is desired \stoptext
I'll see how easy it is to hook into the code for \usepath etc. It might be best to add this feature to the filter module, but I'll have to come up with another key as `directory` is already taken to specify output directory. Aditya
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Tue, 19 Jun 2012, Aditya Mahajan wrote:
On Mon, 18 Jun 2012, Marco wrote:
does the vim module have a feature to specify the input path, similar to \usepath for context files or \setupexternalfigures [directory=…] for graphics?
@Hans: Can we make the following change in file-res.lua if isfile(fname) then if trace_files then report_files("found on extra path: %s",fname) --AM: was name end fnd = fname --- AM: was name break end Then, getreadfilename("any", ".", name) will always return the location of the found file. This is also consistent with the behavior when the file is found in ../ or ../../ directories. This change should not affect the \readfilename macros and will allow me to use \def\externalfilter@any_filename#1% {\ctxcommand{getreadfilename("any",".","#1")}} to search for a file (even if it is in the path specified by \usepath). Aditya
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 20-6-2012 19:33, Aditya Mahajan wrote:
On Tue, 19 Jun 2012, Aditya Mahajan wrote:
On Mon, 18 Jun 2012, Marco wrote:
does the vim module have a feature to specify the input path, similar to \usepath for context files or \setupexternalfigures [directory=…] for graphics?
@Hans: Can we make the following change in file-res.lua
if isfile(fname) then if trace_files then report_files("found on extra path: %s",fname) --AM: was name end fnd = fname --- AM: was name break end
Then, getreadfilename("any", ".", name) will always return the location of the found file. This is also consistent with the behavior when the file is found in ../ or ../../ directories.
sure, just call it a bug -) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Wed, 20 Jun 2012, Hans Hagen wrote:
On 20-6-2012 19:33, Aditya Mahajan wrote:
On Tue, 19 Jun 2012, Aditya Mahajan wrote:
On Mon, 18 Jun 2012, Marco wrote:
does the vim module have a feature to specify the input path, similar to \usepath for context files or \setupexternalfigures [directory=…] for graphics?
@Hans: Can we make the following change in file-res.lua
if isfile(fname) then if trace_files then report_files("found on extra path: %s",fname) --AM: was name end fnd = fname --- AM: was name break end
Then, getreadfilename("any", ".", name) will always return the location of the found file. This is also consistent with the behavior when the file is found in ../ or ../../ directories.
sure, just call it a bug -)
Thanks. @Marco: In the next version of t-filter (and by inheritence t-vim), the local files will also be searched in \usepath locations. Thus you can use: \usepath[list-of, paths] \starttext \process<fillter>file{file-in-path} \type<vim>file{file-in-path} \stoptext For the moment, this is MkIV only feature. If you want to experiment, make the above change in file-res.lua, regenerate the formats, and use t-filter.mkiv from github. Aditya
![](https://secure.gravatar.com/avatar/02a711d78d02355347d6cff73fda2572.jpg?s=120&d=mm&r=g)
On 2012-06-20 Aditya Mahajan
@Marco: In the next version of t-filter (and by inheritence t-vim), the local files will also be searched in \usepath locations.
Thanks a million. I'm surprised that this feature needs so little change in the source.
For the moment, this is MkIV only feature.
Since this is a new feature and not a bug fix I see no need to keep MkII and MkIV in sync. For new projects I use MkIV since quite some time and the MkII projects are in danger of extinction.
If you want to experiment, make the above change in file-res.lua, regenerate the formats, and use t-filter.mkiv from github.
I will test it and report back if things break. Marco
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Wed, 20 Jun 2012, Marco wrote:
On 2012-06-20 Aditya Mahajan
wrote: Hi Aditya.
@Marco: In the next version of t-filter (and by inheritence t-vim), the local files will also be searched in \usepath locations.
Thanks a million. I'm surprised that this feature needs so little change in the source.
Hooking into existing ConTeXt code is easy :)
For the moment, this is MkIV only feature.
Since this is a new feature and not a bug fix I see no need to keep MkII and MkIV in sync. For new projects I use MkIV since quite some time and the MkII projects are in danger of extinction.
Actually, I added suport for MkII as well. It was not that difficult after all.
If you want to experiment, make the above change in file-res.lua, regenerate the formats, and use t-filter.mkiv from github.
I will test it and report back if things break.
Aditya
participants (3)
-
Aditya Mahajan
-
Hans Hagen
-
Marco