Procházka Lukáš Ing.
18. Juli 2016 um 16:41
Hello,

thank you for the patch.

A solution which would not require named page sizes might be better as we don't necessary need to know the name of the "previous" (or "pushed") paper size (mostly we use "anonymous" page sizes, set up once in the document preamble).

Thus push/pop way would be a bit more flexible (like \pushpagebackground / \poppagebackground);
or making paper size local (enclosing paper setup into group - \start \setupppapersize ... \stop\page) would restore the previous paper size.
A normal environment should be enough (push and pop are used to save and restore states etc.) which inserts are the necessary page breaks.

\unprotect

\def\startpapersize
  {\page
   \pushmacro\page_paper_restore
   \setuppapersize}

\def\stoppapersize
  {\page
   \popmacro\page_paper_restore
   \setuppapersize}

\protect

\starttext
    Page 1. \page
    Page 2. \page
    \startpapersize[A4,landscape]
    Page 3. \page
    Page 4. \page
    \stoppapersize
    Page 5. \page
    Page 6. \page
\stoptext

Wolfgang