From 902f734cfb825eb44a7b25ee2111b66c939bf83d Mon Sep 17 00:00:00 2001 From: Misaka Mikoto Date: Mon, 3 Jun 2019 21:16:11 +1000 Subject: [PATCH 1/4] bin/doom POSIX compliance --- bin/doom | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/doom b/bin/doom index 9d7cf21fe..f2aab55c8 100755 --- a/bin/doom +++ b/bin/doom @@ -1,13 +1,13 @@ -#!/usr/bin/env bash -":"; [[ $EMACS = *"term"* ]] && EMACS=emacs || EMACS=${EMACS:-emacs} # -*-emacs-lisp-*- +#!/bin/sh +":"; ( echo "$EMACS" | grep -q "term" ) && EMACS=emacs || EMACS=${EMACS:-emacs} # -*-emacs-lisp-*- ":"; command -v $EMACS >/dev/null || { >&2 echo "Emacs isn't installed"; exit 1; } ":"; VERSION=$($EMACS --version | head -n1) -":"; [[ $VERSION == *\ 2[0-2].[0-1].[0-9] ]] && { echo "You're running $VERSION"; echo "That version is too old to run Doom. Check your PATH"; echo; exit 2; } -":"; DOOMBASE=$(dirname "${BASH_SOURCE:-${(%):-%x}}")/.. -":"; [[ $1 == -d || $1 == --debug ]] && { shift; export DEBUG=1; } -":"; [[ $1 == doc || $1 == doctor ]] && { cd "$DOOMBASE"; shift; exec $EMACS --script bin/doom-doctor "$@"; exit 0; } -":"; [[ $1 == run ]] && { cd "$DOOMBASE"; shift; exec $EMACS -q --no-splash -l bin/doom "$@"; exit 0; } -":"; exec $EMACS --script "$0" -- $@ +":"; case "$VERSION" in *\ 2[0-2].[0-1].[0-9]) echo "You're running $VERSION"; echo "That version is too old to run Doom. Check your PATH"; echo; exit 2 ;; esac +":"; DOOMBASE=$(dirname "$0")/.. +":"; [ "$1" = -d ] || [ "$1" = --debug ] && { shift; export DEBUG=1; } +":"; [ "$1" = doc ] || [ "$1" = doctor ] && { cd "$DOOMBASE"; shift; exec $EMACS --script bin/doom-doctor "$@"; exit 0; } +":"; [ "$1" = run ] && { cd "$DOOMBASE"; shift; exec $EMACS -q --no-splash -l bin/doom "$@"; exit 0; } +":"; exec $EMACS --script "$0" -- "$@" ":"; exit 0 (defun usage () From 944e243c5d229b1c55c70dbe45a8259973415a8b Mon Sep 17 00:00:00 2001 From: Misaka Mikoto Date: Mon, 3 Jun 2019 21:17:53 +1000 Subject: [PATCH 2/4] bin/doom-doctor POSIX compliance --- bin/doom-doctor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/doom-doctor b/bin/doom-doctor index 44838d2a1..004ba5728 100755 --- a/bin/doom-doctor +++ b/bin/doom-doctor @@ -1,7 +1,7 @@ -#!/usr/bin/env bash +#!/bin/sh ":"; command -v emacs >/dev/null || { >&2 echo "Emacs isn't installed"; exit 1; } # -*-emacs-lisp-*- ":"; VERSION=$(emacs --version | head -n1) -":"; [[ $VERSION == *\ 2[0-2].[0-1].[0-9] ]] && { echo "You're running $VERSION"; echo "That version is too old to run the doctor. Check your PATH"; echo; exit 2; } +":"; case $VERSION in *\ 2[0-2].[0-1].[0-9]) echo "You're running $VERSION"; echo "That version is too old to run the doctor. Check your PATH"; echo; exit 2 ;; esac ":"; exec emacs --quick --script "$0"; exit 0 ;; The Doom doctor is essentially one big, self-contained elisp shell script From cbe11ae926aa41608c66e03ce317ba166a48555f Mon Sep 17 00:00:00 2001 From: Misaka Mikoto Date: Mon, 3 Jun 2019 21:21:11 +1000 Subject: [PATCH 3/4] bin/org-capture POSIX compliance --- bin/org-capture | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/org-capture b/bin/org-capture index d04d2e971..033604086 100755 --- a/bin/org-capture +++ b/bin/org-capture @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Open an org-capture popup frame from the shell. This opens a temporary emacs # daemon if emacs isn't already running. @@ -30,7 +30,7 @@ shift $((OPTIND-1)) [ -t 0 ] && str="$*" || str=$(cat) -if [[ $daemon ]]; then +if [ $daemon ]; then emacsclient -a "" \ -c -F '((name . "org-capture") (width . 70) (height . 25) (transient . t))' \ -e "(+org-capture/open-frame \"$str\" ${key:-nil})" From d2d7f7330ea2834c997cca33f394f25311e01b69 Mon Sep 17 00:00:00 2001 From: Misaka Mikoto Date: Mon, 3 Jun 2019 21:31:15 +1000 Subject: [PATCH 4/4] bin/org-tangle POSIX compliance --- bin/org-tangle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/org-tangle b/bin/org-tangle index ff99e6a2f..79f50e851 100755 --- a/bin/org-tangle +++ b/bin/org-tangle @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh ":"; exec emacs --quick --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*- ;;; bin/org-tangle