vfmg (DEVEL): vfmg - use vim folds as file is long
sparky
sparky at pld-linux.org
Sun Oct 30 20:47:47 CET 2005
Author: sparky Date: Sun Oct 30 19:47:47 2005 GMT
Module: vfmg Tag: DEVEL
---- Log message:
- use vim folds as file is long
---- Files affected:
vfmg:
vfmg (1.73.2.6 -> 1.73.2.7)
---- Diffs:
================================================================
Index: vfmg/vfmg
diff -u vfmg/vfmg:1.73.2.6 vfmg/vfmg:1.73.2.7
--- vfmg/vfmg:1.73.2.6 Sun Oct 30 20:10:17 2005
+++ vfmg/vfmg Sun Oct 30 20:47:42 2005
@@ -6,6 +6,7 @@
use Getopt::Long;
use Encode;
+# header {{{
my $o_help=0;
my $o_tags=0;
my $o_end=0;
@@ -67,7 +68,9 @@
unless $o_output=~/^(aewm|afterstep|blackbox|enlightenment|fbpanel|fluxbox|fvwm|fvwm2|icewm|metisse|openbox|olvwm|qvwm|wmaker|wmaker-old|xfce4|xpde)$/;
$o_full=1 if $o_icons and $o_output=~/^(enlightenment|metisse)$/;
+# header }}}
+# search dirs {{{
my @xdg_data_dirs = grep -d,
( exists $ENV{'XDG_DATA_HOME'}
? $ENV{'XDG_DATA_HOME'}
@@ -116,6 +119,7 @@
$o_xterm="" unless $exists;
}
}
+# search dirs }}}
# get locale (for Name[*])
my $lang4 = "";
@@ -133,7 +137,7 @@
my @happs;
find(\&wanted, grep -d, map {"$_/applications"} @xdg_data_dirs);
-sub wanted {
+sub wanted { # {{{
return unless -f && /^[^.].*\.desktop$/;
my $file = $_;
@@ -253,7 +257,7 @@
$apps[$#happs]{$_} = 1 # two apps can have same names now:)
foreach grep length, split /;+/, $tags{Categories};
-}
+} # }}}
# read XDG menu specification
my $file;
@@ -295,7 +299,8 @@
my $tmpapps;
my @menustack;
-sub cand {
+# logic {{{
+sub cand { # {{{
my @iapps; # internal applications list
my $name;
my $firstrun=1;
@@ -340,9 +345,9 @@
warn "warning: possible XDG file corruption!: $tag\n" if $o_verbose;
}
\@iapps;
-}
+} # }}}
-sub cor {
+sub cor { # {{{
my @iapps; # internal applications list
my $name;
while (1) {
@@ -372,9 +377,9 @@
warn "warning: possible XDG file corruption!: $tag\n" if $o_verbose;
}
\@iapps;
-}
+} # }}}
-sub cnot {
+sub cnot { # {{{
my @iapps; # internal applications list
my $name;
@iapps=@apps;
@@ -406,8 +411,10 @@
warn "warning: possible XDG file corruption!: $tag\n" if $o_verbose;
}
\@iapps;
-}
+} # }}}
+# logic }}}
+# parse menu file {{{
my @tmp=grep -d, map {"$_/desktop-directories/"} @xdg_data_dirs;
$#menu++;
while($trigger==0 || $level>0) {
@@ -579,8 +586,9 @@
}
warn "Omitted ending: $file\n" if(($file ne "")&& $o_end);
+# parse menu file }}}
-if(($o_clear)&&(!$o_promote)) {
+if(($o_clear)&&(!$o_promote)) { # {{{
my @empty;
for(my $i=$#menu; $i>=0; $i--) {
$empty[$i]=1;
@@ -597,9 +605,9 @@
}
}
}
-}
+} #}}}
-if($o_promote) {
+if($o_promote) { # {{{
my @count;
for(my $i=$#menu; $i>=0; $i--) {
$count[$i]=0;
@@ -630,7 +638,7 @@
}
}
}
-}
+} # }}}
my $DoConvert = `which convert`;
sub scale_icon {
@@ -651,8 +659,9 @@
return $icon_out;
}
+# WM functions {{{
$level="";
-sub icewm {
+sub icewm { # {{{
my $no=$_[0];
foreach my $entry(sort keys %{$menu[$no]}) {
#next if $menu[$no]{$entry}[0]==0;
@@ -672,9 +681,9 @@
print "$level}\n";
}
}
-}
+} # }}}
-sub blackbox {
+sub blackbox { # {{{
my $no=$_[0];
foreach my $entry(sort keys %{$menu[$no]}) {
print "$level";
@@ -690,9 +699,9 @@
print "$level\[end]\n";
}
}
-}
+} # }}}
-sub wmakerold {
+sub wmakerold { # {{{
my $no=$_[0];
foreach my $entry(sort keys %{$menu[$no]}) {
print "$level\"";
@@ -709,9 +718,9 @@
print "$level\"$name\" END\n";
}
}
-}
+} # }}}
-sub wmaker {
+sub wmaker { # {{{
my $no=$_[0];
my $coma=$_[1];
foreach my $entry(sort keys %{$menu[$no]}) {
@@ -730,9 +739,9 @@
print "\n$level)";
}
}
-}
+} # }}}
-sub xfce4 {
+sub xfce4 { # {{{
my $no=$_[0];
foreach my $entry(sort keys %{$menu[$no]}) {
print "$level<";
@@ -756,9 +765,9 @@
print "$level</menu>\n";
}
}
-}
+} # }}}
-sub afterstep {
+sub afterstep { # {{{
my $no=$_[0];
my $dir=$_[1];
print "dir=".$dir;
@@ -781,9 +790,9 @@
afterstep($menu[$no]{$entry}[0],"$dir/$name");
}
}
-}
+} # }}}
-sub fvwm {
+sub fvwm { # {{{
my $no=$_[0];
my $file=$_[1];
$file=~s|^\.||;
@@ -816,9 +825,9 @@
}
}
print "EndPopup\n\n";
-}
+} # }}}
-sub fvwm2 {
+sub fvwm2 { # {{{
my $no=$_[0];
my $file;
foreach my $entry(sort keys %{$menu[$no]}) {
@@ -841,9 +850,9 @@
}
}
print "\n";
-}
+} # }}}
-sub metisse {
+sub metisse { # {{{
my $no=$_[0];
my $file=$_[1];
$file=~s|^\.||;
@@ -881,9 +890,9 @@
}
}
print "\n";
-}
+} # }}}
-sub olvwm {
+sub olvwm { # {{{
my $no=$_[0];
foreach my $entry(sort keys %{$menu[$no]}) {
print "$level";
@@ -900,9 +909,9 @@
print "$level\"$name\" END PIN\n";
}
}
-}
+} # }}}
-sub qvwm {
+sub qvwm { # {{{
my $no=$_[0];
foreach my $entry(sort keys %{$menu[$no]}) {
print "$level";
@@ -920,9 +929,9 @@
print "$level-\n";
}
}
-}
+} # }}}
-sub aewm {
+sub aewm { # {{{
my $no=$_[0];
my $name;
foreach my $entry(sort keys %{$menu[$no]}) {
@@ -941,9 +950,9 @@
print "${level}end\n";
}
}
-}
+} # }}}
-sub enlightenment {
+sub enlightenment { # {{{
my $no=$_[0];
my $F_OUT;
open $F_OUT, ">> $dir/$_[1].menu" or warn "$dir/$_[1].menu: $!\n";
@@ -966,9 +975,9 @@
}
}
close $F_OUT;
-}
+} # }}}
-sub xpde {
+sub xpde { # {{{
my $no=$_[0];
my $dir=$_[1];
foreach my $entry(keys %{$menu[$no]}) {
@@ -988,9 +997,9 @@
xpde($menu[$no]{$entry}[0],"$dir/$name");
}
}
-}
+} # }}}
-sub fbpanel {
+sub fbpanel { # {{{
my $no=$_[0];
foreach my $entry(sort keys %{$menu[$no]}) {
print "$level";
@@ -1011,9 +1020,9 @@
}
print "${level}}\n";
}
-}
+} # }}}
-sub openbox {
+sub openbox { # {{{
my $no=$_[0];
foreach my $entry(sort keys %{$menu[$no]}) {
print "$level";
@@ -1033,7 +1042,8 @@
print "$level</menu>\n";
}
}
-}
+} # }}}
+# WM functions }}}
$o_enc||="utf-8" if $o_utf;
#use open OUT => ':utf8';
@@ -1045,6 +1055,7 @@
}
binmode STDOUT, ":encoding($o_enc)";
+# WM case {{{
if($o_output eq "icewm") {
icewm($o_strip);
exit;
@@ -1075,7 +1086,7 @@
print "</xfdesktop-menu>\n";
exit;
}
-if($o_output eq "afterstep") {
+if($o_output eq "afterstep") { # {{{
use File::Path;
my $dir="$ENV{'HOME'}/GNUstep/Library/AfterStep/start";
if((-d "$dir")||(-f "$dir")) {
@@ -1094,7 +1105,7 @@
if($o_output eq "fvwm") {
fvwm($o_strip,"", "fvwm");
exit;
-}
+} # }}}
if($o_output eq "fluxbox") { # This is the same as blackbox (I hope so)
print "[begin] (Fluxbox)\n" unless $o_nomenu;
blackbox($o_strip);
@@ -1132,7 +1143,7 @@
aewm($o_strip);
exit;
}
-if($o_output eq "enlightenment") {
+if($o_output eq "enlightenment") { # {{{
use File::Path;
$dir="$ENV{'HOME'}/.enlightenment/menus";
if((-d "$dir")||(-f "$dir")) {
@@ -1149,8 +1160,8 @@
}
enlightenment($o_strip,"index","Enlightenment");
exit;
-}
-if($o_output eq "xpde") {
+} # }}}
+if($o_output eq "xpde") { # {{{
use File::Path;
my $dir="$ENV{'HOME'}/.xpde/Start Menu/Programs";
if((-d "$dir")||(-f "$dir")) {
@@ -1160,18 +1171,19 @@
mkpath("$dir",0,0700);
xpde($o_strip,$dir);
exit;
-}
+} # }}}
if($o_output eq "fbpanel") {
fbpanel($o_strip);
exit;
}
-if($o_output eq "openbox") {
+if($o_output eq "openbox") { # {{{
print "<openbox_menu>\n" unless $o_nomenu;
print "<menu id=\"root-menu\" label=\"PLD Linux\">\n" unless $o_nomenu;
openbox($o_strip);
print "</menu>\n" unless $o_nomenu;
print "</openbox_menu>\n" unless $o_nomenu;
exit;
-}
+} # }}}
+# WM case }}}
-# vi: ts=4 sw=4 noet
+# vi: ts=4 sw=4 noet fdm=marker
================================================================
---- CVS-web:
http://cvs.pld-linux.org/vfmg/vfmg?r1=1.73.2.6&r2=1.73.2.7&f=u
More information about the pld-cvs-commit
mailing list