add interactive latex scripts
authorMart Lubbers <mart@martlubbers.net>
Wed, 21 Jun 2017 12:03:37 +0000 (14:03 +0200)
committerMart Lubbers <mart@martlubbers.net>
Wed, 21 Jun 2017 12:03:37 +0000 (14:03 +0200)
email/.mutt/notmuch.muttrc
shell/.bashrc
vim/.vim/spell/en.utf-8.add
vim/.vim/spell/en.utf-8.add.spl [new file with mode: 0644]
x/.local/bin/pdflatexi [new file with mode: 0755]
x/.local/bin/thumbnailer.sh
x/.local/bin/tlmgri [new file with mode: 0755]

index 673ec6f..6b299dc 100644 (file)
@@ -1,19 +1,19 @@
-macro index <F8> "\
-       <enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
-       <shell-escape>notmuch-mutt -r --prompt search<enter>\
-       <change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
-       <enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
-       "notmuch: search mail"
+macro index <F8> \
+"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
+<shell-escape>notmuch-mutt -r --prompt search<enter>\
+<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
+<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
+      "notmuch: search mail"
 
-macro index <F9> "\
-       <enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
-       <pipe-message>notmuch-mutt -r thread<enter>\
-       <change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
-       <enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
-       "notmuch: reconstruct thread"
+macro index <F9> \
+"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
+<pipe-message>notmuch-mutt -r thread<enter>\
+<change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter>\
+<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
+      "notmuch: reconstruct thread"
 
-macro index <F6> "\
-       <enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
-       <pipe-message>notmuch-mutt tag -- -inbox<enter>\
-       <enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
-       "notmuch: remove message from inbox"
+macro index <F6> \
+"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
+<pipe-message>notmuch-mutt tag -- -inbox<enter>\
+<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
+      "notmuch: remove message from inbox"
index 92a1b0a..1a598b5 100644 (file)
@@ -19,8 +19,7 @@ export CLEAN_HOME=/opt/clean
 export PATH=~/.local/bin:$PATH
 export PATH=$PATH:$CLEAN_HOME/lib/exe:$CLEAN_HOME/bin
 export PATH=$PATH:~/projects/esp-open-sdk/xtensa-lx106-elf/bin
-export PATH=$PATH:/opt/texlive/2016/bin/x86_64-linux
-export PATH=$PATH:~/.local/texlive/2016/bin/x86_64-linux
+export PATH=$PATH:/opt/texlive/2017/bin/x86_64-linux
 
 export GTK_IM_MODULE=xim
 export QT_IM_MODULE=xim
index 97ca7c2..60b672d 100644 (file)
@@ -8,3 +8,5 @@ diphone
 SDS
 Microcontrollers
 tonotopic
+backend
+backends
diff --git a/vim/.vim/spell/en.utf-8.add.spl b/vim/.vim/spell/en.utf-8.add.spl
new file mode 100644 (file)
index 0000000..f05f0a0
Binary files /dev/null and b/vim/.vim/spell/en.utf-8.add.spl differ
diff --git a/x/.local/bin/pdflatexi b/x/.local/bin/pdflatexi
new file mode 100755 (executable)
index 0000000..015002c
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/expect
+spawn pdflatex {*}$argv
+set latexpid $spawn_id
+set oldresult ""
+expect -re "^.*File .(.*). not found.*$|^.*language definition file (.*) was not foun" {
+               set result $expect_out(1,string)
+               send_user "\nTrying to install missing package\n"
+               if {$oldresult == $result} {
+                       send_user "$result has been tried twice with no results\n"
+                       send_user "Is this not an image? Aborting...\n"
+                       exit
+               } {
+                       spawn tlmgri $result
+                       interact
+                       set spawn_id $latexpid
+                       close
+                       wait
+                       spawn pdflatex {*}$argv
+                       set oldresult $result
+                       exp_continue
+               }
+       }
index 0867ee9..9c7edeb 100755 (executable)
@@ -15,6 +15,7 @@ fi
 log "Processing $1 to $2"
 
 TMPDIR="$(mktemp -d)"
+trap "rm -r $TMPDIR" EXIT 
 log "Temp directory created in $TMPDIR"
 
 NUMPAGES=$(identify "$1" | wc -l)
@@ -30,8 +31,3 @@ log "done!"
 
 montage -geometry +0+0 $TMPDIR/*.png "$2"
 log "Montaging done"
-
-rm -r $TMPDIR
-log "Cleaned up"
-
-log "Done"
diff --git a/x/.local/bin/tlmgri b/x/.local/bin/tlmgri
new file mode 100755 (executable)
index 0000000..64c3051
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+if [ "$#" -ne 1 ]
+then
+       echo "Usage: $0 FILE"
+       exit 1
+fi
+
+PKGS="$(tlmgr search --global --file "/$1" 2>/dev/null | grep -Po "^.*(?=:$)")"
+if [[ -z "$PKGS" ]]; then exit 1; fi
+if [[ $(wc -w <<< "$PKGS") -eq 1 ]]
+then
+       tlmgr install "$PKGS"
+else
+       select package in $PKGS; do
+               INDEX=1
+               for p in $PKGS; do
+                       if [ $((INDEX++)) -eq $REPLY ]; then
+                               tlmgr install "$p"
+                       fi
+               done
+               break;
+       done
+fi