texinfo-commits
[Top][All Lists]
Advanced

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

[7041] don\t strip whitespace for single-arg macros


From: Gavin D. Smith
Subject: [7041] don\t strip whitespace for single-arg macros
Date: Sat, 05 Mar 2016 11:53:04 +0000

Revision: 7041
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7041
Author:   gavin
Date:     2016-03-05 11:53:04 +0000 (Sat, 05 Mar 2016)
Log Message:
-----------
don\t strip whitespace for single-arg macros

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-03-04 19:33:07 UTC (rev 7040)
+++ trunk/ChangeLog     2016-03-05 11:53:04 UTC (rev 7041)
@@ -1,9 +1,22 @@
+2016-03-05  Gavin Smith  <address@hidden>
+
+       * doc/texinfo.tex (\defmacro): Don't attempt to strip spaces at 
+       the start of the argument to a macro taking only one argument.  
+       This could lead to an error ("Argument of @gobblespaces has an 
+       extra }") for an empty argmuent.  Reported by Norbert Preining 
+       for ESS manual.
+       (\gobblespaces): Removed.
+       (\parsemargdef, \scanmacro, \defmacro): Put "\xeatspaces" in 
+       body of macro, instead of "\processmacroarg".  For 
+       single-argument macros, make it disappear instead of letting it 
+       equal to \eatspaces.
+
 2016-03-04  Gavin Smith  <address@hidden>
 
-       * info/infokey.c: Check if key sequence was defined as "invalid" 
-       in infokey file, and if so, record it by saving a pointer to a 
-       null InfoCommand structure.  Broken handling of "invalid" 
-       reported by Ken Brown.
+       * info/infokey.c (compile): Check if key sequence was defined as 
+       "invalid" in infokey file, and if so, record it by saving a 
+       pointer to a null InfoCommand structure.  Broken handling of 
+       "invalid" reported by Ken Brown.
 
 2016-03-04  Gavin Smith  <address@hidden>
 

Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex       2016-03-04 19:33:07 UTC (rev 7040)
+++ trunk/doc/texinfo.tex       2016-03-05 11:53:04 UTC (rev 7041)
@@ -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{2016-02-22.15}
+\def\texinfoversion{2016-03-05.11}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -7799,7 +7799,7 @@
 % Argument is macro body with arguments substituted
 \def\scanmacro#1{%
   \newlinechar`\^^M
-  \def\xprocessmacroarg{\eatspaces}%
+  \def\xeatspaces{\eatspaces}%
   %
   % Process the macro body under the current catcode regime.
   \scantokens{#1\texinfoc}\aftermacro%
@@ -8029,7 +8029,7 @@
   \paramno=0\def\paramlist{}%
   \let\hash\relax
   % \hash is redefined to `#' later to get it into definitions
-  \let\processmacroarg\relax
+  \let\xeatspaces\relax
   \parsemargdefxxx#1,;,%
   \ifnum\paramno<10\relax\else
     \paramno0\relax
@@ -8041,7 +8041,7 @@
   \else \let\next=\parsemargdefxxx
     \advance\paramno by 1
     \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
-        {\processmacroarg{\hash\the\paramno}}%
+        {\xeatspaces{\hash\the\paramno}}%
     \edef\paramlist{\paramlist\hash\the\paramno,}%
   \fi\next}
 
@@ -8267,16 +8267,9 @@
 %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
 
 
-
-% Remove following spaces at the expansion stage.
-% This works because spaces are discarded before each argument when TeX is 
-% getting the arguments for a macro.
-% This must not be immediately followed by a }.
-\long\def\gobblespaces#1{#1}
-
 % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
 %    \macrobody has the body of the macro in it, with placeholders for
-% its parameters, looking like "\processmacroarg{\hash 1}".
+% its parameters, looking like "\xeatspaces{\hash 1}".
 %    \paramno is the number of parameters
 %    \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
 % There are eight cases: recursive and nonrecursive macros of zero, one,
@@ -8287,14 +8280,13 @@
 \def\defmacro{%
   \let\hash=##% convert placeholders to macro parameter chars
   \ifnum\paramno=1
-    \def\processmacroarg{\gobblespaces}%
+    \def\xeatspaces##1{##1}%
     % This removes the pair of braces around the argument.  We don't
     % use \eatspaces, because this can cause ends of lines to be lost
     % when the argument to \eatspaces is read, leading to line-based
     % commands like "@itemize" not being read correctly.
   \else
-    \def\processmacroarg{\xprocessmacroarg}%
-    \let\xprocessmacroarg\relax
+    \let\xeatspaces\relax % suppress expansion
   \fi
   \ifrecursive   %%%%%%%%%%%%%% Recursive %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     \ifcase\paramno
@@ -8307,12 +8299,9 @@
          \noexpand\braceorline
          \expandafter\noexpand\csname\the\macname @@@\endcsname}%
       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
-         \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
-           \noexpand\gobblespaces##1\empty}%
-           % The \empty is for \gobblespaces in case #1 is empty
-         }%
-      \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
-         \egroup\noexpand\scanmacro{\macrobody}}%
+        \egroup
+        \noexpand\scanmacro{\macrobody}%
+        }%
     \else
       \ifnum\paramno<10\relax % at most 9
         % See non-recursive section below for comments
@@ -8351,11 +8340,6 @@
          \noexpand\braceorline
          \expandafter\noexpand\csname\the\macname @@@\endcsname}%
       \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
-         \expandafter\noexpand\csname\the\macname @@@@\endcsname{%
-           \noexpand\gobblespaces##1\empty}%
-           % The \empty is for \gobblespaces in case #1 is empty
-         }%
-      \expandafter\xdef\csname\the\macname @@@@\endcsname##1{%
         \egroup
         \noexpand\scanmacro{\macrobody}%
         }%




reply via email to

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