texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Revert commit afca9f95f8dcca047ad9.


From: Gavin D. Smith
Subject: branch master updated: Revert commit afca9f95f8dcca047ad9.
Date: Fri, 04 Aug 2023 04:55:44 -0400

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 1d57bbbd86 Revert commit afca9f95f8dcca047ad9.
1d57bbbd86 is described below

commit 1d57bbbd866a4c7ea0b7dfbfa7688f6d6fa24687
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Fri Aug 4 09:55:35 2023 +0100

    Revert commit afca9f95f8dcca047ad9.
    
    This reverts the following change:
    
    2023-07-28  Patrice Dumas  <pertusus@free.fr>
    
      * tp/texi2any.pl (set_translations_encoding): reset translations
      encoding when COMMAND_LINE_ENCODING is reset.
      * tp/texi2any.pl: move code around for a more logical organization.
    
    Werner Lemberg reported incorrectly encoded output for
    "makeinfo --help" for LANG=en_US.UTF-8 LANGUAGE=de and tracked it
    down to this commit.
---
 ChangeLog            |  16 ++++
 tp/Texinfo/Config.pm |   5 +-
 tp/texi2any.pl       | 202 +++++++++++++++++++++------------------------------
 3 files changed, 102 insertions(+), 121 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 195ba6a5df..aaaca6300a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2023-08-03  Gavin Smith <gavinsmith0123@gmail.com>
+
+       Revert commit afca9f95f8dcca047ad9.
+
+       This reverts the following change:
+
+       2023-07-28  Patrice Dumas  <pertusus@free.fr>
+
+         * tp/texi2any.pl (set_translations_encoding): reset translations
+         encoding when COMMAND_LINE_ENCODING is reset.
+         * tp/texi2any.pl: move code around for a more logical organization.
+
+       Werner Lemberg reported incorrectly encoded output for
+       "makeinfo --help" for LANG=en_US.UTF-8 LANGUAGE=de and tracked it
+       down to this commit.
+
 2023-08-03  Gavin Smith <gavinsmith0123@gmail.com>
 
        * doc/texinfo.texi: Use trailing comma before 'or' more
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index 5655be02d5..2f5149e0e0 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -121,7 +121,6 @@ sub _GNUT_document_warn($) {
                    "%s: warning: %s"), $real_command_name, $text)."\n"));
 }
 
-# used to register messages by the user with texinfo_register_init_loading_*
 my @init_file_loading_messages;
 # called from texi2any.pl main program and t/test_utils.pl.
 # eval $FILE in the Texinfo::Config namespace. $FILE should be a binary string.
@@ -171,7 +170,7 @@ sub texinfo_register_init_loading_error($) {
                                             'text' => $message};
 }
 
-# called from init files in case of warnings at loading.
+# called from init files in case for warnings during loading.
 sub texinfo_register_init_loading_warning($) {
   my $message = shift;
   push @{$init_file_loading_messages[-1]}, {'type' => 'warning',
@@ -354,7 +353,7 @@ my @possible_stages = ('setup', 'structure', 'init', 
'finish');
 
 my $default_priority = 'default';
 
-# TODO add another level with format?  Not needed now as HTML is
+# FIXME add another level with format?  Not needed now as HTML is
 # the only customizable format for now.
 my $GNUT_stage_handlers;
 
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index dfd1618450..7c55efd351 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -25,7 +25,7 @@ require 5.00405;
 
 use strict;
 
-# Through rules in Makefile.am, directory paths set through configure are
+# Through rules in Makefile.am directory paths set through configure are
 # substituted directly in strings in the code, for example
 #   my $datadir = '@datadir@';
 # We always use these strings as byte string, therefore we explicitly
@@ -133,7 +133,6 @@ my $path_separator = $Config{'path_sep'};
 $path_separator = ':' if (!defined($path_separator));
 my $quoted_path_separator = quotemeta($path_separator);
 
-
 # Paths and file names
 my $curdir = File::Spec->curdir();
 my $updir = File::Spec->updir();
@@ -172,6 +171,14 @@ if ('@datadir@' ne '@' . 'datadir@' and '@PACKAGE@' ne '@' 
. 'PACKAGE@') {
   $pkgdatadir = File::Spec->catdir($datadir, 'texinfo');
 }
 
+# work-around in case libintl-perl do not do it itself
+# see 
http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable
+
+if ((defined($ENV{"LC_ALL"}) and $ENV{"LC_ALL"} =~ /^(C|POSIX)$/)
+     or (defined($ENV{"LANG"}) and $ENV{"LANG"} =~ /^(C|POSIX)$/)) {
+  delete $ENV{"LANGUAGE"} if defined($ENV{"LANGUAGE"});
+}
+
 my $extensions_dir;
 if ($Texinfo::ModulePath::texinfo_uninstalled) {
   $extensions_dir = File::Spec->catdir($Texinfo::ModulePath::top_srcdir,
@@ -182,16 +189,6 @@ if ($Texinfo::ModulePath::texinfo_uninstalled) {
 
 my $internal_extension_dirs = [$extensions_dir];
 
-
-# initial setup of messages internalisation framework
-# work-around in case libintl-perl do not do it itself
-# see 
http://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable
-
-if ((defined($ENV{"LC_ALL"}) and $ENV{"LC_ALL"} =~ /^(C|POSIX)$/)
-     or (defined($ENV{"LANG"}) and $ENV{"LANG"} =~ /^(C|POSIX)$/)) {
-  delete $ENV{"LANGUAGE"} if defined($ENV{"LANGUAGE"});
-}
-
 #my $messages_textdomain = 'texinfo';
 my $messages_textdomain = '@PACKAGE@';
 $messages_textdomain = 'texinfo' if ($messages_textdomain eq '@'.'PACKAGE@');
@@ -199,6 +196,7 @@ my $strings_textdomain = '@PACKAGE@' . '_document';
 $strings_textdomain = 'texinfo_document'
    if ($strings_textdomain eq '@'.'PACKAGE@' . '_document');
 
+
 # we want a reliable way to switch locale, so we don't use the system
 # gettext.
 Locale::Messages->select_package('gettext_pp');
@@ -221,8 +219,6 @@ Locale::Messages::bindtextdomain($messages_textdomain,
                                 File::Spec->catdir($datadir, 'locale'));
 
 
-# Set initial configuration
-
 # Version setting is complicated, because we cope with
 # * script with configure values substituted or not
 # * script shipped as part of texinfo or as a standalone perl module
@@ -276,6 +272,7 @@ if ($configured_version ne $Texinfo::Common::VERSION
   die "Your installation of Texinfo is broken; aborting.\n";
 }
 
+
 my $configured_package = '@PACKAGE@';
 $configured_package = 'Texinfo' if ($configured_package eq '@' . 'PACKAGE@');
 my $configured_name = '@PACKAGE_NAME@';
@@ -366,7 +363,6 @@ my $main_program_default_options = {
   %Texinfo::Common::default_main_program_customization_options,
 };
 
-
 # determine configuration directories.
 
 # used as part of binary strings
@@ -404,7 +400,6 @@ foreach my $texinfo_config_dir (@language_config_dirs) {
 # can also be loaded as regular init files.
 push @program_init_dirs, $extensions_dir;
 
-
 sub _decode_i18n_string($$)
 {
   my $string = shift;
@@ -498,27 +493,15 @@ sub remove_from_option_list($$) {
   return &Texinfo::Config::texinfo_remove_from_option_list(@_);
 }
 
-sub set_translations_encoding($)
-{
-  my $translations_encoding;
-
-  if (defined($translations_encoding)
-      and $translations_encoding ne 'us-ascii') {
-    my $Encode_encoding_object = find_encoding($translations_encoding);
-    my $perl_translations_encoding = $Encode_encoding_object->name();
-
-    Locale::Messages::bind_textdomain_codeset($messages_textdomain,
-                                              $translations_encoding);
-    if (defined($perl_translations_encoding)) {
-      Locale::Messages::bind_textdomain_filter($messages_textdomain,
-                    \&_decode_i18n_string, $perl_translations_encoding);
-    }
-  }
-}
+my @input_file_suffixes = ('.txi','.texinfo','.texi','.txinfo','');
 
+my @texi2dvi_args = ();
 
-# Setup customization and read customization files processed each time
-# the program is run
+my %possible_split = (
+  'chapter' => 1,
+  'section' => 1,
+  'node' => 1,
+);
 
 # this associates the command line options to the arrays set during
 # command line parsing.
@@ -558,9 +541,19 @@ my $parser_options = {'values' => 
{'txicommandconditionals' => 1}};
 my $init_files_options = Texinfo::Config::GNUT_initialize_config(
       $real_command_name, $main_program_default_options, $cmdline_options);
 
-# Need to do that early for early messages
-my $translations_encoding = get_conf('COMMAND_LINE_ENCODING');
-set_translations_encoding($translations_encoding);
+# FIXME should we reset the messages encoding if 'COMMAND_LINE_ENCODING'
+# is reset?
+my $messages_encoding = get_conf('COMMAND_LINE_ENCODING');
+if (defined($messages_encoding) and $messages_encoding ne 'us-ascii') {
+  my $Encode_encoding_object = find_encoding($messages_encoding);
+  my $perl_messages_encoding = $Encode_encoding_object->name();
+  Locale::Messages::bind_textdomain_codeset($messages_textdomain,
+                                            $messages_encoding);
+  if ($perl_messages_encoding) {
+    Locale::Messages::bind_textdomain_filter($messages_textdomain,
+                          \&_decode_i18n_string, $perl_messages_encoding);
+  }
+}
 
 # read initialization files.  Better to do that after
 # Texinfo::Config::GNUT_initialize_config() in case loaded
@@ -570,18 +563,6 @@ foreach my $file 
(Texinfo::Common::locate_init_file($conf_file_name,
   Texinfo::Config::GNUT_load_init_file($file);
 }
 
-# reset translations encodings if COMMAND_LINE_ENCODING was reset
-my $set_translations_encoding = get_conf('COMMAND_LINE_ENCODING');
-if (defined($set_translations_encoding)
-    and (not defined($translations_encoding)
-         or $set_translations_encoding ne $translations_encoding)) {
-  $translations_encoding = $set_translations_encoding;
-  set_translations_encoding($translations_encoding);
-}
-
-
-# Parse command line
-
 sub set_expansion($$) {
   my $region = shift;
   my $set = shift;
@@ -595,12 +576,6 @@ sub set_expansion($$) {
   }
 }
 
-my %possible_split = (
-  'chapter' => 1,
-  'section' => 1,
-  'node' => 1,
-);
-
 my $format_from_command_line = 0;
 
 my %format_command_line_names = (
@@ -699,7 +674,6 @@ my %formats_table = (
 );
 
 my $call_texi2dvi = 0;
-my @texi2dvi_args = ();
 
 # previous_format should be in argument if there is a possibility of error.
 # as a fallback, the $format global variable is used.
@@ -747,6 +721,58 @@ sub set_format($;$$)
   return $new_format;
 }
 
+sub _exit($$)
+{
+  my $error_count = shift;
+  my $opened_files = shift;
+
+  if ($error_count and $opened_files and !get_conf('FORCE')) {
+    while (@$opened_files) {
+      my $opened_file = shift (@$opened_files);
+      unlink ($opened_file);
+    }
+  }
+  exit (1) if ($error_count and (!get_conf('FORCE')
+     or $error_count > get_conf('ERROR_LIMIT')));
+}
+
+sub handle_errors($$$)
+{
+  my $self = shift;
+  my $error_count = shift;
+  my $opened_files = shift;
+
+  my ($errors, $new_error_count) = $self->errors();
+  $error_count += $new_error_count if ($new_error_count);
+  foreach my $error_message (@$errors) {
+    if ($error_message->{'type'} eq 'error' or !get_conf('NO_WARN')) {
+      my $s = '';
+      if ($error_message->{'file_name'}) {
+        my $file = $error_message->{'file_name'};
+
+        if (get_conf('TEST')) {
+          # otherwise out of source build fail since the file names
+          # are different
+          my ($directories, $suffix);
+          ($file, $directories, $suffix) = fileparse($file);
+        }
+        $s .= "$file:";
+      }
+      if (defined($error_message->{'line_nr'})) {
+        $s .= $error_message->{'line_nr'} . ':';
+      }
+      $s .= ' ' if ($s ne '');
+
+      $s .= _encode_message($error_message->{'error_line'});
+      warn $s;
+    }
+  }
+
+  _exit($error_count, $opened_files);
+  return $error_count;
+}
+
+
 sub _get_converter_default($)
 {
   my $option = shift;
@@ -1098,6 +1124,7 @@ There is NO WARRANTY, to the extent permitted by 
law.\n"), "2022");
                    push @texi2dvi_args, '--'.$_[0]; },
 );
 
+
 exit 1 if (!$result_options);
 
 # those are strings combined with output so decode
@@ -1105,15 +1132,6 @@ my $ref_css_refs = get_conf('CSS_REFS');
 my @input_css_refs = @{$ref_css_refs};
 @$ref_css_refs = map {_decode_input($_)} @input_css_refs;
 
-# reset translations encoding if COMMAND_LINE_ENCODING was reset
-$set_translations_encoding = get_conf('COMMAND_LINE_ENCODING');
-if (defined($set_translations_encoding)
-    and (not defined($translations_encoding)
-         or $set_translations_encoding ne $translations_encoding)) {
-  $translations_encoding = $set_translations_encoding;
-  set_translations_encoding($translations_encoding);
-}
-
 # Change some options depending on the settings of other ones set formats
 sub process_config {
   my $conf = shift;
@@ -1162,7 +1180,6 @@ if (get_conf('TEST')) {
   }
 }
 
-my @input_file_suffixes = ('.txi','.texinfo','.texi','.txinfo','');
 
 my %format_names = (
  'info' => 'Info',
@@ -1211,57 +1228,6 @@ if ($call_texi2dvi) {
   document_warn(__('--Xopt option without printed output'));
 }
 
-sub _exit($$)
-{
-  my $error_count = shift;
-  my $opened_files = shift;
-
-  if ($error_count and $opened_files and !get_conf('FORCE')) {
-    while (@$opened_files) {
-      my $opened_file = shift (@$opened_files);
-      unlink ($opened_file);
-    }
-  }
-  exit (1) if ($error_count and (!get_conf('FORCE')
-     or $error_count > get_conf('ERROR_LIMIT')));
-}
-
-sub handle_errors($$$)
-{
-  my $self = shift;
-  my $error_count = shift;
-  my $opened_files = shift;
-
-  my ($errors, $new_error_count) = $self->errors();
-  $error_count += $new_error_count if ($new_error_count);
-  foreach my $error_message (@$errors) {
-    if ($error_message->{'type'} eq 'error' or !get_conf('NO_WARN')) {
-      my $s = '';
-      if ($error_message->{'file_name'}) {
-        my $file = $error_message->{'file_name'};
-
-        if (get_conf('TEST')) {
-          # otherwise out of source build fail since the file names
-          # are different
-          my ($directories, $suffix);
-          ($file, $directories, $suffix) = fileparse($file);
-        }
-        $s .= "$file:";
-      }
-      if (defined($error_message->{'line_nr'})) {
-        $s .= $error_message->{'line_nr'} . ':';
-      }
-      $s .= ' ' if ($s ne '');
-
-      $s .= _encode_message($error_message->{'error_line'});
-      warn $s;
-    }
-  }
-
-  _exit($error_count, $opened_files);
-  return $error_count;
-}
-
 require Texinfo::Parser;
 require Texinfo::Structuring;
 require Texinfo::Transformations;



reply via email to

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