blog // ~snubspreker

this is just a test

Posting to bash-blog in emacs

April 12, 2020 — ~snubspreker

WTF?!

Just tinkering around a little. I like the idea of bash-blog. What I don't like is that it wants to control the creation of posts for you. If you type:

bb post my-test-post.md

then bb will search for that file, and if found, will present that to you in $EDITOR for editing. Save the file, and bb resumes, asking if you want to post, edit again, or save as draft. Cool. But, I use emacs. I'm already editing the file. Most likely I am using org-mode, exporting as markdown, then calling bb and passsing that file name.

What should happen, if you pass a file name to bb, is that it just posts the damned entry. Don't reopen the file that I just edited unless I ask you to.

The offensive piece of code I think is:

post_status="E"
filename=""
while [[ $post_status != "p" && $post_status != "P" ]]; do
    [[ -n $filename ]] && rm "$filename" # Delete the generated html file, if any
    $EDITOR "$TMPFILE"
    if [[ $fmt == md ]]; then
        html_from_md=$(markdown "$TMPFILE")
        parse_file "$html_from_md"
        rm "$html_from_md"
    else
        parse_file "$TMPFILE" # this command sets $filename as the html processed file
    fi

So maybe I will make some changes to a local copy of bb and bend it to my will. Or maybe do something in elisp. Who knows. This is just a test.