From 4c46f6a8fab34a62dfd409abc8be19bc4e1d205b Mon Sep 17 00:00:00 2001 From: KemoNine Date: Thu, 11 Aug 2022 12:58:25 -0400 Subject: [PATCH] overhaul emacs approach and inline rclone sync into run scripts ; this should be least/worst for my daily workflow(s) --- _setup.sh | 7 +------ emacsd/emacsd-code.sh | 3 --- emacsd/emacsd-org.sh | 3 --- shortcuts/code.sh | 4 ++-- shortcuts/destiny.sh | 2 -- shortcuts/emacs | 42 ++++++++++++++++++++++++++++++++++++++++++ shortcuts/org-mode.sh | 2 +- zshrc | 2 +- 8 files changed, 47 insertions(+), 18 deletions(-) delete mode 100755 emacsd/emacsd-code.sh delete mode 100755 emacsd/emacsd-org.sh delete mode 100755 shortcuts/destiny.sh create mode 100755 shortcuts/emacs diff --git a/_setup.sh b/_setup.sh index 8b31db4..b00f154 100755 --- a/_setup.sh +++ b/_setup.sh @@ -55,18 +55,13 @@ if grep -q "Android" <<< `uname -a`; then if ! [ -d ~/.shortcuts ]; then mkdir ~/.shortcuts fi - # tasker scripts (in case boot ones fail, they can be poked via tasker automations) - if ! [ -d ~/.termux/tasker ]; then - mkdir ~/.termux/tasker - fi # cannot use symlinks -- termux forces full path execution from android launcher shortcuts cp $PATH_PREFIX/shortcuts/* ~/.shortcuts/ - cp $PATH_PREFIX/emacsd/* ~/.termux/tasker # reload settings termux-reload-settings fi -echo "use tasker scripts to launch emacsd styled setup on boot ; Termux::Boot does not work for me" echo "exa fd bat tmux htop nano most ripgrep emacs zsh lf restic rclone glow" echo "copy restic.sh if desired/needed" +echo "setup rclone for org/nextcloud sync if necessary (use 'nc-personal' for destination name)" echo "run tmux and do -I to install plugins and finish setup" diff --git a/emacsd/emacsd-code.sh b/emacsd/emacsd-code.sh deleted file mode 100755 index 6d5991f..0000000 --- a/emacsd/emacsd-code.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/data/data/com.termux/files/usr/bin/sh -/data/data/com.termux/files/usr/bin/termux-wake-lock -/data/data/com.termux/files/usr/bin/tmux new-session -s emacsd-code '/data/data/com.termux/files/usr/bin/emacs --with-profile code' diff --git a/emacsd/emacsd-org.sh b/emacsd/emacsd-org.sh deleted file mode 100755 index e8d7cb4..0000000 --- a/emacsd/emacsd-org.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/data/data/com.termux/files/usr/bin/sh -/data/data/com.termux/files/usr/bin/termux-wake-lock -/data/data/com.termux/files/usr/bin/tmux new-session -d -s emacsd-org '/data/data/com.termux/files/usr/bin/emacs --with-profile org' diff --git a/shortcuts/code.sh b/shortcuts/code.sh index aa56134..3a7c77a 100755 --- a/shortcuts/code.sh +++ b/shortcuts/code.sh @@ -1,2 +1,2 @@ -#!/bin/bash -emacs --with-profile code +#!/bin/sh +/data/data/com.termux/files/home/.shortcuts/emacs code diff --git a/shortcuts/destiny.sh b/shortcuts/destiny.sh deleted file mode 100755 index 7341385..0000000 --- a/shortcuts/destiny.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -emacs ~/storage/shared/org/games_destiny.org diff --git a/shortcuts/emacs b/shortcuts/emacs new file mode 100755 index 0000000..c4fd23f --- /dev/null +++ b/shortcuts/emacs @@ -0,0 +1,42 @@ +#!/data/data/com.termux/files/usr/bin/sh + +# debugging +#echo $1 +#export RC_DEBUG="-P --dry-run" + +# org storage locations +export LOCAL_ORG="/data/data/com.termux/files/home/storage/shared/org/" +export NC_ORG="nc-personal:/org/" + +# rclone common flags/switches +export RC_COMMON="--delete-after --fast-list --human-readable --interactive" +export RC_EXCLUDE="--exclude=archivebox --exclude=/Attic/** --exclude=/Documents/**" + +# get a wake lock so we dont get background killed +/data/data/com.termux/files/usr/bin/termux-wake-lock + +# sync org data to local device (pull down outstanding changes, if any) +echo "starting rclone from nextcloud -> local storage" +/data/data/com.termux/files/usr/bin/rclone sync \ + $RC_COMMON $RC_EXCLUDE $RC_DEBUG \ + $NC_ORG $LOCAL_ORG + +# pause to review rclone output +echo "press enter to continue" +read junkvar + +# run emacs ; assume this will run awhile -- mind battery drain +/data/data/com.termux/files/usr/bin/emacs --with-profile $1 + +# sync any local changes up to the main server +echo "starting rclone from local storage -> nextcloud" +/data/data/com.termux/files/usr/bin/rclone sync \ + $RC_COMMON $RC_EXCLUDE $RC_DEBUG \ + $LOCAL_ORG $NC_ORG + +# pause to review rclone output +echo "press enter to continue" +read junkvar + +# release wake lock +/data/data/com.termux/files/usr/bin/termux-wake-unlock diff --git a/shortcuts/org-mode.sh b/shortcuts/org-mode.sh index eb99562..c4e9d69 100755 --- a/shortcuts/org-mode.sh +++ b/shortcuts/org-mode.sh @@ -1,2 +1,2 @@ #!/bin/bash -emacs --with-profile org +/data/data/com.termux/files/home/.shortcuts/emacs org diff --git a/zshrc b/zshrc index 49be380..13f0350 100644 --- a/zshrc +++ b/zshrc @@ -86,7 +86,7 @@ if grep -q "Android" <<< `uname -a`; then alias proot-distro-keeb-root="proot-distro login keeb" alias proot-distro-keeb="proot-distro login --user keeb --termux-home keeb -- /bin/bash" alias emacs="echo 'daemon mode -- use em [profile] instead'" - alias em="/data/data/com.termux/files/usr/bin/emacsclient -t -a '' -s " + alias em="/data/data/com.termux/files/home/.shortcuts/emacs " fi # dont allow mosh prediction (override in zshrc.local)