X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc;h=f9c039d58aac21cb069c27721c9ac1032f2ec1c5;hb=8de1e14e35d0ad62620a59f6e2ca4ba19ddcda3c;hp=4aacc47397e3e5502809c60229ad369035d4f41d;hpb=f27b67a1dfa58b5f101bba607b2f91a73e65299e;p=distro-setup diff --git a/brc b/brc index 4aacc47..f9c039d 100644 --- a/brc +++ b/brc @@ -1324,7 +1324,11 @@ etailm() { etail2() { tail -F /var/log/exim4/mymain -n 200 "$@" } -ccomp tail etail etail2 +# shortcut +ta() { + tail -F "$@" +} +ccomp tail etail etail2 ta # ran into this online, trying it out detach() { @@ -1639,28 +1643,17 @@ g() { args+=" -c" fi fi - if [[ $EMACSDIR ]]; then - - # todo: we don't have to alter HOME since emacs 29+, we can set - # user-emacs-directory with the flag --init-directory - - # Alter the path here, otherwise the nfs mount gets triggered on the - # first path lookup when emacs is not being used. - # shellcheck disable=SC2098 disable=SC2097 # false positive - PATH="$EMACSDIR/lib-src:$EMACSDIR/src:$PATH" EHOME=$HOME HOME=$EMACSDIR m emacsclient -a "" $args "$@" + if $gdb; then + # due to a bug, we cant debug from the start unless we get a new gdb + # https://sourceware.org/bugzilla/show_bug.cgi?id=24454 + # m gdb -ex="set follow-fork-mode child" -ex=r -ex=quit --args emacs --daemon + m emacsclient -a "" $args "$@" + sleep 1 + cd "/a/opt/emacs-$(distro-name)$(distro-num)" + s gdb -p "$(pgrep -f 'emacs --daemon')" -ex c + cd - else - if $gdb; then - # due to a bug, we cant debug from the start unless we get a new gdb - # https://sourceware.org/bugzilla/show_bug.cgi?id=24454 - # m gdb -ex="set follow-fork-mode child" -ex=r -ex=quit --args emacs --daemon - m emacsclient -a "" $args "$@" - sleep 1 - cd "/a/opt/emacs-$(distro-name)$(distro-num)" - s gdb -p "$(pgrep -f 'emacs --daemon')" -ex c - cd - - else - m emacsclient -a "" $args "$@" - fi + m emacsclient -a "" $args "$@" fi } @@ -3521,6 +3514,34 @@ v() { fi } +# Combine files $@ into a single file with comments between them which +# allow splitting them back with fsplit. +# +# Assumes file names do not have newlines in them. +fcomb() { + local f comment out + # generated with cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c8 + comment='# jvvuyUsq ' + out=~/fcomb + rm -f $out + for f; do + echo "$comment$f" >>$out + cat "$f" >>$out + done +} +fsplit() { + local f fin line fin_lines + fin=~/fcomb + line=1 + fin_lines=$(wc -l "$fin" | awk '{print $1}') + comment='# jvvuyUsq ' + while (( line <= fin_lines )); do + f=$(sed -n "${line}s/^$comment//p" "$fin") + sed -n "$line,/^$comment/{/^$comment/d;p}" "$fin" >"$f" + line=$(( line + 1 + $(wc -l "$f" | awk '{print $1}') )) + done +} + # * stuff that makes sense to be at the end