texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Hypenation in @code


From: Gavin D. Smith
Subject: branch master updated: Hypenation in @code
Date: Wed, 11 Jan 2023 13:51:16 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new bdb7f23072 Hypenation in @code
bdb7f23072 is described below

commit bdb7f2307290d6b3e3541298cb1c62b182279d02
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Wed Jan 11 18:50:49 2023 +0000

    Hypenation in @code
    
    * doc/texinfo.tex (\code, \codedash): Set internal \codedashprev
    macro differently when \code starts to avoid hyphenation being
    always turned off for the first hyphen in code.  \codedashprev
    does not actually refer to the previous character, as it is
    only set when a dash is seen, not at every single character
    within @code, so rename it to \codedashnobreak to be less
    confusing.
    
    Report from Werner.
---
 ChangeLog       | 14 ++++++++++++++
 doc/texinfo.tex | 23 ++++++++++++++---------
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0282cd70c8..4b202e976e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-01-11  Gavin Smith  <gavinsmith0123@gmail.com>
+
+       Hypenation in @code
+
+       * doc/texinfo.tex (\code, \codedash): Set internal \codedashprev
+       macro differently when \code starts to avoid hyphenation being
+       always turned off for the first hyphen in code.  \codedashprev
+       does not actually refer to the previous character, as it is
+       only set when a dash is seen, not at every single character
+       within @code, so rename it to \codedashnobreak to be less
+       confusing.
+
+       Report from Werner.
+
 2023-01-11  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * doc/info-stnd.texi (Invoking Info): Say what happens if Info's
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index a0e6c2664f..694a49fdf2 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -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{2023-01-08.15}
+\def\texinfoversion{2023-01-11.18}
 %
 % Copyright 1985, 1986, 1988, 1990-2023 Free Software Foundation, Inc.
 %
@@ -2930,10 +2930,6 @@ end
      \let-\dashnobreak
      \let_\realunder
     \fi
-    % Given -foo (with a single dash), we do not want to allow a break
-    % after the hyphen.
-    \global\let\codedashprev=\codedash
-    %
     \codex
   }
   %
@@ -2943,21 +2939,30 @@ end
     % 
     % Now, output a discretionary to allow a line break, unless
     % (a) the next character is a -, or
-    % (b) the preceding character is a -.
+    % (b) the preceding character is a -, or
+    % (c) we are at the start of the string.
+    % In both cases (b) and (c), \codedashnobreak should be set to \codedash.
+    %
     % E.g., given --posix, we do not want to allow a break after either -.
     % Given --foo-bar, we do want to allow a break between the - and the b.
     \ifx\next\codedash \else
-      \ifx\codedashprev\codedash 
+      \ifx\codedashnobreak\codedash
       \else \discretionary{}{}{}\fi
     \fi
     % we need the space after the = for the case when \next itself is a
     % space token; it would get swallowed otherwise.  As in @code{- a}.
-    \global\let\codedashprev= \next
+    \global\let\codedashnobreak= \next
   }
 }
 \def\normaldash{-}
 %
-\def\codex #1{\tclose{#1}\endgroup}
+\def\codex #1{\tclose{%
+  % Given -foo (with a single dash), we do not want to allow a break
+  % after the -.  \codedashnobreak is set to the first character in
+  % @code.
+  \futurelet\codedashnobreak\relax
+  #1%
+}\endgroup}
 
 \def\codeunder{%
   % this is all so @math{@code{var_name}+1} can work.  In math mode, _



reply via email to

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