summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/grph-fig.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/grph-fig.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/grph-fig.mkiv26
1 files changed, 18 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/context/base/grph-fig.mkiv b/Master/texmf-dist/tex/context/base/grph-fig.mkiv
index 80b8e35d932..9b9333fa9a1 100644
--- a/Master/texmf-dist/tex/context/base/grph-fig.mkiv
+++ b/Master/texmf-dist/tex/context/base/grph-fig.mkiv
@@ -25,12 +25,21 @@
% \appendtoks \setbuffer[typeset-b]\endbuffer\to \everystarttext
% \appendtoks \setbuffer[typeset-a]\endbuffer\to \everystarttext
-\newcount\c_grph_buffers_n
+% we could use \typesetbuffer[*] to access the last one
-\let\m_grph_buffers_filename\empty
+\newconstant\c_grph_buffers_mode
+
+\let\lasttypesetbuffer\empty
\unexpanded\def\typesetbuffer
- {\dodoubleempty\grph_buffers_typeset}
+ {\bgroup
+ \setconstant\c_grph_buffers_mode\plusone
+ \dodoubleempty\grph_buffers_typeset}
+
+\unexpanded\def\typesetbufferonly
+ {\bgroup
+ \setconstant\c_grph_buffers_mode\zerocount
+ \dodoubleempty\grph_buffers_typeset}
\def\grph_buffers_typeset[#1][#2]% beware: this will mix up the mp graphics
{\ifsecondargument
@@ -44,11 +53,12 @@
\fi\fi}
\def\grph_buffers_typeset_indeed[#1][#2]% we could use the via files
- {\bgroup
- \global\advance\c_grph_buffers_n\plusone
- \edef\m_grph_buffers_filename{\jobname-buffer-\the\c_grph_buffers_n}%
- \ctxcommand{runbuffer("\m_grph_buffers_filename.tmp","#1",true)}%
- \externalfigure[\m_grph_buffers_filename.pdf][#2]%
+ {\doifnot{#1}{*}{\xdef\lasttypesetbuffer{\ctxcommand{runbuffer("#1",true)}}}%
+ \ifcase\c_grph_buffers_mode
+ % typesetonly
+ \or
+ \externalfigure[\lasttypesetbuffer][#2]%
+ \fi
\egroup}
% For manuals and such: