diff options
author | Karl Berry <karl@freefriends.org> | 2009-04-15 18:21:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-04-15 18:21:17 +0000 |
commit | 88f7d1ac35385d57d17eb60fb2d77f6704eadde5 (patch) | |
tree | 9a1168ab8bd498e87bd743e4fe2e9b4fe289653b /Master/texmf-dist/scripts/latexmk | |
parent | f331ca2bd8e23f91132a8c372c999c2d8a8731aa (diff) |
latexmk 4.05 (13apr09)
git-svn-id: svn://tug.org/texlive/trunk@12722 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexmk')
-rwxr-xr-x | Master/texmf-dist/scripts/latexmk/latexmk.pl | 80 |
1 files changed, 70 insertions, 10 deletions
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl index 9e7beb249a1..1b122c7e975 100755 --- a/Master/texmf-dist/scripts/latexmk/latexmk.pl +++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl @@ -140,8 +140,8 @@ use warnings; $my_name = 'latexmk'; $My_name = 'Latexmk'; -$version_num = '4.05'; -$version_details = "$My_name, John Collins, 10 April 2009"; +$version_num = '4.05b'; +$version_details = "$My_name, John Collins, 11 April 2009"; use Config; @@ -210,6 +210,13 @@ else { ## ## Modification log for 24 Sep 2008 onwards in detail ## +## 11 Apr 2009, John Collins Capture ctrl/C and ctrl/break during wait +## loop in preview_continuous. Then +## control stays within latexmk on break +## from loop. It allows user to do +## postprocessing, like +## "latexmk -pvc file; cleanup;" +## 10 Apr 2009, John Collins Safer use of % in placeholders in commands ## 10 Apr 2009, John Collins V. 4.05 ## 3 Apr 2009, John Collins Change to a nicer #! line ## 26 Mar 2009, John Collins Case independence for one item in @@ -2392,8 +2399,11 @@ CHANGE: print "\n=== Watching for updated files. Use ctrl/C to stop ...\n"; } $waiting = 1; if ($diagnostics) { warn "WAITING\n"; } + &catch_break; + $have_break = 0; WAIT: while (1) { sleep($sleep_time); + if ($have_break) { last WAIT; } &rdb_clear_change_record; rdb_recurseA( [@targets], \&rdb_flag_changes_here ); if ( &rdb_need_run ) { @@ -2410,8 +2420,14 @@ CHANGE: warn "$My_name: New file(s) found.\n"; last WAIT; } + if ($have_break) { last WAIT; } } # end WAIT: - $waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; } + &default_break; + if ($have_break) { + print "$Latexmk: User typed ctrl/C or ctrl/break. I'll stop.\n"; + exit; + } + $waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; } } #end infinite_loop CHANGE: } #END sub make_preview_continuousB @@ -4625,14 +4641,23 @@ sub rdb_ext_cmd1 { #Set character to surround filenames: my $q = $quote_filenames ? '"' : ''; - foreach ($ext_cmd) { - s/%O/$options/g; - s/%R/$q$root_filename$q/g; - s/%B/$q$base$q/g; - s/%T/$q$texfile_name$q/g; - s/%S/$q$source$q/g; - s/%D/$q$dest$q/g; + + %subst = ( + '%O' => $options, + '%R' => $q.$root_filename.$q, + '%B' => $q.$base.$q, + '%T' => $q.$texfile_name.$q, + '%S' => $q.$source.$q, + '%D' => $q.$dest.$q, + '%%' => '%' # To allow literal %B, %R, etc, by %%B. + ); + + my @tokens = split /(%.)/, $ext_cmd; + foreach (@tokens) { + if (exists($subst{$_})) { $_ = $subst{$_}; } } + $ext_cmd = join '', @tokens; + # print "quote is '$q'; ext_cmd = '$ext_cmd'\n"; my ($pid, $return) = &Run_msg($ext_cmd); return $return; @@ -6244,3 +6269,38 @@ sub finish_dir_stack { #************************************************************ #************************************************************ +# Break handling routines (for wait-loop in preview continuous) + +sub end_wait { + # Handler for break: Set global variable $have_break to 1. + $signal = shift; + # Some systems (e.g., MSWin reset) appear to reset the handler. + # So I'll re-enable it + &catch_break; + $have_break = 1; +} + +#======================== + +sub catch_break { +# Capture ctrl/C and ctrl/break. +# $SIG{INT} corresponds to ctrl/C on LINUX/?UNIX and MSWin +# $SIG{BREAK} corresponds to ctrl/break on MSWin, doesn't exist on LINUX + $SIG{INT} = \&end_wait; + if ( exists $SIG{BREAK} ) { + $SIG{BREAK} = \&end_wait; + } +} + +#======================== + +sub default_break { +# Arrange for ctrl/C and ctrl/break to give default behavior + $SIG{INT} = 'DEFAULT'; + if ( exists $SIG{BREAK} ) { + $SIG{BREAK} = 'DEFAULT'; + } +} + +#************************************************************ +#************************************************************ |