Summary

I create a tmux binding for opening the current tmux window in a Pen.el enabled eterm, thus allowing for codex completion within the interpreter you are looking at.

I figure it is better to work with the complex terminal in this manner, rather than doing everything inside the emacs terminal.

This makes it more robust.

This turns a real terminal into a holographic one, as per the definition below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
complex terminal
holographic terminal
    A holographic terminal has a layer of
    interactivity that queries a language
    model, given the current state of the
    terminal.

    A complex terminal is slightly more
    general definition, where there may not be
    a clear boundary between the hologram
    interactivity layer. Complex implies that
    base operations may be part imaginary and
    part real.

complex
complex programming
    Complex programming is where real
    instructions (completely independent of
    language models) are intermixed with
    imaginary (ones that are based on LM
    output).

    The word complex is suitable because it
    describes this braiding along with the
    mathematical connotations of complex
    numbers.

    It's just a programming style that
    combines both real programming with
    imaginary programming.

holographic programming
    [type of imaginary programming]

    This is like imaginary programming but
    where the language models are trained on
    software.

    Holographic code, therefore, may employ
    associations made between elements of the
    original code, how that code is used and
    how it is described, to build
    applications.

    Holographic programming lets you use the
    latent space of a language model as a kind
    of hyperspace to enable things like:
    - bridge the usage of an application with
      the application's code
    - imaginary reflection
    - inference in place of computation
IP Glossary
https://github.com/semiosis/glossaries-gh/blob/master/imaginary-programming.txt

Procedure

Add a binding

1
bind Q run -b "tm -d -t sps \"sh-pane \$(tpn)\""

Add a handler for my sh-pane script

1
e  tm-window-etermify $window_id

sh-pane

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
export TTY

: "${pane_id:="$1"}"
: "${pane_id:="$TMUX_PANE"}"
: "${pane_id:="$CALLER_TARGET"}"

: "${window_id:="$1"}"
: "${window_id:=$(tmux display-message -p '#{window_id}')}"

# for i in sh-*; do sed -i 's/read -n1 d/&; test "$d" = "" \&\& read -n1 d/' "$i" ; done

clear
# exec 1> >(mnm)

# I should turn this entire script into an elisp hydra.
# Although that would require that emacs has been started already.

read -r -d '' options <<HEREDOC
.  EDIT
o  tm-pane-open-file $pane_id
i  tm-copy-pane-cmd $pane_id
m  tm-pane-open-file $pane_id media
F  tm-pane-open-file $pane_id feh
V  tm-pane-open-file $pane_id vlc
e  tm-window-etermify $window_id
HEREDOC

echo "$0" | udl
echo "$options" | mnm

IFS="" read -n1 d; test "$d" = "" && read -n1 d
# clear

case "$d" in
    .) cmd="v $0" ;;
    o) cmd="tm-pane-open-file $pane_id" ;;
    i) cmd="tm-copy-pane-cmd $pane_id" ;;
    m) cmd="tm-pane-open-file $pane_id media" ;;
    F) cmd="tm-pane-open-file $pane_id feh" ;;
    V) cmd="tm-pane-open-file $pane_id vlc" ;;
    e) cmd="tm-window-etermify $window_id" ;;
esac
echo
echo "$cmd"

# exec <`tm-tty`
# exec 1> /dev/tty
eval "$cmd"

tm-window-etermify

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#!/bin/bash
export TTY

( hs "$(basename "$0")" "$@" "#" "<==" "$(ps -o comm= $PPID)" 0</dev/null ) &>/dev/null

: "${window_id:="$1"}"
: "${window_id:=$(tmux display-message -p '#{window_id}')}"

# This should

# - firstly need a command which wraps a pane in a tmux inside a new window?
# Yeah, I probably need to do that.
# - do it inside a new tmux session? I need to, I think.
# - but I still have to rely on linking the pane. I can't link a pane with tmux, sadly.
# - I have to link the entire window

TMUX= tmux new-window "eterm tmux-attach-window $window_id"

My humble eterm script will run whatever command proceeds inside of an emacs eterm.

Demo

Wow, my Haskell is awful, but this is the idea. You don’t know what you are doing inside of a terminal, so you wrap it inside of a terminal that can perform LM operations on it (a complex terminal).