Clean my org-mode-exporter-thingy and elisp code some more

This commit is contained in:
Chris Hodapp 2020-04-17 23:19:02 -04:00
parent 1c22c76ff6
commit bebe99bd0d
2 changed files with 17 additions and 8 deletions

View File

@ -1,4 +1,6 @@
#!/bin/sh
./org_fix_links.py < /mnt/share/syncthing/notes/log.org > log_tmp.org
emacs -q --batch -l util.el -f filter-org
echo "Calling org_fix_links.py..."
./org_fix_links.py < ./_tmp_filtered.org > ./_tmp_filtered2.org
emacs -q --batch -l util.el -f export-run

19
util.el
View File

@ -1,6 +1,3 @@
;; See still:
;; command-line-args
(require 'ox-hugo)
(require 'cl)
@ -51,8 +48,18 @@
;; (filter-out-tag-from-file "/Users/hodapp/log_tmp2.org" "tmp.org" "dream")
;; (filter-org-tag "dream" "/Users/hodapp/log_tmp2.org" "/Users/hodapp/log_tmp_filter.org")
(defun filter-org ()
(let ((fname "/mnt/share/syncthing/notes/log.org")
(tag "private"))
(princ (format "Filtering %s...\n" fname))
(with-current-buffer (filter-buffer fname "tmp.org" tag)
(write-file "./_tmp_filtered.org"))))
(defun export-run ()
(progn
(find-file "./log_tmp.org")
(find-file "./_tmp_filtered2.org")
(princ "Exporting with ox-hugo...\n")
(org-hugo-export-as-md)
(write-file "./log_tmp.md")))
(write-file "./log.md"))
;; TODO: use command-line-args so that I can pass in the filename
;; instead of hard-code it