ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Input path to include external files with vim module
@ 2012-06-18 10:17 Marco
  2012-06-19  4:36 ` Aditya Mahajan
  0 siblings, 1 reply; 7+ messages in thread
From: Marco @ 2012-06-18 10:17 UTC (permalink / raw)
  To: ntg-context

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


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Input path to include external files with vim module
  2012-06-18 10:17 Input path to include external files with vim module Marco
@ 2012-06-19  4:36 ` Aditya Mahajan
  2012-06-20 17:33   ` Aditya Mahajan
  0 siblings, 1 reply; 7+ messages in thread
From: Aditya Mahajan @ 2012-06-19  4:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 741 bytes --]

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

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Input path to include external files with vim module
  2012-06-19  4:36 ` Aditya Mahajan
@ 2012-06-20 17:33   ` Aditya Mahajan
  2012-06-20 17:46     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Aditya Mahajan @ 2012-06-20 17:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 984 bytes --]

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

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Input path to include external files with vim module
  2012-06-20 17:33   ` Aditya Mahajan
@ 2012-06-20 17:46     ` Hans Hagen
  2012-06-20 19:46       ` Aditya Mahajan
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2012-06-20 17:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
-----------------------------------------------------------------


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Input path to include external files with vim module
  2012-06-20 17:46     ` Hans Hagen
@ 2012-06-20 19:46       ` Aditya Mahajan
  2012-06-20 20:40         ` Marco
  0 siblings, 1 reply; 7+ messages in thread
From: Aditya Mahajan @ 2012-06-20 19:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1374 bytes --]

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

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Input path to include external files with vim module
  2012-06-20 19:46       ` Aditya Mahajan
@ 2012-06-20 20:40         ` Marco
  2012-06-20 20:58           ` Aditya Mahajan
  0 siblings, 1 reply; 7+ messages in thread
From: Marco @ 2012-06-20 20:40 UTC (permalink / raw)
  To: ntg-context

On 2012-06-20 Aditya Mahajan <adityam@umich.edu> 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.

> 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


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Input path to include external files with vim module
  2012-06-20 20:40         ` Marco
@ 2012-06-20 20:58           ` Aditya Mahajan
  0 siblings, 0 replies; 7+ messages in thread
From: Aditya Mahajan @ 2012-06-20 20:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 20 Jun 2012, Marco wrote:

> On 2012-06-20 Aditya Mahajan <adityam@umich.edu> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-06-20 20:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-18 10:17 Input path to include external files with vim module Marco
2012-06-19  4:36 ` Aditya Mahajan
2012-06-20 17:33   ` Aditya Mahajan
2012-06-20 17:46     ` Hans Hagen
2012-06-20 19:46       ` Aditya Mahajan
2012-06-20 20:40         ` Marco
2012-06-20 20:58           ` Aditya Mahajan

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 NNTP newsgroup(s).