Re: [NTG-context] vim syntax highlighting in MKIV

2010-09-06 Thread Aditya Mahajan

On Sat, 4 Sep 2010, Wolfgang Schuster wrote:


context’s error message is misleading, the problem appears with the \startMATLAB
command but the undefined control sequence is “\v!unknwon” as shown below the 
message,
it’s only a typo in the module and the correct value is “\v!unknown”.


Thanks. I have corrected this.

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
___


Re: [NTG-context] vim syntax highlighting in MKIV

2010-09-04 Thread Chen Shen
Hi Aditya,

Thanks for the great module!

There is a problem using t-vim/t-filter with the current and beta versions
of ConTeXt.
I was trying the Matlab example (tests/vim/matlab.tex), ConTeXt complains
that \startMATLAB is not defined,
but the execution can continue, and the correct pdf is produced.

regards,
shenchen

Below is the log message:

--
system  : module vim loaded
(t-vim.tex
system  : module filter loaded
(t-filter.tex)
color   : system hex is loaded
(/opt/home/hash/context/tex/texmf-context/tex/context/base/colo-hex.tex
(/opt/home/hash/context/tex/texmf-context/tex/context/base/colo-hex.mkiv)))
publications: loading formatting style from bxml-apa
(/opt/home/hash/context/tex/texmf-context/tex/context/base/bxml-apa.mkiv)
systems : begin file test.tex at line 6
! Undefined control sequence.

system   error on line 7 in file test.tex: Undefined control
sequence ...

 1 \setupcolors[state=start]
 2 \usemodule [vim]
 3
 4 \definevimtyping  [MATLAB]  [syntax=matlab]
 5
 6 \starttext
 7   \startMATLAB
 8 function russell_demo()
 9 % Do the example in ch 17 (p501) of Russell and Norvig
10 % (1,1) is top left corner.
11 r = 3; c = 4; p = 0.8; action_cost = -1/25;
12 obstacle = zeros(r,c); obstacle(2,2)=1;
13 terminal = zeros(r,c); terminal(1,4)=1; terminal(2,4)=1;
14 absorb = 1;
15 wrap_around = 0;
16 noop = 0;
17 T = mk_grid_world(r, c, p, obstacle, terminal, absorb, wrap_around,
noop);

argument \v!unknwon

\p!compareprocessaction ...]-\edef \!!stringb {#1
  }\ifx \!!stringb
\s!defaul...
\next1 #1,-\p!doprocessaction {#1}
   \doprocesscommaitem
\processnextcommalist ...odoprocesscommaitem #4#5,
  ]\relax \global \advance
\...
\dostartexternalfilter ...ter!!method \zerocount ]
  \doifelse
{\externalfilter...
to be read again

l.7 \startMATLAB

?

(test-externalfilter-MATLAB-0.vimout
Overfull \hbox (30.53203pt too wide) in paragraph at lines 10--10
[][][]\*modern12pf* T = mk_grid_world(r, c, p, ob-sta-cle, ter-mi-nal,
ab-sorb, wrap_around, noop);
--



On Sun, Jun 27, 2010 at 11:49 PM, Aditya Mahajan adit...@umich.edu wrote:

 On Sun, 27 Jun 2010, Peter Münster wrote:

  On Sun, Jun 27 2010, Aditya Mahajan wrote:

  In the spirit of MkIV, I have attempted to redo the vim module from
 scratch.

 http://github.com/adityam/filter

 Download t-vim.tex t-filter.tex and 2context.vim. For testing just place
 them in the current directory.


 Hello Aditya,

 Thanks for these great modules!  It would be nice to make them available
 in
 the minimals!


 I will add them to the garden, once I the features stabalize a bit.

 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

 ___


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


Re: [NTG-context] vim syntax highlighting in MKIV

2010-09-04 Thread Wolfgang Schuster

Am 04.09.2010 um 18:10 schrieb Chen Shen:

 Hi Aditya,
 
 Thanks for the great module!
 
 There is a problem using t-vim/t-filter with the current and beta versions of 
 ConTeXt.
 I was trying the Matlab example (tests/vim/matlab.tex), ConTeXt complains 
 that \startMATLAB is not defined, 
 but the execution can continue, and the correct pdf is produced.
 
 ! Undefined control sequence.
 
 system   error on line 7 in file test.tex: Undefined control 
 sequence ...
 
  1 \setupcolors[state=start]
  2 \usemodule [vim]
  3 
  4 \definevimtyping  [MATLAB]  [syntax=matlab]
  5 
  6 \starttext
  7   \startMATLAB
  8 function russell_demo()
  9 % Do the example in ch 17 (p501) of Russell and Norvig
 10 % (1,1) is top left corner.
 11 r = 3; c = 4; p = 0.8; action_cost = -1/25;
 12 obstacle = zeros(r,c); obstacle(2,2)=1;
 13 terminal = zeros(r,c); terminal(1,4)=1; terminal(2,4)=1;
 14 absorb = 1;
 15 wrap_around = 0;
 16 noop = 0;
 17 T = mk_grid_world(r, c, p, obstacle, terminal, absorb, wrap_around, 
 noop);
 
 argument \v!unknwon 

context’s error message is misleading, the problem appears with the \startMATLAB
command but the undefined control sequence is “\v!unknwon” as shown below the 
message,
it’s only a typo in the module and the correct value is “\v!unknown”.

Wolfgang


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


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-27 Thread Martin 'golodhrim' Scholz
On Sun, 27 Jun 2010 01:41:35 -0400, Aditya Mahajan wrote:

 On Sat, 26 Jun 2010, Aditya Mahajan wrote:
 
 Almost all the errors in t-vim over the years have due to trying to
 support kpse: directive. (The errors were not a fault of ConTeXt, but
 the way quotes are handled by cmd.exe and the various shells in *nix. I
 still haven't figured out a syntax that works with all shells). This
 makes me wonder whether it was a good idea to make vim module work out
 of the box. Perhaps a more robust alternative was to ask the uses to
 copy 2context.vim to $HOME/.vim/scripts/ and forget about getting
 mtxrun to locate the file. What do others think?
 
 In the spirit of MkIV, I have attempted to redo the vim module from
 scratch.
 
 http://github.com/adityam/filter
 
 Download t-vim.tex t-filter.tex and 2context.vim. For testing just place
 them in the current directory.
 
 This new version is delegates the task of creating external files and
 running vim to get syntax highlighting to t-filter. It reads the file
 under a restrictive catcode regime... so 2context.vim only has to escape
 a few characters: \ { }, everything else has a catcode other (except
 space and newline which are active).
 
 Currently, this new module only supports
 
 * syntax highlighting (syntax=filetype)
 
 * two color schemes (alternative=pscolor and alternative=blackandwhite)
 
 * specifying start and stop lines (start=... , stop=...)
 
 An additional feature is that the module stores the md5 sums of all
 files, and runs vim only if the file has changed. So, this should be
 significantly faster than the old module.
 
 Difference
 
 * No \typevimfile... instead \definevimtyping[whatever] creates a
 command \typewhateverfile that can be used as
   \typewhateverfile[options][file]
 
 * Currently, no support for line numbering, although that should be easy
 to add now.
 
 * No support for active spaces yet.
 
 * Most importantly, this only runs under MkIV. That is because
 \doprocesslocalsetups is not defined in MkII.
 
 Hans, can you add the definition of \doprocesslocalsetups to MkII?
 
 I have only tested on linux. Testing on other platforms will be
 appreciated (Just run the files under test/vim/).
 
 Aditya

Hi Aditya,
just cloned the your git and linked them into the project I use the 
syntax highlightling, and it works, thanks for the fast and professional 
help...

Greetings


-- 
---
Martin 'golodhrim' Scholz
Auf dem Sattler 4
34516 Ederbringhausen
Phone: +49 6454 799623
mobile: +49 176 63301749
Fax: +49 6454 
e-Mail: scholz@googlemail.com

Avec!

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


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-27 Thread Peter Münster
On Sun, Jun 27 2010, Aditya Mahajan wrote:

 In the spirit of MkIV, I have attempted to redo the vim module from 
 scratch.

 http://github.com/adityam/filter

 Download t-vim.tex t-filter.tex and 2context.vim. For testing just place 
 them in the current directory.

Hello Aditya,

Thanks for these great modules!  It would be nice to make them available in
the minimals!

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


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


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-27 Thread Wolfgang Schuster

Am 27.06.10 07:41, schrieb Aditya Mahajan:

On Sat, 26 Jun 2010, Aditya Mahajan wrote:

Almost all the errors in t-vim over the years have due to trying to 
support kpse: directive. (The errors were not a fault of ConTeXt, but 
the way quotes are handled by cmd.exe and the various shells in *nix. 
I still haven't figured out a syntax that works with all shells). 
This makes me wonder whether it was a good idea to make vim module 
work out of the box. Perhaps a more robust alternative was to ask the 
uses to copy 2context.vim to $HOME/.vim/scripts/ and forget about 
getting mtxrun to locate the file. What do others think?


In the spirit of MkIV, I have attempted to redo the vim module from 
scratch.


http://github.com/adityam/filter

[...]

* Most importantly, this only runs under MkIV. That is because 
\doprocesslocalsetups is not defined in MkII.


Hans, can you add the definition of \doprocesslocalsetups to MkII?


If you don't matter about performance you can use 
'\processcommacommand[...]\directsetup'


Wolfgang

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


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-27 Thread Aditya Mahajan

On Sun, 27 Jun 2010, Wolfgang Schuster wrote:


Am 27.06.10 07:41, schrieb Aditya Mahajan:


In the spirit of MkIV, I have attempted to redo the vim module from 
scratch.


http://github.com/adityam/filter

[...]

* Most importantly, this only runs under MkIV. That is because 
\doprocesslocalsetups is not defined in MkII.


Hans, can you add the definition of \doprocesslocalsetups to MkII?


If you don't matter about performance you can use 
'\processcommacommand[...]\directsetup'


Thanks. Works perfectly.

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
___


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-27 Thread Aditya Mahajan

On Sun, 27 Jun 2010, Peter Münster wrote:


On Sun, Jun 27 2010, Aditya Mahajan wrote:


In the spirit of MkIV, I have attempted to redo the vim module from
scratch.

http://github.com/adityam/filter

Download t-vim.tex t-filter.tex and 2context.vim. For testing just place
them in the current directory.


Hello Aditya,

Thanks for these great modules!  It would be nice to make them available in
the minimals!


I will add them to the garden, once I the features stabalize a bit.

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
___


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-27 Thread Martin 'golodhrim' Scholz
On Sun, 27 Jun 2010 11:49:22 -0400, Aditya Mahajan wrote:

 On Sun, 27 Jun 2010, Peter Münster wrote:
 
 On Sun, Jun 27 2010, Aditya Mahajan wrote:

 In the spirit of MkIV, I have attempted to redo the vim module from
 scratch.

 http://github.com/adityam/filter

 Download t-vim.tex t-filter.tex and 2context.vim. For testing just
 place them in the current directory.

 Hello Aditya,

 Thanks for these great modules!  It would be nice to make them
 available in the minimals!
 
 I will add them to the garden, once I the features stabalize a bit.
 
 Aditya

Hey Aditya,

if you keep them sync with your git, I would be proud to announce a 
tester in my person...

Greetings
-- 
---
Martin 'golodhrim' Scholz
Auf dem Sattler 4
34516 Ederbringhausen
Phone: +49 6454 799623
mobile: +49 176 63301749
Fax: +49 6454 
e-Mail: scholz@googlemail.com

Once harm has been done, even a fool understands it.
-- Homer

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


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-26 Thread Aditya Mahajan

On Fri, 25 Jun 2010, Hans Hagen wrote:


On 25-6-2010 9:48, Martin 'golodhrim' Scholz wrote:

Hi Hans, Mojca, Aditya and List,

just tried to use the vim Syntax Highlighting module in ConTeXt MKIV, but
if running the documents complains it searches a file called

filename-vimsyntax.tmp-vimsyntax.tmp

sure that file not exists but there is a file called

filename-vimsyntax.tmp

is there a way to do a workaround so that the vim Syntaxhighlighting
module would work in MKIV or does it need to be rewriten completedly?


probably something that M or A can fix easily


Something changed in mtxrun ...

Earlier (checked on the 2009.12.31) if I used

mtxrun bin:vim kpse:2context.vim

the kpse:2context.vim was expanded to the full path of 2context.vim. 
Now (in 2010.06.20), kpse:2context.vim expands to tree://full-path. 
Of couse, vim does not understand the tree:// prefix and cannot load the 
file. Is there an option to avoid the tree:// prefix?


Almost all the errors in t-vim over the years have due to trying to 
support kpse: directive. (The errors were not a fault of ConTeXt, but the 
way quotes are handled by cmd.exe and the various shells in *nix. I still 
haven't figured out a syntax that works with all shells). This makes me 
wonder whether it was a good idea to make vim module work out of the box. 
Perhaps a more robust alternative was to ask the uses to copy 2context.vim 
to $HOME/.vim/scripts/ and forget about getting mtxrun to locate the file. 
What do others think?


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
___


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-26 Thread Aditya Mahajan

On Sat, 26 Jun 2010, Aditya Mahajan wrote:

Almost all the errors in t-vim over the years have due to trying to support 
kpse: directive. (The errors were not a fault of ConTeXt, but the way quotes 
are handled by cmd.exe and the various shells in *nix. I still haven't 
figured out a syntax that works with all shells). This makes me wonder 
whether it was a good idea to make vim module work out of the box. Perhaps a 
more robust alternative was to ask the uses to copy 2context.vim to 
$HOME/.vim/scripts/ and forget about getting mtxrun to locate the file. What 
do others think?


In the spirit of MkIV, I have attempted to redo the vim module from 
scratch.


http://github.com/adityam/filter

Download t-vim.tex t-filter.tex and 2context.vim. For testing just place 
them in the current directory.


This new version is delegates the task of creating external files and 
running vim to get syntax highlighting to t-filter. It reads the file 
under a restrictive catcode regime... so 2context.vim only has to escape a 
few characters: \ { }, everything else has a catcode other (except space 
and newline which are active).


Currently, this new module only supports

* syntax highlighting (syntax=filetype)

* two color schemes (alternative=pscolor and alternative=blackandwhite)

* specifying start and stop lines (start=... , stop=...)

An additional feature is that the module stores the md5 sums of all files, 
and runs vim only if the file has changed. So, this should be 
significantly faster than the old module.


Difference

* No \typevimfile... instead \definevimtyping[whatever] creates a command
\typewhateverfile that can be used as
\typewhateverfile[options][file]

* Currently, no support for line numbering, although that should be easy 
to add now.


* No support for active spaces yet.

* Most importantly, this only runs under MkIV. That is because 
\doprocesslocalsetups is not defined in MkII.


Hans, can you add the definition of \doprocesslocalsetups to MkII?

I have only tested on linux. Testing on other platforms will be 
appreciated (Just run the files under test/vim/).


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
___


Re: [NTG-context] vim syntax highlighting in MKIV

2010-06-25 Thread Hans Hagen

On 25-6-2010 9:48, Martin 'golodhrim' Scholz wrote:

Hi Hans, Mojca, Aditya and List,

just tried to use the vim Syntax Highlighting module in ConTeXt MKIV, but
if running the documents complains it searches a file called

filename-vimsyntax.tmp-vimsyntax.tmp

sure that file not exists but there is a file called

filename-vimsyntax.tmp

is there a way to do a workaround so that the vim Syntaxhighlighting
module would work in MKIV or does it need to be rewriten completedly?


probably something that M or A can fix easily

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
___