« get me outta code hell

acme shenanigans (apparently this is the first acme commit) - dotfiles - Miscellaneous configuration files of my personal use
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-10-27 11:34:22 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-10-27 12:24:48 -0300
commit889dfe622abea16049e4d0743c865331c13bdab1 (patch)
tree62f867e705e757432499a01ac7e1b4c599bb91b2
parent51bf3754cc4805e016ea6f93e00872260e665265 (diff)
acme shenanigans (apparently this is the first acme commit)
-rw-r--r--.gitignore3
-rw-r--r--.zshrc19
-rwxr-xr-xdevice/acme_post4
-rwxr-xr-xdevice/acme_pre23
-rw-r--r--lib/plumbing7
-rwxr-xr-xscripts/acme/E8
-rwxr-xr-xscripts/acme/acme-shell3
-rw-r--r--scripts/acme_dynamic/readme.txt2
8 files changed, 68 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index e43b0f9..f43b417 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
 .DS_Store
+
+scripts/acme_dynamic/*
+!scripts/acme_dynamic/readme.txt
\ No newline at end of file
diff --git a/.zshrc b/.zshrc
index 25d0ef6..14c2b54 100644
--- a/.zshrc
+++ b/.zshrc
@@ -8,6 +8,9 @@
 #   per-device configuration (post)    <dev-post>
 
 
+export DOTFILES="$(dirname "$(readlink -f "${(%):-%x}")")"
+
+
 # //// per-device configuration //////////////////////////////// <dev-pre> // #
 
 # Per-device configuration is kept here in dotfiles.git too, but it won't be
@@ -20,6 +23,7 @@
 
 device_preconfig() {
   source ~/.device_pre
+  [[ -v ACME ]] && source "$DOTFILES/device/acme_pre"
 }
 
 # The post-config file is intended to run commands that are so specialized to
@@ -28,6 +32,7 @@ device_preconfig() {
 
 device_postconfig() {
   source ~/.device_post
+  [[ -v ACME ]] && source "$DOTFILES/device/acme_post"
 }
 
 device_preconfig
@@ -42,12 +47,13 @@ export HISTSIZE=2000
 autoload -Uz select-word-style
 select-word-style bash
 
-if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
+if [ -x /usr/bin/tput ] && [[ ${TERM} != "dumb" ]] && tput setaf 1 >&/dev/null; then
   autoload -U colors && colors
   PS1=$'\e[0;32;1m%n\e[0;32m@\e[32;1m%m \e[34m%1~ \e[0m%# '
   PROMPT="%F{green}%B%n%b@%B%m %F{blue}%1~%b%f %# "
 else
   PS1=$'%n@%m %1~ %# '
+  unset zle_bracketed_paste
 fi
 
 path+=("$HOME/bin")
@@ -91,6 +97,17 @@ if [[ -v DEVICE_HAS_NVM ]]; then
   [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
 fi
 
+# -- Plan 9 --
+
+if [[ -v DEVICE_HAS_PLAN9 ]]; then
+  export PLAN9="$DEVICE_PLAN9_INSTALLATION"
+  path+=("$PLAN9/bin")
+
+  plumber 2>/dev/null
+
+  alias acme='SHELL="'"$DOTFILES"'"/scripts/acme/acme-shell acme'
+fi
+
 # -- Python --
 
 if [[ -v DEVICE_HAS_PYTHON_3 ]]; then
diff --git a/device/acme_post b/device/acme_post
new file mode 100755
index 0000000..e8a6bfe
--- /dev/null
+++ b/device/acme_post
@@ -0,0 +1,4 @@
+#!/bin/zsh
+
+# ACME
+# See acme_pre for info.
diff --git a/device/acme_pre b/device/acme_pre
new file mode 100755
index 0000000..d679ed9
--- /dev/null
+++ b/device/acme_pre
@@ -0,0 +1,23 @@
+#!/bin/zsh
+
+# ACME shell
+#
+# Various configuration that makes ACME 'win' windows nicer
+# to use. This is treated like a device of its own, even
+# though it really isn't.
+
+export EDITOR=E
+
+path=("$DOTFILES/scripts/acme" "$DOTFILES/scripts/acme_dynamic" $path)
+export PATH
+
+# Well, we tried this, but gpg-agent apparently insists on reading
+# from a strictly hard-coded file. No high jinks. It certainly doesn't
+# care about the PATH of the calling tty. This is just kept as reference.
+#
+# if [[ -v DEVICE_HAS_GPG ]]; then
+#     ln -s "$(which pinentry-tty)" "$DOTFILES/scripts/acme_dynamic/pinentry"
+# fi
+
+alias git='git --no-pager'
+alias ls='ls -1'
diff --git a/lib/plumbing b/lib/plumbing
new file mode 100644
index 0000000..650f869
--- /dev/null
+++ b/lib/plumbing
@@ -0,0 +1,7 @@
+editor = acme
+include basic
+
+type is text
+data matches '[0-9a-f]*[a-f][0-9a-f]*'
+data matches '([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]+)'
+plumb start rc -c 'cd '$wdir'; cd `{git rev-parse --show-toplevel} && [ -d .git ] && git show '$1' | plumb -i -d edit -a ''action=showdata filename=+git/'$1''' '
diff --git a/scripts/acme/E b/scripts/acme/E
new file mode 100755
index 0000000..7d79f0c
--- /dev/null
+++ b/scripts/acme/E
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+stat=`stat -f "%m" "$1" 2>&1`
+B "$@"
+while sleep 0.2s; do
+    nstat=`stat -f "%m" "$1" 2>&1`
+    if [ "x$stat" != "x$nstat" ]; then exit; fi
+done
diff --git a/scripts/acme/acme-shell b/scripts/acme/acme-shell
new file mode 100755
index 0000000..a61c968
--- /dev/null
+++ b/scripts/acme/acme-shell
@@ -0,0 +1,3 @@
+#!/bin/zsh
+
+ACME=1 zsh "$@"
diff --git a/scripts/acme_dynamic/readme.txt b/scripts/acme_dynamic/readme.txt
new file mode 100644
index 0000000..0c1c9dc
--- /dev/null
+++ b/scripts/acme_dynamic/readme.txt
@@ -0,0 +1,2 @@
+Binary scripts automatically prepared or linked for access within ACME.
+See device/acme_pre for details.
\ No newline at end of file