ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Problem with Filter Module in latent context beta
@ 2018-04-14 12:21 Lutz Haseloff
  2018-04-14 13:02 ` Aditya Mahajan
  2018-04-17  2:52 ` Aditya Mahajan
  0 siblings, 2 replies; 17+ messages in thread
From: Lutz Haseloff @ 2018-04-14 12:21 UTC (permalink / raw)
  To: Context Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 1293 bytes --]

Hi all,

with latest context my filter test file fails with an error. My file:

\usemodule[filter]
\defineexternalfilter
        [luatexdevelopmentlevel]
        [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}]
\starttext
 \inlineluatexdevelopmentlevel{}
\stoptext

Error message:


loading         > Module Catcodes (ver: 2011.12.17)

tex error       > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence

l.96 ...tivecatcode  \gdef\activeendoflinetoken{^^M}


 86     \stopcatcodetable
 87
 88
 89
 90     \ifdefined \activeendoflinetoken \else
 91         % from catc-ini.mkiv
 92         \bgroup
 93             \catcode \tabasciicode       \activecatcode  \gdef\activetabtoken      {^^I}
 94                                                          \gdef\outputnewlinechar   {^^J}
 95             \catcode \formfeedasciicode  \activecatcode  \gdef\activeformfeedtoken {^^L}
 96 >>          \catcode \endoflineasciicode \activecatcode  \gdef\activeendoflinetoken{^^M}
 97         \egroup
 98     \fi
 99
100     \protectmodulecatcodes
101     \stopmodule
102

I append the logfile.

Greetings Lutz
-- 
GPG Key ID 3C4F83BC

[-- Attachment #1.2: Type: text/html, Size: 1484 bytes --]

[-- Attachment #2: filtertest.log --]
[-- Type: text/plain, Size: 6834 bytes --]

open source     > level 1, order 1, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system          > 
system          > ConTeXt  ver: 2018.04.13 14:53 MKIV beta  fmt: 2018.4.14  int: english/english
system          > 
system          > 'cont-new.mkiv' loaded
open source     > level 2, order 2, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
close source    > level 2, order 2, name '/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system          > files > jobname 'filtertest', input './filtertest', result 'filtertest'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
open source     > level 2, order 3, name '/home/filtertest.tex'
modules         > 'filter' is loaded
open source     > level 3, order 4, name '/usr/local/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv'
loading         > Filter (ver: 2016.03.02)
modules         > 'module-catcodes' is loaded
open source     > level 4, order 5, name '/usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex'
loading         > Module Catcodes (ver: 2011.12.17)

tex error       > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence

l.96 ...tivecatcode  \gdef\activeendoflinetoken{^^M}
                                                  

 86     \stopcatcodetable
 87     
 88     
 89     
 90     \ifdefined \activeendoflinetoken \else
 91         % from catc-ini.mkiv
 92         \bgroup
 93             \catcode \tabasciicode       \activecatcode  \gdef\activetabtoken      {^^I}
 94                                                          \gdef\outputnewlinechar   {^^J}
 95             \catcode \formfeedasciicode  \activecatcode  \gdef\activeformfeedtoken {^^L}
 96 >>          \catcode \endoflineasciicode \activecatcode  \gdef\activeendoflinetoken{^^M}
 97         \egroup
 98     \fi
 99     
100     \protectmodulecatcodes
101     \stopmodule
102     


? x

system          > start used files

system          > text: filtertest

system          > stop used files


system          > start used files

system          >    1: filename=char-prv.lua filetype=tex format=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/char-prv.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/char-prv.lua usedmethod=database
system          >    2: filename=cont-yes.mkiv filetype=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv usedmethod=database
system          >    3: filename=publ-imp-default.lua filetype=lua foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua usedmethod=database
system          >    4: filename=cont-new.mkiv filetype=tex foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv usedmethod=database
system          >    5: filename=lang-exc.lua filetype=lua foundname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua fullname=/usr/local/context/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua usedmethod=database
system          >    6: filename=lang-us.lua filetype=lua foundname=/usr/local/context/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua fullname=/usr/local/context/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua usedmethod=database
system          >    7: filename=/home/filtertest.tex foundname=/home/filtertest.tex fullname=/home/filtertest.tex usedmethod=direct
system          >    8: filename=t-filter.mkiv filetype=tex foundname=/usr/local/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv fullname=/usr/local/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv usedmethod=database
system          >    9: filename=t-module-catcodes.tex filetype=tex foundname=/usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex fullname=/usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex usedmethod=database

system          > stop used files


system          > start commandline options

system          > currentrun="1"
system          > fulljobname="./filtertest.tex"
system          > input="./filtertest.tex"
system          > kindofrun="1"
system          > maxnofruns="9"
system          > no-parse-first-line="true"

system          > stop commandline options


system          > start commandline files

system          >    1: ./filtertest.tex

system          > stop commandline files


modules         > start used modules

modules         > loaded : *-filter
modules         > loaded : *-module-catcodes

modules         > stop used modules


mkiv lua stats  > used config file: selfautoparent:/texmf/web2c/texmfcnf.lua
mkiv lua stats  > used cache path: /usr/local/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e
mkiv lua stats  > resource resolver: loadtime 0.046 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 9 found files, scanned paths: <none>
mkiv lua stats  > stored bytecode data: 424 modules (0.815 sec), 93 tables (0.067 sec), 517 chunks (0.882 sec)
mkiv lua stats  > traced context: maxstack: 1292, freed: 0, unreachable: 1292
mkiv lua stats  > cleaned up reserved nodes: 55 nodes, 9 lists of 453
mkiv lua stats  > node memory usage: 1 dir, 2 kern, 2 attribute, 50 glue_spec, 1 attribute_list, 2 temp, 1 if_stack, 2 user_defined
mkiv lua stats  > used backend: pdf (backend for directly generating pdf output)
mkiv lua stats  > jobdata time: 0.000 seconds saving, 0.000 seconds loading
mkiv lua stats  > callbacks: internal: 47, file: 235, direct: 6, late: 0, function 59, total: 347
mkiv lua stats  > loaded tex modules: 2 requested, all found (*-filter *-module-catcodes)
mkiv lua stats  > loaded patterns: en::2, load time: 0.000
mkiv lua stats  > result saved in file: filtertest.pdf, compresslevel 3, objectcompresslevel 3
mkiv lua stats  > font engine: otf 3.103, afm 1.513, tfm 1.000
mkiv lua stats  > used platform: unknown, type: unix, binary subtree: texmf-linux-armhf
mkiv lua stats  > used engine: luatex version 1.08 with functionality level 6700, banner: this is luatex, version 1.08.0 (tex live 2018)
mkiv lua stats  > control sequences: 44709 of 65536 + 100000
mkiv lua stats  > lua properties: engine: lua 5.3, used memory: 57 MB (ctx: 57 MB), hash type: lua, hash chars: min(64,40), symbol mask: utf (τεχ)
mkiv lua stats  > runtime: 11.096 seconds


[-- Attachment #3: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-14 12:21 Problem with Filter Module in latent context beta Lutz Haseloff
@ 2018-04-14 13:02 ` Aditya Mahajan
  2018-04-14 15:59   ` Hans Hagen
  2018-04-14 19:52   ` Lutz Haseloff
  2018-04-17  2:52 ` Aditya Mahajan
  1 sibling, 2 replies; 17+ messages in thread
From: Aditya Mahajan @ 2018-04-14 13:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 14 Apr 2018, Lutz Haseloff wrote:

> Hi all,
>
> with latest context my filter test file fails with an error. My file:
>
> \usemodule[filter]
> \defineexternalfilter
>        [luatexdevelopmentlevel]
>        [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}]
> \starttext
> \inlineluatexdevelopmentlevel{}
> \stoptext

There should be a more direct way of getting this information!

> Error message:
>
>
> loading         > Module Catcodes (ver: 2011.12.17)
>
> tex error       > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence
>
> l.96 ...tivecatcode  \gdef\activeendoflinetoken{^^M}
>
>
> 86     \stopcatcodetable
> 87
> 88
> 89
> 90     \ifdefined \activeendoflinetoken \else
> 91         % from catc-ini.mkiv
> 92         \bgroup
> 93             \catcode \tabasciicode       \activecatcode  \gdef\activetabtoken      {^^I}
> 94                                                          \gdef\outputnewlinechar   {^^J}
> 95             \catcode \formfeedasciicode  \activecatcode  \gdef\activeformfeedtoken {^^L}
> 96 >>          \catcode \endoflineasciicode \activecatcode  \gdef\activeendoflinetoken{^^M}
> 97         \egroup
> 98     \fi
> 99
> 100     \protectmodulecatcodes
> 101     \stopmodule
> 102

I am not on a machine with latest context (and cannot update right now). 
The code above was taken from catc-ini.mkiv, but that file changed in the 
latest update. Could you please run the following test and see if it 
works:

1. Copy t-module-catcodes.tex to your local directory.
2. Change \gdef\activetabtoken{^^M} with

    \xdef\activetabtoken      {\Uchar\tabasciicode      }

and similar for other \gdef's according to lines 121-124 of 
https://github.com/contextgarden/context-mirror/blob/25fcad7435f56cdce2658336909f4da6a65589c0/tex/context/base/mkiv/catc-ini.mkiv

and run your test again.

Thank you for the report.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-14 13:02 ` Aditya Mahajan
@ 2018-04-14 15:59   ` Hans Hagen
  2018-04-14 19:52   ` Lutz Haseloff
  1 sibling, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2018-04-14 15:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Aditya Mahajan

On 4/14/2018 3:02 PM, Aditya Mahajan wrote:
> On Sat, 14 Apr 2018, Lutz Haseloff wrote:
> 
>> Hi all,
>>
>> with latest context my filter test file fails with an error. My file:
>>
>> \usemodule[filter]
>> \defineexternalfilter
>>        [luatexdevelopmentlevel]
>>        [filtercommand={luatex --credits | grep Development > 
>> \externalfilteroutputfile}]
>> \starttext
>> \inlineluatexdevelopmentlevel{}
>> \stoptext
> 

> There should be a more direct way of getting this information!
> I am not on a machine with latest context (and cannot update right now). 
> The code above was taken from catc-ini.mkiv, but that file changed in 
> the latest update. Could you please run the following test and see if it 
> works:
> 
> 1. Copy t-module-catcodes.tex to your local directory.
> 2. Change \gdef\activetabtoken{^^M} with
> 
>     \xdef\activetabtoken      {\Uchar\tabasciicode      }
> 
> and similar for other \gdef's according to lines 121-124 of 
> https://github.com/contextgarden/context-mirror/blob/25fcad7435f56cdce2658336909f4da6a65589c0/tex/context/base/mkiv/catc-ini.mkiv 
what exactly do you want to achieve ... i tried to get rid of ^^ syntax 
in all files ...

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-14 13:02 ` Aditya Mahajan
  2018-04-14 15:59   ` Hans Hagen
@ 2018-04-14 19:52   ` Lutz Haseloff
  2018-04-14 22:07     ` Hans Hagen
  1 sibling, 1 reply; 17+ messages in thread
From: Lutz Haseloff @ 2018-04-14 19:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3828 bytes --]

I get another error message:

open source     > level 4, order 5, name 't-module-catcodes.tex'
loading         > Module Catcodes (ver: 2011.12.17)

tex error       > tex error on line 96 in file t-module-catcodes.tex: ! Undefined control sequence

l.96 ...iveendoflinetoken{\Uchar\endoflineasciicode}
                                                  

 86     \stopcatcodetable
 87     
 88     
 89     
 90     \ifdefined \activeendoflinetoken \else
 91         % from catc-ini.mkiv
 92         \bgroup
 93             \catcode \tabasciicode       \activecatcode  \xdef\activetabtoken      {\Uchar\tabasciicode}
 94                                                          \xdef\outputnewlinechar   {\Uchar\newlineasciicode}
 95             \catcode \formfeedasciicode  \activecatcode  \xdef\activeformfeedtoken {\Uchar\formfeedasciicode}
 96 >>          \catcode \endoflineasciicode \activecatcode  \xdef\activeendoflinetoken{\Uchar\endoflineasciicode}
 97         \egroup
 98     \fi
 99     
100     \protectmodulecatcodes
101     \stopmodule
102     


Am 14. April 2018 15:02:09 MESZ schrieb Aditya Mahajan <adityam@umich.edu>:
>On Sat, 14 Apr 2018, Lutz Haseloff wrote:
>
>> Hi all,
>>
>> with latest context my filter test file fails with an error. My file:
>>
>> \usemodule[filter]
>> \defineexternalfilter
>>        [luatexdevelopmentlevel]
>>        [filtercommand={luatex --credits | grep Development >
>\externalfilteroutputfile}]
>> \starttext
>> \inlineluatexdevelopmentlevel{}
>> \stoptext
>
>There should be a more direct way of getting this information!
>
>> Error message:
>>
>>
>> loading         > Module Catcodes (ver: 2011.12.17)
>>
>> tex error       > tex error on line 96 in file
>/usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex:
>! Undefined control sequence
>>
>> l.96 ...tivecatcode  \gdef\activeendoflinetoken{^^M}
>>
>>
>> 86     \stopcatcodetable
>> 87
>> 88
>> 89
>> 90     \ifdefined \activeendoflinetoken \else
>> 91         % from catc-ini.mkiv
>> 92         \bgroup
>> 93             \catcode \tabasciicode       \activecatcode 
>\gdef\activetabtoken      {^^I}
>> 94                                                         
>\gdef\outputnewlinechar   {^^J}
>> 95             \catcode \formfeedasciicode  \activecatcode 
>\gdef\activeformfeedtoken {^^L}
>> 96 >>          \catcode \endoflineasciicode \activecatcode 
>\gdef\activeendoflinetoken{^^M}
>> 97         \egroup
>> 98     \fi
>> 99
>> 100     \protectmodulecatcodes
>> 101     \stopmodule
>> 102
>
>I am not on a machine with latest context (and cannot update right
>now). 
>The code above was taken from catc-ini.mkiv, but that file changed in
>the 
>latest update. Could you please run the following test and see if it 
>works:
>
>1. Copy t-module-catcodes.tex to your local directory.
>2. Change \gdef\activetabtoken{^^M} with
>
>    \xdef\activetabtoken      {\Uchar\tabasciicode      }
>
>and similar for other \gdef's according to lines 121-124 of 
>https://github.com/contextgarden/context-mirror/blob/25fcad7435f56cdce2658336909f4da6a65589c0/tex/context/base/mkiv/catc-ini.mkiv
>
>and run your test again.
>
>Thank you for the report.
>
>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://context.aanhet.net
>archive  : https://bitbucket.org/phg/context-mirror/commits/
>wiki     : http://contextgarden.net
>___________________________________________________________________________________

-- 
GPG Key ID 3C4F83BC

[-- Attachment #1.2: Type: text/html, Size: 4727 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-14 19:52   ` Lutz Haseloff
@ 2018-04-14 22:07     ` Hans Hagen
  2018-04-15  5:08       ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2018-04-14 22:07 UTC (permalink / raw)
  To: ntg-context

On 4/14/2018 9:52 PM, Lutz Haseloff wrote:
> I get another error message:
> 
> open source > level 4, order 5, name 't-module-catcodes.tex'
> loading > Module Catcodes (ver: 2011.12.17)
> 
> tex error > tex error on line 96 in file t-module-catcodes.tex: ! 
> Undefined control sequence
why are special catcodes needed? an dif so, there are often easier ways 
than low level hacking

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-14 22:07     ` Hans Hagen
@ 2018-04-15  5:08       ` Aditya Mahajan
  2018-04-15 10:21         ` Hans Hagen
  0 siblings, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2018-04-15  5:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 15 Apr 2018, Hans Hagen wrote:

> On 4/14/2018 9:52 PM, Lutz Haseloff wrote:
>> I get another error message:
>> 
>> open source > level 4, order 5, name 't-module-catcodes.tex'
>> loading > Module Catcodes (ver: 2011.12.17)
>> 
>> tex error > tex error on line 96 in file t-module-catcodes.tex: ! 
>> Undefined control sequence
> why are special catcodes needed? an dif so, there are often easier ways 
> than low level hacking

This is the commit (from 2011!) where I added this code:

https://github.com/adityam/filter/commit/c34023fd1ede0909a056a10c6352202f2295fba4

My guess is that I did not want multiple newlines to collapse in t-vim, so 
I had redefined \activeendoflinetoken to {\strut\par}. The offending 
lines are copied from catc-ini.mkiv from the same time:

https://github.com/contextgarden/context-mirror/blob/5056d7a854142aa63032b0a3ca4d41c496e41faf/tex/context/base/catc-ini.mkiv

to make sure that I use the same syntax for MkII and MkIV.

A couple of years after that I split the MkII and MkIV code into separate 
files, but I never touched the catcode part (because it was working).

I cannot test the latest beta right now; I'll test it on Monday. In the 
meanwhile, what is the current recommended method to alter the way literal 
newlines and tabs are shown.


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-15  5:08       ` Aditya Mahajan
@ 2018-04-15 10:21         ` Hans Hagen
  2018-04-16 16:52           ` Aditya Mahajan
  2018-04-16 21:27           ` Aditya Mahajan
  0 siblings, 2 replies; 17+ messages in thread
From: Hans Hagen @ 2018-04-15 10:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Aditya Mahajan

On 4/15/2018 7:08 AM, Aditya Mahajan wrote:
> On Sun, 15 Apr 2018, Hans Hagen wrote:
> 
>> On 4/14/2018 9:52 PM, Lutz Haseloff wrote:
>>> I get another error message:
>>>
>>> open source > level 4, order 5, name 't-module-catcodes.tex'
>>> loading > Module Catcodes (ver: 2011.12.17)
>>>
>>> tex error > tex error on line 96 in file t-module-catcodes.tex: ! 
>>> Undefined control sequence
>> why are special catcodes needed? an dif so, there are often easier 
>> ways than low level hacking
> 
> This is the commit (from 2011!) where I added this code:
> 
> https://github.com/adityam/filter/commit/c34023fd1ede0909a056a10c6352202f2295fba4 
> 
> 
> My guess is that I did not want multiple newlines to collapse in t-vim, 
> so I had redefined \activeendoflinetoken to {\strut\par}. The offending 
> lines are copied from catc-ini.mkiv from the same time:
> 
> https://github.com/contextgarden/context-mirror/blob/5056d7a854142aa63032b0a3ca4d41c496e41faf/tex/context/base/catc-ini.mkiv 
> 
> 
> to make sure that I use the same syntax for MkII and MkIV.
> 
> A couple of years after that I split the MkII and MkIV code into 
> separate files, but I never touched the catcode part (because it was 
> working).
> 
> I cannot test the latest beta right now; I'll test it on Monday. In the 
> meanwhile, what is the current recommended method to alter the way 
> literal newlines and tabs are shown.
\starttext

\start
\def\obeyedline{\blank[line]} \obeylines

line 1


line 2

line 3

\stop

\stoptext

blank will cleanup for you


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-15 10:21         ` Hans Hagen
@ 2018-04-16 16:52           ` Aditya Mahajan
  2018-04-16 17:55             ` Hans Hagen
  2018-04-16 21:27           ` Aditya Mahajan
  1 sibling, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2018-04-16 16:52 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

On Sun, 15 Apr 2018, Hans Hagen wrote:

> \start
> \def\obeyedline{\blank[line]} \obeylines

Thanks! Not sure why I wasn't using that since the beginning.

I am testing with the latest beta and I get another bug with reading http 
files. This is a simplified version of what I use in the filter module:

    \unprotect
     \def\AnyFilename#1%
         {\ctxcommand{getreadfilename("any",".","#1")}}

     \def\ProcessFile#1%
       {\edef\InputFile{\AnyFilename{#1}}%
        \InputFile
        \typefile[\InputFile]}
     \protect
     \starttext
     \ProcessFile{http://cim.mcgill.ca/~adityam/index.html}
     \stoptext

With the latest beta, I get the following error:


...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: bad 
argument #1 to 'find' (string expected, got nil)
stack traceback:
         [C]: in function 'string.find'
         ...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: 
in upvalue 'action1'
         [string "local action = tokens._action..."]:4: in field 
'getreadfilename'
         [ctxlua]:1: in main chunk


Not sure why #1 is being passed to the lua function instead of the 
expanded value of "#1".

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-16 16:52           ` Aditya Mahajan
@ 2018-04-16 17:55             ` Hans Hagen
  0 siblings, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2018-04-16 17:55 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

On 4/16/2018 6:52 PM, Aditya Mahajan wrote:
> On Sun, 15 Apr 2018, Hans Hagen wrote:
> 
>> \start
>> \def\obeyedline{\blank[line]} \obeylines
> 
> Thanks! Not sure why I wasn't using that since the beginning.
> 
> I am testing with the latest beta and I get another bug with reading 
> http files. This is a simplified version of what I use in the filter 
> module:
> 
>     \unprotect
>      \def\AnyFilename#1%
>          {\ctxcommand{getreadfilename("any",".","#1")}}
> 
>      \def\ProcessFile#1%
>        {\edef\InputFile{\AnyFilename{#1}}%
>         \InputFile
>         \typefile[\InputFile]}
>      \protect
>      \starttext
>      \ProcessFile{http://cim.mcgill.ca/~adityam/index.html}
>      \stoptext
> 
> With the latest beta, I get the following error:
> 
> 
> ...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: bad 
> argument #1 to 'find' (string expected, got nil)
> stack traceback:
>          [C]: in function 'string.find'
>          
> ...inimals/texmf-context/tex/context/base/mkiv/file-res.lua:147: in 
> upvalue 'action1'
>          [string "local action = tokens._action..."]:4: in field 
> 'getreadfilename'
>          [ctxlua]:1: in main chunk
> 
> 
> Not sure why #1 is being passed to the lua function instead of the 
> expanded value of "#1".
hm, i'll check it

#1 just means first argument in lua -)

use this:

\unprotect
\def\AnyFilename#1{\clf_getreadfilename{any}{.}{#1}}
\protect


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-15 10:21         ` Hans Hagen
  2018-04-16 16:52           ` Aditya Mahajan
@ 2018-04-16 21:27           ` Aditya Mahajan
  2018-04-16 21:59             ` Hans Hagen
  2018-04-16 22:01             ` Aditya Mahajan
  1 sibling, 2 replies; 17+ messages in thread
From: Aditya Mahajan @ 2018-04-16 21:27 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

On Sun, 15 Apr 2018, Hans Hagen wrote:

> On 4/15/2018 7:08 AM, Aditya Mahajan wrote:
>> On Sun, 15 Apr 2018, Hans Hagen wrote:
>> 
>>> On 4/14/2018 9:52 PM, Lutz Haseloff wrote:
>>>> I get another error message:
>>>> 
>>>> open source > level 4, order 5, name 't-module-catcodes.tex'
>>>> loading > Module Catcodes (ver: 2011.12.17)
>>>> 
>>>> tex error > tex error on line 96 in file t-module-catcodes.tex: ! 
>>>> Undefined control sequence
>>> why are special catcodes needed? an dif so, there are often easier ways 
>>> than low level hacking
>> 
>> This is the commit (from 2011!) where I added this code:
>> 
>> https://github.com/adityam/filter/commit/c34023fd1ede0909a056a10c6352202f2295fba4 
>> 
>> My guess is that I did not want multiple newlines to collapse in t-vim, so 
>> I had redefined \activeendoflinetoken to {\strut\par}. The offending lines 
>> are copied from catc-ini.mkiv from the same time:
>> 
>> https://github.com/contextgarden/context-mirror/blob/5056d7a854142aa63032b0a3ca4d41c496e41faf/tex/context/base/catc-ini.mkiv 
>> 
>> to make sure that I use the same syntax for MkII and MkIV.
>> 
>> A couple of years after that I split the MkII and MkIV code into separate 
>> files, but I never touched the catcode part (because it was working).
>> 
>> I cannot test the latest beta right now; I'll test it on Monday. In the 
>> meanwhile, what is the current recommended method to alter the way literal 
>> newlines and tabs are shown.
> \starttext
>
> \start
> \def\obeyedline{\blank[line]} \obeylines
>
> line 1
>
>
> line 2
>
> line 3
>
> \stop
>
> \stoptext
>
> blank will cleanup for you

I don't want multiple empty lines to collapse (this is for code listing). 
Here is a minimal example showing what t-vim is doing:

\newcatcodetable \MinimalCatcodes

\startcatcodetable \MinimalCatcodes % for reading t-vim output
     \catcode\backslashasciicode  = \escapecatcode
     \catcode\leftbraceasciicode  = \begingroupcatcode
     \catcode\rightbraceasciicode = \endgroupcatcode
     \catcode\endoflineasciicode  = \activecatcode
     \catcode\formfeedasciicode   = \othercatcode
     \catcode\spaceasciicode      = \othercatcode
\stopcatcodetable

\starttext
\bgroup
\def\obeyedline{\strut\par}
%\def\obeyedline{\blank[line]}
\setcatcodetable\MinimalCatcodes\letcharcode\endoflineasciicode\obeyedline
This is a \color[red]{test}




To check multiple lines as well as color
\egroup
\stoptext



If I replace the {\strut\par} with {\blank[line]}, multiple empty lines 
are collapsed to a single line.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-16 21:27           ` Aditya Mahajan
@ 2018-04-16 21:59             ` Hans Hagen
  2018-04-16 22:01             ` Aditya Mahajan
  1 sibling, 0 replies; 17+ messages in thread
From: Hans Hagen @ 2018-04-16 21:59 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

On 4/16/2018 11:27 PM, Aditya Mahajan wrote:
> On Sun, 15 Apr 2018, Hans Hagen wrote:
> 
>> On 4/15/2018 7:08 AM, Aditya Mahajan wrote:
>>> On Sun, 15 Apr 2018, Hans Hagen wrote:
>>>
>>>> On 4/14/2018 9:52 PM, Lutz Haseloff wrote:
>>>>> I get another error message:
>>>>>
>>>>> open source > level 4, order 5, name 't-module-catcodes.tex'
>>>>> loading > Module Catcodes (ver: 2011.12.17)
>>>>>
>>>>> tex error > tex error on line 96 in file t-module-catcodes.tex: ! 
>>>>> Undefined control sequence
>>>> why are special catcodes needed? an dif so, there are often easier 
>>>> ways than low level hacking
>>>
>>> This is the commit (from 2011!) where I added this code:
>>>
>>> https://github.com/adityam/filter/commit/c34023fd1ede0909a056a10c6352202f2295fba4 
>>>
>>> My guess is that I did not want multiple newlines to collapse in 
>>> t-vim, so I had redefined \activeendoflinetoken to {\strut\par}. The 
>>> offending lines are copied from catc-ini.mkiv from the same time:
>>>
>>> https://github.com/contextgarden/context-mirror/blob/5056d7a854142aa63032b0a3ca4d41c496e41faf/tex/context/base/catc-ini.mkiv 
>>>
>>> to make sure that I use the same syntax for MkII and MkIV.
>>>
>>> A couple of years after that I split the MkII and MkIV code into 
>>> separate files, but I never touched the catcode part (because it was 
>>> working).
>>>
>>> I cannot test the latest beta right now; I'll test it on Monday. In 
>>> the meanwhile, what is the current recommended method to alter the 
>>> way literal newlines and tabs are shown.
>> \starttext
>>
>> \start
>> \def\obeyedline{\blank[line]} \obeylines
>>
>> line 1
>>
>>
>> line 2
>>
>> line 3
>>
>> \stop
>>
>> \stoptext
>>
>> blank will cleanup for you
> 
> I don't want multiple empty lines to collapse (this is for code 
> listing). Here is a minimal example showing what t-vim is doing:

(I always remove multiple empty lines in code as i consider it an error.)

> \newcatcodetable \MinimalCatcodes
> 
> \startcatcodetable \MinimalCatcodes % for reading t-vim output
>      \catcode\backslashasciicode  = \escapecatcode
>      \catcode\leftbraceasciicode  = \begingroupcatcode
>      \catcode\rightbraceasciicode = \endgroupcatcode
>      \catcode\endoflineasciicode  = \activecatcode
>      \catcode\formfeedasciicode   = \othercatcode
>      \catcode\spaceasciicode      = \othercatcode
> \stopcatcodetable
> 
> \starttext
> \bgroup
> \def\obeyedline{\strut\par}
> %\def\obeyedline{\blank[line]}
> \setcatcodetable\MinimalCatcodes\letcharcode\endoflineasciicode\obeyedline
> This is a \color[red]{test}
> 
> 
> 
> 
> To check multiple lines as well as color
> \egroup
> \stoptext
> 
> 
> 
> If I replace the {\strut\par} with {\blank[line]}, multiple empty lines 
> are collapsed to a single line.
Ok, I though that you wanted to collapse. How about this:

\def\obeyedline{\forcestrutdepth\vskip\lineheight} \obeylines

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-16 21:27           ` Aditya Mahajan
  2018-04-16 21:59             ` Hans Hagen
@ 2018-04-16 22:01             ` Aditya Mahajan
  2018-04-17  8:09               ` Hans Hagen
  1 sibling, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2018-04-16 22:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

All features of the filter and vim modules work with the latest 
beta, except for one final bug: leading spaces are stripped from the 
buffer.

\starttext

\startbuffer[test]
     Leading spaces
\stopbuffer

\savebuffer[file=test-temp.tmp, prefix=no, list=test]

\stoptext

The leading spaces are stripped before the buffer is saved to the file 
temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
not, I'll just document this as a feature :-).

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-14 12:21 Problem with Filter Module in latent context beta Lutz Haseloff
  2018-04-14 13:02 ` Aditya Mahajan
@ 2018-04-17  2:52 ` Aditya Mahajan
  2018-04-17  3:48   ` Lutz Haseloff
  1 sibling, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2018-04-17  2:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, 14 Apr 2018, Lutz Haseloff wrote:

> Hi all,
>
> with latest context my filter test file fails with an error. My file:
>
> \usemodule[filter]
> \defineexternalfilter
>        [luatexdevelopmentlevel]
>        [filtercommand={luatex --credits | grep Development > \externalfilteroutputfile}]
> \starttext
> \inlineluatexdevelopmentlevel{}
> \stoptext
>
> Error message:
>
>
> loading         > Module Catcodes (ver: 2011.12.17)
>
> tex error       > tex error on line 96 in file /usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex: ! Undefined control sequence
>
> l.96 ...tivecatcode  \gdef\activeendoflinetoken{^^M}
>
>
> 86     \stopcatcodetable
> 87
> 88
> 89
> 90     \ifdefined \activeendoflinetoken \else
> 91         % from catc-ini.mkiv
> 92         \bgroup
> 93             \catcode \tabasciicode       \activecatcode  \gdef\activetabtoken      {^^I}
> 94                                                          \gdef\outputnewlinechar   {^^J}
> 95             \catcode \formfeedasciicode  \activecatcode  \gdef\activeformfeedtoken {^^L}
> 96 >>          \catcode \endoflineasciicode \activecatcode  \gdef\activeendoflinetoken{^^M}
> 97         \egroup
> 98     \fi
> 99
> 100     \protectmodulecatcodes
> 101     \stopmodule
> 102

I uploaded a new version of filter module where this is fixed. The new 
method is slightly cleaner and hopefully works better.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-17  2:52 ` Aditya Mahajan
@ 2018-04-17  3:48   ` Lutz Haseloff
  0 siblings, 0 replies; 17+ messages in thread
From: Lutz Haseloff @ 2018-04-17  3:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2238 bytes --]

Hi Aditya,

your filter module works for me again.

Thank you very much.

Greetings Lutz

Am 17. April 2018 04:52:21 MESZ schrieb Aditya Mahajan <adityam@umich.edu>:
>On Sat, 14 Apr 2018, Lutz Haseloff wrote:
>
>> Hi all,
>>
>> with latest context my filter test file fails with an error. My file:
>>
>> \usemodule[filter]
>> \defineexternalfilter
>>        [luatexdevelopmentlevel]
>>        [filtercommand={luatex --credits | grep Development >
>\externalfilteroutputfile}]
>> \starttext
>> \inlineluatexdevelopmentlevel{}
>> \stoptext
>>
>> Error message:
>>
>>
>> loading         > Module Catcodes (ver: 2011.12.17)
>>
>> tex error       > tex error on line 96 in file
>/usr/local/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.tex:
>! Undefined control sequence
>>
>> l.96 ...tivecatcode  \gdef\activeendoflinetoken{^^M}
>>
>>
>> 86     \stopcatcodetable
>> 87
>> 88
>> 89
>> 90     \ifdefined \activeendoflinetoken \else
>> 91         % from catc-ini.mkiv
>> 92         \bgroup
>> 93             \catcode \tabasciicode       \activecatcode 
>\gdef\activetabtoken      {^^I}
>> 94                                                         
>\gdef\outputnewlinechar   {^^J}
>> 95             \catcode \formfeedasciicode  \activecatcode 
>\gdef\activeformfeedtoken {^^L}
>> 96 >>          \catcode \endoflineasciicode \activecatcode 
>\gdef\activeendoflinetoken{^^M}
>> 97         \egroup
>> 98     \fi
>> 99
>> 100     \protectmodulecatcodes
>> 101     \stopmodule
>> 102
>
>I uploaded a new version of filter module where this is fixed. The new 
>method is slightly cleaner and hopefully works better.
>
>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://context.aanhet.net
>archive  : https://bitbucket.org/phg/context-mirror/commits/
>wiki     : http://contextgarden.net
>___________________________________________________________________________________

-- 
GPG Key ID 3C4F83BC

[-- Attachment #1.2: Type: text/html, Size: 2742 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-16 22:01             ` Aditya Mahajan
@ 2018-04-17  8:09               ` Hans Hagen
  2018-04-17 12:03                 ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Hans Hagen @ 2018-04-17  8:09 UTC (permalink / raw)
  To: Aditya Mahajan, mailing list for ConTeXt users

On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
> All features of the filter and vim modules work with the latest beta, 
> except for one final bug: leading spaces are stripped from the buffer.
> 
> \starttext
> 
> \startbuffer[test]
>      Leading spaces
> \stopbuffer
> 
> \savebuffer[file=test-temp.tmp, prefix=no, list=test]
> 
> \stoptext
> 
> The leading spaces are stripped before the buffer is saved to the file 
> temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
> not, I'll just document this as a feature :-).

\samplefile{ward}
\startnarrower
     \samplefile{ward}
     \startbuffer[test]
         Leading spaces
           And some more
     \stopbuffer
     \typebuffer[test]
\stopnarrower
\samplefile{ward}

\startbuffer[test]
     Leading spaces
         And some more
\stopbuffer
\typebuffer[test]

it is actually a feature to align the left edge relative to the least 
indented so that we can use them inside other constructs

Now, as you're not afraid of low level code:

\unprotect

\unexpanded\def\StartAditya
   {\buff_pickup
     {Aditya}%
     {StartAditya}%
     {StopAditya}%
     {}%
     {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
     \zerocount}

\unexpanded\def\StopAditya
   {}

\protect

\StartAditya
     Leading spaces
         And some more
\StopAditya

(1)

\typebuffer[Aditya]

(2)

\typefile{test-temp.tmp}

Does what you want but of course it's sort of ugly for a module to do 
that. What we can do is this which is still ugly but picking up verbatim 
is always ugly:

\unprotect

\def\buff_start_indeed#1#2#3#4%
   {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%
 
\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}

\protect

\definebuffer[Aditya][strip=no]

\startAditya
     Leading spaces
         And some more
             And even more
\stopAditya

\typeAditya

But then we need Wolfgang to double check if this extension has side 
effects elsewhere.

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-17  8:09               ` Hans Hagen
@ 2018-04-17 12:03                 ` Aditya Mahajan
  2018-04-17 17:19                   ` Aditya Mahajan
  0 siblings, 1 reply; 17+ messages in thread
From: Aditya Mahajan @ 2018-04-17 12:03 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]

On Tue, 17 Apr 2018, Hans Hagen wrote:

> On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
>> All features of the filter and vim modules work with the latest beta, 
>> except for one final bug: leading spaces are stripped from the buffer.
>> 
>> \starttext
>> 
>> \startbuffer[test]
>>      Leading spaces
>> \stopbuffer
>> 
>> \savebuffer[file=test-temp.tmp, prefix=no, list=test]
>> 
>> \stoptext
>> 
>> The leading spaces are stripped before the buffer is saved to the file 
>> temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
>> not, I'll just document this as a feature :-).
>
> \samplefile{ward}
> \startnarrower
>    \samplefile{ward}
>    \startbuffer[test]
>        Leading spaces
>          And some more
>    \stopbuffer
>    \typebuffer[test]
> \stopnarrower
> \samplefile{ward}
>
> \startbuffer[test]
>    Leading spaces
>        And some more
> \stopbuffer
> \typebuffer[test]
>
> it is actually a feature to align the left edge relative to the least 
> indented so that we can use them inside other constructs
>
> Now, as you're not afraid of low level code:
>
> \unprotect
>
> \unexpanded\def\StartAditya
>  {\buff_pickup
>    {Aditya}%
>    {StartAditya}%
>    {StopAditya}%
>    {}%
>    {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
>    \zerocount}

This is perfect as I am already using `\grabbufferdata` in my code. I can 
easily adapt it to use `\buff_pickup` instead. Thanks!.

> Does what you want but of course it's sort of ugly for a module to do that. 
> What we can do is this which is still ugly but picking up verbatim is 
> always ugly:
>
> \def\buff_start_indeed#1#2#3#4%
>  {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%
>
> \normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}
>
> \protect

I want this to be configurable at runtime and the vim module already has 
code that enables `strip=yes` and `strip=no` options (I do this via a 
function in vim so that it works with both mkii and mkiv; although I don't 
think that anyone uses the mkii module any longer).

Aditya

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with Filter Module in latent context beta
  2018-04-17 12:03                 ` Aditya Mahajan
@ 2018-04-17 17:19                   ` Aditya Mahajan
  0 siblings, 0 replies; 17+ messages in thread
From: Aditya Mahajan @ 2018-04-17 17:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2704 bytes --]

On Tue, 17 Apr 2018, Aditya Mahajan wrote:

> On Tue, 17 Apr 2018, Hans Hagen wrote:
>
>> On 4/17/2018 12:01 AM, Aditya Mahajan wrote:
>>> All features of the filter and vim modules work with the latest beta, 
>>> except for one final bug: leading spaces are stripped from the buffer.
>>> 
>>> \starttext
>>> 
>>> \startbuffer[test]
>>>      Leading spaces
>>> \stopbuffer
>>> 
>>> \savebuffer[file=test-temp.tmp, prefix=no, list=test]
>>> 
>>> \stoptext
>>> 
>>> The leading spaces are stripped before the buffer is saved to the file 
>>> temp.tmp. Is it possible for the leading space NOT to be stripped? (If 
>>> not, I'll just document this as a feature :-).
>> 
>> \samplefile{ward}
>> \startnarrower
>>    \samplefile{ward}
>>    \startbuffer[test]
>>        Leading spaces
>>          And some more
>>    \stopbuffer
>>    \typebuffer[test]
>> \stopnarrower
>> \samplefile{ward}
>> 
>> \startbuffer[test]
>>    Leading spaces
>>        And some more
>> \stopbuffer
>> \typebuffer[test]
>> 
>> it is actually a feature to align the left edge relative to the least 
>> indented so that we can use them inside other constructs
>> 
>> Now, as you're not afraid of low level code:
>> 
>> \unprotect
>> 
>> \unexpanded\def\StartAditya
>>  {\buff_pickup
>>    {Aditya}%
>>    {StartAditya}%
>>    {StopAditya}%
>>    {}%
>>    {\savebuffer[file=test-temp.tmp,prefix=no,list=Aditya]}%
>>    \zerocount}
>
> This is perfect as I am already using `\grabbufferdata` in my code. I can 
> easily adapt it to use `\buff_pickup` instead. Thanks!.
>
>> Does what you want but of course it's sort of ugly for a module to do that. 
>> What we can do is this which is still ugly but picking up verbatim is 
>> always ugly:
>> 
>> \def\buff_start_indeed#1#2#3#4%
>>  {\edef\p_strip{\namedbufferparameter{#1}\c!strip}%
>> 
>> \normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}
>> 
>> \protect

> I want this to be configurable at runtime and the vim module already has code 
> that enables `strip=yes` and `strip=no` options (I do this via a function in 
> vim so that it works with both mkii and mkiv; although I don't think that 
> anyone uses the mkii module any longer).

I added `strip=yes` option to the filter module, which is now the default 
option. See "Stripping leading whitespace" in the module documentation 
(https://github.com/adityam/filter). This is a MkIV only feature and I 
will not implement it in MkII.

I also made `strip=yes` to be the default in t-vim (to be consistent with 
t-filter). In t-vim, the `strip` option works with both mkii and mkiv.

Aditya

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2018-04-17 17:19 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-14 12:21 Problem with Filter Module in latent context beta Lutz Haseloff
2018-04-14 13:02 ` Aditya Mahajan
2018-04-14 15:59   ` Hans Hagen
2018-04-14 19:52   ` Lutz Haseloff
2018-04-14 22:07     ` Hans Hagen
2018-04-15  5:08       ` Aditya Mahajan
2018-04-15 10:21         ` Hans Hagen
2018-04-16 16:52           ` Aditya Mahajan
2018-04-16 17:55             ` Hans Hagen
2018-04-16 21:27           ` Aditya Mahajan
2018-04-16 21:59             ` Hans Hagen
2018-04-16 22:01             ` Aditya Mahajan
2018-04-17  8:09               ` Hans Hagen
2018-04-17 12:03                 ` Aditya Mahajan
2018-04-17 17:19                   ` Aditya Mahajan
2018-04-17  2:52 ` Aditya Mahajan
2018-04-17  3:48   ` Lutz Haseloff

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