diff --git a/tred_refactored/btred b/tred_refactored/btred index 1ab258260..9e183673c 100755 --- a/tred_refactored/btred +++ b/tred_refactored/btred @@ -330,9 +330,6 @@ EOL require TrEd::File; import TrEd::File; - #load back-ends - @backends = @{ TrEd::File::init_backends($extra_backends) }; - # these are for macros $stdout = \*STDOUT; $stderr = \*STDERR; @@ -1788,7 +1785,11 @@ sub _new_status { sub loadFile { my ( $file, $backends ) = @_; my @warnings; + + push @backends, TredMacro::Backends(); + _make_uniq(\@backends); my $bck = ref($backends) ? $backends : \@backends; + my $status = _new_status( ok => 0, filename => $file, @@ -2620,6 +2621,7 @@ EOF _msg($@) if $@; } } + delete @INC{qw{ TrEd/MacroAPI/Default.pm TrEd/MacroAPI/Extended.pm }}; $TrEd::Macros::safeCompartment = undef; } @@ -2780,7 +2782,8 @@ sub loadMacros { require TrEd::MacroAPI::Default;#this loads TredMacro API # not sure why, we don't need it here... - #TredMacro->import; + + #TredMacro->import; #TredMacro::init_tredmacro_bindings(); # set minor modes and this stuff, can't do it at compile time, since there is no grp... @@ -2798,6 +2801,7 @@ sub loadMacros { my ( $extensions, $pre_installed, $preinst_dir ) = prepareExtensions(); init_extensions($extensions); init_extensions( $pre_installed, $preinst_dir ); + @backends = @{ TrEd::File::init_backends($extra_backends) }; _msg("Reading extension macros...\n") unless $quiet; for my $ext_contrib ( get_extension_macro_paths($extensions), diff --git a/tred_refactored/tredlib/Filelist.pm b/tred_refactored/tredlib/Filelist.pm index 557ae1e6a..70c154899 100644 --- a/tred_refactored/tredlib/Filelist.pm +++ b/tred_refactored/tredlib/Filelist.pm @@ -221,8 +221,10 @@ sub _lazy_load { } @{ $self->list_ref() } = <$fh>; - close $fh - or croak("Cannot open $self->{load}: $!\n"); + if ($load ne '-') { + close $fh + or croak("Cannot close $self->{load}: $!\n"); + } if ($load =~ /\.fl$/) { my $fl_name = decode('UTF-8', shift @{ $self->list_ref }); diff --git a/tred_refactored/tredlib/TrEd/Macros.pm b/tred_refactored/tredlib/TrEd/Macros.pm index 514b8413e..4e811291f 100644 --- a/tred_refactored/tredlib/TrEd/Macros.pm +++ b/tred_refactored/tredlib/TrEd/Macros.pm @@ -921,12 +921,16 @@ sub initialize_macros { # which should in this way be made visible # to macros my $result = 2; #hm? strange init, return value never actually used - no warnings; + + # Needed to load default macros after cleanup. + require TrEd::MacroAPI::Default; + if ( not $macrosEvaluated ) { my $utf = ($useEncoding) ? "use utf8;\n" : q{}; my $macros = q{}; $macros .= 'use strict;' if $strict; - $macros .= "use warnings; no warnings 'redefine';" if $warnings; + $macros .= 'use warnings;' if $warnings; + $macros .= 'no warnings "redefine";'; $macros .= "{\n" . $utf diff --git a/tred_refactored/tredlib/TrEd/Stylesheet.pm b/tred_refactored/tredlib/TrEd/Stylesheet.pm index 968639995..66695a23b 100644 --- a/tred_refactored/tredlib/TrEd/Stylesheet.pm +++ b/tred_refactored/tredlib/TrEd/Stylesheet.pm @@ -377,7 +377,7 @@ sub get_stylesheet_patterns { $hint = $s->{hint}; $context = $s->{context}; $context = '.*' unless ( wantarray or $context =~ /\S/ ); - chomp $context; + chomp $context if length $context; @$patterns = defined( $s->{patterns} ) ? @{ $s->{patterns} } : (); } else { diff --git a/tred_refactored/tredlib/contrib/support/arrows.inc b/tred_refactored/tredlib/contrib/support/arrows.inc index 5766107de..5ac84b193 100644 --- a/tred_refactored/tredlib/contrib/support/arrows.inc +++ b/tred_refactored/tredlib/contrib/support/arrows.inc @@ -219,7 +219,7 @@ instruction in L). $dx ||= 0; $dy ||= 0; - if ( $node == $target ) { + if ( $node == ($target // -1) ) { # same node push @{ $props{-coords} }, <<"COORDS";