From 6ab72d656c2030dbe685f0a3ab9549edb3634e88 Mon Sep 17 00:00:00 2001 From: Marc Coquand Date: Fri, 17 May 2024 17:21:21 -0500 Subject: Updates --- kshrc | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'kshrc') diff --git a/kshrc b/kshrc index 54c49c4..45516c5 100644 --- a/kshrc +++ b/kshrc @@ -12,24 +12,44 @@ alias de='eval "$(direnv export bash)"' alias f-commit="fossil commit && fossil git export" PS1='$(git branch 2> /dev/null | grep "^\*" | colrm 1 2 | sed -e "s/$/./")${PWD##*/} ' -export STITCH_DIRECTORY=/home/mccd/notes -export STITCH_GREP_CMD=ugrep function log { JRNL="$STITCH_DIRECTORY/$(date +'%y-%m-%d.%H:%M.%S').org" - echo '* :journal:' >> $JRNL - kak "$JRNL" +1:3 -e "execute-keys i" + echo '* :journal:' > /tmp/capture + kak /tmp/capture +1:3 -e "execute-keys i" + if grep -q '^\*\s*:journal:' /tmp/capture + then + echo "Empty capture; ignoring" + else + echo "Storing capture in $JRNL" + cat /tmp/capture > $JRNL + fi } function capture { JRNL="$STITCH_DIRECTORY/$(date +'%y-%m-%d.%H:%M.%S').org" - echo '* ' >> $JRNL - kak "$JRNL" +1:3 -e "execute-keys i" + echo '* ' > /tmp/capture + kak /tmp/capture +1:3 -e "execute-keys i" + if grep -q '^\*\s*$' /tmp/capture + then + echo "Empty capture; ignoring" + else + echo "Storing capture in $JRNL" + cat /tmp/capture > $JRNL + fi } function todo { + TODO_BASE='* TODO ' JRNL="$STITCH_DIRECTORY/$(date +'%y-%m-%d.%H:%M.%S').org" - echo '* TODO ' >> $JRNL - kak "$JRNL" +1:8 -e "execute-keys i" + echo '* TODO ' > /tmp/capture + kak /tmp/capture +1:8 -e "execute-keys i" + if grep -q '^\* TODO\s*$' /tmp/capture + then + echo "Empty capture" + else + echo "Storing capture in $JRNL" + cat /tmp/capture > $JRNL + fi } alias jrnl='stitch -t :journal:' -- cgit v1.2.3