[Commits] [SCM] clawsker branch, master, updated. 1.0.1-25-g1311933

mones at claws-mail.org mones at claws-mail.org
Fri Mar 10 20:24:49 CET 2017


The branch, master has been updated
       via  1311933f5bdd09356055b2f71f925f2f324a511a (commit)
      from  96cc72957ec903cc3901233d9deb7fe7d6b52c37 (commit)

Summary of changes:
 clawsker |   30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)


- Log -----------------------------------------------------------------
commit 1311933f5bdd09356055b2f71f925f2f324a511a
Author: Ricardo Mones <ricardo at mones.org>
Date:   Fri Mar 10 20:24:24 2017 +0100

    Keep original order in menurc

diff --git a/clawsker b/clawsker
index 1e262c4..91e4d73 100755
--- a/clawsker
+++ b/clawsker
@@ -2375,17 +2375,16 @@ sub load_menurc {
     my $line = 0;
     while (<RCF>) {
         chomp;
-        ++$line;
         if (/^; \(gtk_accel_path "<([A-Za-z]+)>([^"]+)" ([^\)]+)\)$/) {
-            my %data = ('key' => $3, 'enabled' => FALSE);
+            my %data = ('key' => $3, 'enabled' => FALSE, 'line' => $line);
             $groups{$1}{$2} = \%data;
             # say "group -> $1 | path -> $2 | key -> $3";
-        }
-        if (/^\(gtk_accel_path "<([A-Za-z]+)>([^"]+)" ([^\)]+)\)$/) {
-            my %data = ('key' => $3, 'enabled' => TRUE);
+        } elsif (/^\(gtk_accel_path "<([A-Za-z]+)>([^"]+)" ([^\)]+)\)$/) {
+            my %data = ('key' => $3, 'enabled' => TRUE, 'line' => $line);
             $groups{$1}{$2} = \%data;
             # say "group -> $1 | path -> $2 | key -> $3";
         }
+        ++$line;
     }
     close (RCF);
     return \%groups;
@@ -2393,21 +2392,24 @@ sub load_menurc {
 
 sub save_menurc {
     my ($rc, $groups) = @_;
-    open (RCF, '>:utf8', $rc)
-        or die _("Error: opening '{file}' for writing", file => $rc) . ": $!\n";
-    say RCF '; claws-mail GtkAccelMap rc-file         -*- scheme -*-';
-    say RCF '; this file is an automated accelerator map dump';
-    say RCF ';';
-    foreach my $gkey (sort keys %$groups) {
+    my @lines = ();
+    foreach my $gkey (keys %$groups) {
         my $group = $groups->{$gkey};
-        foreach my $akey (sort keys %$group) {
+        foreach my $akey (keys %$group) {
             my $data = $group->{$akey};
             my $key = $data->{'key'};
-            print RCF '; ' unless ($data->{'enabled'});
-            say RCF '(gtk_accel_path "<'
+            my $line = $data->{'line'};
+            $lines[$line] = ($data->{'enabled'})? '': '; ';
+            $lines[$line] .= '(gtk_accel_path "<'
                     . $gkey . '>' . $akey . '" ' . $key . ')';
         }
     }
+    open (RCF, '>:utf8', $rc)
+        or die _("Error: opening '{file}' for writing", file => $rc) . ": $!\n";
+    say RCF '; claws-mail GtkAccelMap rc-file         -*- scheme -*-';
+    say RCF '; this file is an automated accelerator map dump';
+    say RCF ';';
+    foreach (@lines) { say RCF $_ if $_ }
     close (RCF);
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Hidden preferences editor for Claws Mail


More information about the Commits mailing list