texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[6552] texinfo.tex changes for groff manual


From: Gavin D. Smith
Subject: [6552] texinfo.tex changes for groff manual
Date: Wed, 19 Aug 2015 12:49:56 +0000

Revision: 6552
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6552
Author:   gavin
Date:     2015-08-19 12:49:55 +0000 (Wed, 19 Aug 2015)
Log Message:
-----------
texinfo.tex changes for groff manual

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/Makefile.am
    trunk/doc/texinfo.tex

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2015-08-18 22:17:44 UTC (rev 6551)
+++ trunk/ChangeLog     2015-08-19 12:49:55 UTC (rev 6552)
@@ -1,3 +1,27 @@
+2015-08-19  Gavin Smith  <address@hidden>
+
+       * doc/texinfo.tex (\defmacro) <non-recursive 0-9 args>: Don't 
+       call \scanmacro in a group.  Add comments to distinguish 
+       recursive and non-recursive definitions.
+       (\comment, \c): change catcode of carriage return to active, not 
+       other. Ths doesn't have any effect, but reduces the number of 
+       different catcodes that carriage return can take, so is simpler.  
+       For \comment only, duplicate self past the end of a macro 
+       expansion.
+       (\scanmacro): Append \comment to argument to \scantokens.  Don't 
+       change category codes before \scantokens or surround \scantokens 
+       in a group.  Use a marker \aftermacro after the \scantokens 
+       argument.
+       (\gobblecr): Removed.
+       (\scanexp): Add line changing catcodes before call to 
+       \scanmacro, within a group, and comment it out for now.
+       These changes appear to allow the macros to work in the manual 
+       for groff, Edition 1.22.3, Autumn 2014.
+
+       * doc/texinfo-tex-test.texi: Add example with opening and 
+       closing a TeX group via a @macro.
+       * doc/Makefile.am: Distribute texinfo-tex-test.texi.
+
 2015-08-19  Patrice Dumas  <address@hidden>
 
        * tp/Texinfo/Convert/XSParagraph/Makefile.PL,

Modified: trunk/doc/Makefile.am
===================================================================
--- trunk/doc/Makefile.am       2015-08-18 22:17:44 UTC (rev 6551)
+++ trunk/doc/Makefile.am       2015-08-19 12:49:55 UTC (rev 6552)
@@ -40,7 +40,7 @@
 EXTRA_DIST = epsf.tex texinfo.tex \
              fdl.texi \
             $(man_MANS) $(TXI_XLATE) \
-            $(refcard_files)
+            $(refcard_files) test-texinfo-tex.texi
 
 if INSTALL_WARNINGS
 install-data-local:

Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex       2015-08-18 22:17:44 UTC (rev 6551)
+++ trunk/doc/texinfo.tex       2015-08-19 12:49:55 UTC (rev 6552)
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2015-08-17.16}
+\def\texinfoversion{2015-08-19.14}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -939,12 +939,20 @@
 % @c is the same as @comment
 % @ignore ... @end ignore  is another way to write a comment
 %
-\def\comment{\begingroup \catcode`\^^M=\other%
+\def\comment{\begingroup \catcode`\^^M=\active%
address@hidden \catcode`\{=\other \catcode`\}=\other\commentxxx}%
+
+{\catcode`\^^M=\active%
+\gdef\commentxxx#1^^M{\endgroup%
+\futurelet\nexttoken\commentxxxx}%
+\gdef\commentxxxx{\ifx\nexttoken\aftermacro\expandafter\comment\fi}%
+}
+
+\def\c{\begingroup \catcode`\^^M=\active%
 address@hidden \catcode`\{=\other \catcode`\}=\other%
-\commentxxx}
-{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
-%
-\let\c=\comment
+\cxxx}
+{\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
+% See comment in \scanmacro about why the definitions of @c and @comment differ
 
 % @paragraphindent NCHARS
 % We'll use ems for NCHARS, close enough.
@@ -7343,38 +7351,38 @@
   }
 \fi
 
-% Used to remove a category 13 newline, added to the end of the last
-% line read in by \scantokens.
-{\catcode`\^^M=13 \gdef\gobblecr^^M{}}
+\let\aftermacroxxx\relax
+\def\aftermacro{\aftermacroxxx}
 
 % Argument is macro body with arguments substituted
-\def\scanmacro#1{\begingroup
+\def\scanmacro#1{%
   \newlinechar`\^^M
   \let\xeatspaces\eatspaces
   %
-  % Undo catcode changes of \startcontents and \doprintindex
-  % When called from @insertcopying or (short)caption, we need active
-  % backslash to get it printed correctly.  Previously, we had
-  % \catcode`\\=\other instead.  We'll see whether a problem appears
-  % with macro expansion.                              --kasal, 19aug04
-  address@hidden \catcode`\\=\active \escapechar=`\@
+  % Process the macro body under the current catcode regime.
+  \scantokens{#1\c}\aftermacro%
   %
-  % ... and for \example:
-  \spaceisspace
-  %
-  \ifnum\catcode`\^^M=5
-    % The \empty here causes a following catcode 5 newline to be eaten as
-    % part of reading whitespace after a control sequence.
-    \scantokens{#1\empty}%
-  \else
-    \catcode`\^^M=13
-    \scantokens{#1\gobblecr}%
-  \fi
-\endgroup}
+  % The \c is to remove the \newlinechar added by \scantokens, and
+  % can be noticed by \parsearg.
+  %   The \aftermacro allows a \comment at the end of the macro definition
+  % to duplicate itself past the final \newlinechar added by \scantokens:
+  % this is used in the definition of \group to comment out a newline.  We
+  % don't do the same for \c to support Texinfo files with macros that ended
+  % with a @c, which should no longer be necessary.
+  %   We avoid surrounding the call to \scantokens with \bgroup and \egroup
+  % to allow macros to open or close groups themselves.
+}
 
 \def\scanexp#1{%
+  \bgroup
+  % Undo catcode changes of \startcontents and \printindex
+  % When called from @insertcopying or (short)caption, we need active
+  % backslash to get it printed correctly.
+  % FIXME: This may not be needed.
+  address@hidden \catcode`\\=\active \escapechar=`\@
   \edef\temp{\noexpand\scanmacro{#1}}%
   \temp
+  \egroup
 }
 
 \newcount\paramno   % Count of parameters
@@ -7827,7 +7835,7 @@
 %
 \def\defmacro{%
   \let\hash=##% convert placeholders to macro parameter chars
-  \ifrecursive
+  \ifrecursive   %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     \ifcase\paramno
     % 0
       \expandafter\xdef\csname\the\macname\endcsname{%
@@ -7859,12 +7867,11 @@
         \global\expandafter\let\csname mac.\the\macname 
.recurse\endcsname\gobble
       \fi
     \fi
-  \else
+  \else  %%%%%%%%%%%%%%%%%%%%%% Non-recursive %%%%%%%%%%%%%%%%%%%%%%%%%%
     \ifcase\paramno
     % 0
       \expandafter\xdef\csname\the\macname\endcsname{%
-        \noexpand\norecurse{\the\macname}%
-        \noexpand\scanmacro{\temp}\egroup}%
+        \noexpand\scanmacro{\temp}}%
     \or % 1
       \expandafter\xdef\csname\the\macname\endcsname{%
          \bgroup
@@ -7872,8 +7879,8 @@
          \expandafter\noexpand\csname\the\macname xxx\endcsname}%
       \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
         \egroup
-        \noexpand\norecurse{\the\macname}%
-        \noexpand\scanmacro{\temp}\egroup}%
+        \noexpand\scanmacro{\temp}%
+        }%
     \else % at most 9
       \ifnum\paramno<10\relax
         \expandafter\xdef\csname\the\macname\endcsname{%
@@ -7887,8 +7894,8 @@
         \csname\the\macname xxx\endcsname
         \paramlist{%
             \egroup
-            \noexpand\norecurse{\the\macname}%
-            \noexpand\scanmacro{\temp}\egroup}%
+            \noexpand\scanmacro{\temp}%
+            }%
       \else % 10 or more:
         \expandafter\xdef\csname\the\macname\endcsname{%
           address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]