summaryrefslogtreecommitdiff
path: root/tex/context/base/grph-fig.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/grph-fig.mkiv')
-rw-r--r--tex/context/base/grph-fig.mkiv30
1 files changed, 23 insertions, 7 deletions
diff --git a/tex/context/base/grph-fig.mkiv b/tex/context/base/grph-fig.mkiv
index 80b8e35d9..d74f257f5 100644
--- a/tex/context/base/grph-fig.mkiv
+++ b/tex/context/base/grph-fig.mkiv
@@ -25,12 +25,23 @@
% \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
+
+\newcount \c_grph_buffers_n
+\newconstant\c_grph_buffers_mode
\let\m_grph_buffers_filename\empty
+\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 +55,16 @@
\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}{*}
+ {\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)}%
+ \xdef\lasttypesetbuffer{\m_grph_buffers_filename.pdf}}%
+ \ifcase\c_grph_buffers_mode
+ % typesetonly
+ \or
+ \externalfigure[\lasttypesetbuffer][#2]%
+ \fi
\egroup}
% For manuals and such: