genorg.pl
changeset 22 dc1add4ee525
parent 21 f61879daacf0
child 23 b339b5ef7c97
--- a/genorg.pl	Tue Jan 07 00:37:57 2025 +1000
+++ b/genorg.pl	Sun Jan 12 16:14:26 2025 +1000
@@ -79,16 +79,16 @@
 END
 
 my $elisp_code = <<"END" =~ s/\n\s+//gr;
-  (let ((ls '(LIST)))
-    (require 'org)
-    (mapc
-    (lambda (b)
-    (with-current-buffer b
-    (when (and (not (string-match "^ " (buffer-name b)))
-    (eq major-mode 'org-mode))
-    (org-export-to-file 'html (pop ls)))))
-    (buffer-list))
-    (kill-emacs))
+(let ((ls '(LIST)))
+  (require 'org)
+  (mapc
+   (lambda (b)
+     (with-current-buffer b
+       (when (and (not (string-match "^ " (buffer-name b)))
+		  (eq major-mode 'org-mode))
+	 (org-export-to-file 'html (pop ls)))))
+   (buffer-list))
+   (kill-emacs))
 END
 
 
@@ -173,21 +173,21 @@
   
 my %config_vars =
   (
-  'emacs-path' => \$emacs,
-  acss => \$art_css,
-  ccss => \$cat_css,
-  indir => \$dir,
-  outdir => \$outdir,
-  no_name_dir => \$no_name_dir,
-  etc_files => \$etc_files,
-  cache => \$cache_file,
-  home => \$home,
-  about => \$about,
-  domain => \$domain,
-  title => \$blog_title,
-  rdesc => \$rdesc,
-  max_rss => \$max_rss,
-  max_cat => \$max_cat
+   'emacs-path' => \$emacs,
+   acss => \$art_css,
+   ccss => \$cat_css,
+   indir => \$dir,
+   outdir => \$outdir,
+   no_name_dir => \$no_name_dir,
+   etc_files => \$etc_files,
+   cache => \$cache_file,
+   home => \$home,
+   about => \$about,
+   domain => \$domain,
+   title => \$blog_title,
+   rdesc => \$rdesc,
+   max_rss => \$max_rss,
+   max_cat => \$max_cat
   );
 
 
@@ -273,20 +273,13 @@
       $changed_files{$file} = $to;
       push @modified_files, $rel_file;
     }
-    %changed_files // exit;
-    $elisp_code =~ s/LIST/join '', map "\"$_\" ", values %changed_files /e;
-    open my $fh,
-      '-|',
-      ($emacs,
-       '-Q',
-       '--eval',
-       "(progn $custom_code)",
-       keys %changed_files,
-       "--eval",
-       "$elisp_code");
-    close $fh;
-    \%changed_files
   }
+  %changed_files // exit;
+  $elisp_code =~ s/LIST/join '', map "\"$_\" ", values %changed_files /e;
+  open my $fh, '-|', ($emacs, '-Q','--eval', "(progn $custom_code)", keys %changed_files, "--eval" , "$elisp_code");
+  close $fh;
+  \%changed_files
+}
 
 my $cdir;
 
@@ -414,10 +407,10 @@
     $str = "<span class=\"psel\">$str</span>" if $file && ($file == $page);
     defined $file ?
       "<li><a href=\"$file.html\">$str</a>" : $str
-  } ((["←", $page - 1]) x!! ($page - 1),
-     @_,
-     (["→", $page + 1]) x ($page != $_[$#_]->[1]))) . '</ul>'
-}
+    } ((["←", $page - 1]) x!! ($page - 1),
+       @_,
+       (["→", $page + 1]) x ($page != $_[$#_]->[1]))) . '</ul>'
+     }
 
 sub move_on_if_neccasary ($fh, $art_num, $total_articles, $path, $title, $rp) {
   return $fh if $art_num == 0 || $art_num % $max_cat;