texinfo-commits
[Top][All Lists]
Advanced

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

[7819] index widow penalties changes for clarity


From: gavinsmith0123
Subject: [7819] index widow penalties changes for clarity
Date: Sun, 4 Jun 2017 14:00:41 -0400 (EDT)

Revision: 7819
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7819
Author:   gavin
Date:     2017-06-04 14:00:41 -0400 (Sun, 04 Jun 2017)
Log Message:
-----------
index widow penalties changes for clarity

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2017-06-03 20:52:27 UTC (rev 7818)
+++ trunk/ChangeLog     2017-06-04 18:00:41 UTC (rev 7819)
@@ -1,3 +1,26 @@
+2017-06-04  Gavin Smith  <address@hidden>
+
+       * doc/texinfo.tex (\finishentry, \dotheinsertindexentrybox):
+       Use a control sequence \dotheinsertindexentrybox instead of 
+       calling \insertindexentrybox and \entrywidowpenalty.  Do not 
+       open a new group and then use \entrywidowpenalty to close the 
+       group, (\entrywidowpenalty could be \let either to \egroup or 
+       our macro \indexwidowpenalty which itself closed the group), as 
+       this requires the reader of the code to understand the 
+       definition of \entrywidowpenalty to follow what is going on.  No 
+       functional changes intended; this change is for clarity only.
+       (\entrywidowpenalty, \indexwidowpenalty): Remove.
+       (\dotheinsertindexentryboxwithpenalty): Code from 
+       \indexwidowpenalty moved here.  This is one possible value
+       for \dotheinsertindexentrybox.
+       (\printindex): Use \dotheinsertindexentryboxwithpenalty for
+       \dotheinsertindexentrybox.  Do not set a value for 
+       \entrywidowpenalty.
+
+       (\printindex, \indexinputprocessing): Split code that checks the 
+       first token of the next line into a new macro.  This should 
+       improve clarity.
+
 2017-06-03  Gavin Smith  <address@hidden>
 
        * info/info-utils.c (scan_reference_label): Save filename

Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex       2017-06-03 20:52:27 UTC (rev 7818)
+++ trunk/doc/texinfo.tex       2017-06-04 18:00:41 UTC (rev 7819)
@@ -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{2017-05-14.14}
+\def\texinfoversion{2017-06-04.18}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -5493,17 +5493,15 @@
       \let\indexlbrace\{   % Likewise, set these sequences for braces
       \let\indexrbrace\}   % used in the sort key.
       \begindoublecolumns
-      \let\entrywidowpenalty=\indexwidowpenalty
+      \let\dotheinsertindexentrybox\dotheinsertindexentryboxwithpenalty
       %
       % Read input from the index file line by line.
       \loopdo
-        \ifeof1
-          \let\firsttoken\relax
-        \else
+        \ifeof1 \else
           \read 1 to \nextline
-          \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
-          \act
         \fi
+        %
+        \indexinputprocessing
         \thisline
         %
         \ifeof1\else
@@ -5515,12 +5513,20 @@
   \fi
   \closein 1
 \endgroup}
+\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
+\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
 
+\def\indexinputprocessing{%
+  \ifeof1
+    \let\firsttoken\relax
+  \else
+    \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
+    \act
+  \fi
+}
 \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
 \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
 
-\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
-\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
 
 % These macros are used by the sorted index file itself.
 % Change them to control the appearance of the index.
@@ -5722,9 +5728,7 @@
     \egroup % The \vbox
     \fi
   \endgroup
-  % delay text of entry until after penalty
-  \bgroup\aftergroup\insertindexentrybox
-  \entrywidowpenalty
+  \dotheinsertindexentrybox
 }}
 
 \newskip\thinshrinkable
@@ -5735,6 +5739,9 @@
   \ourunvbox\entryindexbox
 }
 
+% default definition
+\let\dotheinsertindexentrybox\insertindexentrybox
+
 % Use \lastbox to take apart vbox box by box, and add each sub-box
 % to the current vertical list.
 \def\ourunvbox#1{%
@@ -5757,19 +5764,18 @@
 \newbox\delayedbox
 \newbox\interbox
 
-% Default is no penalty
-\let\entrywidowpenalty\egroup
-
 % Used from \printindex.  \firsttoken should be the first token
 % after the \entry.  If it's not another \entry, we are at the last
 % line of a group of index entries, so insert a penalty to discourage
 % widowed index entries.
-\long\def\indexwidowpenalty{%
-  \def\isentry{\entry}%
-  \ifx\firsttoken\isentry
-  \else
-    \penalty 9000
-  \fi
+\long\def\dotheinsertindexentryboxwithpenalty{%
+  % delay text of entry until after penalty
+  \bgroup\aftergroup\insertindexentrybox
+    \def\isentry{\entry}%
+    \ifx\firsttoken\isentry
+    \else
+      \penalty 9000
+    \fi
   \egroup % now comes the box added with \aftergroup
 }
 




reply via email to

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