From 6e137bb1c94637b15cdc9ae1f14b5d06226d854d Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 3 Mar 2022 01:20:50 -0800 Subject: [PATCH] =?UTF-8?q?Several=20fixes=20for=20=E2=80=98inbox-size?= =?UTF-8?q?=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Make the header more robust. If we need to add more argumetns to the scsh command-line this will let us do that more easily in the future without having to change the header again. - Don't ‘display’ the result of the call to ‘run’ because that should always be ‘0’, unless something went wrong. Regardless, it doesn't belong in the output of this program. - Use ‘rx’ in Emacs to build the regular expression. This is easier to read, especially considering how many times a single ‘\’ has to be escaped (once for the string in scsh, and once more for the string in Emacs). --- inbox-size | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/inbox-size b/inbox-size index 0422aba..113715a 100755 --- a/inbox-size +++ b/inbox-size @@ -1,6 +1,8 @@ -#!/usr/bin/env -S scsh -s -;; # -*- mode: scheme; -*- +#!/usr/bin/env sh +# -*- mode: scheme; -*- +IFS=" " +exec scsh -s "$0" "$@" !# -(display (run (emacs --quick --batch --visit ~/documents/gtd/inbox.org - --eval "(princ (how-many \"^\\\\* +\"))"))) +(run (emacs --quick --batch --visit ~/documents/gtd/inbox.org + --eval "(princ (how-many (rx bol \"*\" (one-or-more space))))"))