[LON-CAPA-cvs] cvs: loncom /debugging_tools modify_config_files.pl
raeburn
raeburn at source.lon-capa.org
Mon Jul 15 11:48:52 EDT 2024
raeburn Mon Jul 15 15:48:52 2024 EDT
Modified files:
/loncom/debugging_tools modify_config_files.pl
Log:
- set enable-bracketed-paste off added just for specific applications
(R and amaxima) in /home/www/.inputrc
Index: loncom/debugging_tools/modify_config_files.pl
diff -u loncom/debugging_tools/modify_config_files.pl:1.26 loncom/debugging_tools/modify_config_files.pl:1.27
--- loncom/debugging_tools/modify_config_files.pl:1.26 Tue Jul 9 14:18:16 2024
+++ loncom/debugging_tools/modify_config_files.pl Mon Jul 15 15:48:52 2024
@@ -2,7 +2,7 @@
#
# The LearningOnline Network
#
-# $Id: modify_config_files.pl,v 1.26 2024/07/09 14:18:16 raeburn Exp $
+# $Id: modify_config_files.pl,v 1.27 2024/07/15 15:48:52 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -388,7 +388,15 @@
if (!-e $bash_www_cnf) {
system("touch $bash_www_cnf");
if (open(my $fh,'>',$bash_www_cnf)) {
- print $fh "set enable-bracketed-paste off\n";
+ print $fh <<'END';
+$if R
+ set enable-bracketed-paste off
+$endif
+
+$if maxima
+ set enable-bracketed-paste off
+$endif
+END
close($fh);
} else {
warn "**** Error: could not open $bash_www_cnf to add 'set enable-bracketed-paste to off'";
@@ -399,15 +407,42 @@
chown($wwwuid,$wwwgid,$bash_www_cnf);
}
} else {
- my ($bracketed_paste_on,$bracketed_paste_off, at preserve);
+ my (%bracketed_paste_on,%bracketed_paste_off, at preserve,$condition);
+ $condition = '';
if (open(my $fh,'<',$bash_www_cnf)) {
while (my $line=<$fh>) {
chomp($line);
+ if ($line =~ /^\$if\s+(\w+)\s*$/) {
+ if ($1 eq 'R') {
+ $condition = 'r';
+ } elsif ($1 eq 'maxima') {
+ $condition = 'maxima';
+ } else {
+ $condition = 'other';
+ }
+ } elsif ($line =~ /^\$endif\s*$/) {
+ $condition = '';
+ }
if ($line =~ /^\s*set\s+enable\-bracketed\-paste\s+(off|on)\s*$/) {
if ($1 eq 'off') {
- $bracketed_paste_off = 1;
+ if ($condition ne '') {
+ $bracketed_paste_off{$condition} = 1;
+ } else {
+ $bracketed_paste_off{all} = 1;
+ }
+ push(@preserve,$line);
} else {
- $bracketed_paste_on = 1;
+ if ($condition ne '') {
+ $bracketed_paste_on{$condition} = 1;
+ if (($condition eq 'r') || ($condition eq 'maxima')) {
+ push(@preserve,' set enable-bracketed-paste off');
+ } else {
+ push(@preserve,$line);
+ }
+ } else {
+ $bracketed_paste_on{all} = 1;
+ push(@preserve,$line);
+ }
}
} else {
push(@preserve,$line);
@@ -415,13 +450,38 @@
}
close($fh);
}
- if ($bracketed_paste_on || !$bracketed_paste_off) {
+ if (($bracketed_paste_on{r} || $bracketed_paste_on{maxima}) ||
+ (!exists($bracketed_paste_off{r}) && !exists($bracketed_paste_on{r}) &&
+ !exists($bracketed_paste_off{maxima}) && !exists($bracketed_paste_on{maxima}))) {
if (open(my $fh,'>',$bash_www_cnf)) {
- print $fh "set enable-bracketed-paste off\n";
if (@preserve) {
foreach my $entry (@preserve) {
print $fh "$entry\n";
}
+ if (!exists($bracketed_paste_off{r}) && !exists($bracketed_paste_on{r})) {
+print $fh <<'END';
+$if R
+ set enable-bracketed-paste off
+$endif
+END
+ }
+ if (!exists($bracketed_paste_off{r}) && !exists($bracketed_paste_on{r})) {
+print $fh <<'END';
+$if maxima
+ set enable-bracketed-paste off
+$endif
+END
+ }
+ } else {
+print $fh <<'END';
+$if R
+ set enable-bracketed-paste off
+$endif
+
+$if maxima
+ set enable-bracketed-paste off
+$endif
+END
}
close($fh);
} else {
More information about the LON-CAPA-cvs
mailing list