--- /dev/null
+
+# no hidden files in the incommon project
+.*
+
+# well accept for the .git stuff
+!.gitignore
+!.gitattributes
+!.gitmodules
+!.gitkeep
+
+# If you use GitHub workflows, uncomment these:
+# !.github/
+# !.github/**
+
+# Emacs, nano, etc.
+*~
+.elc
+.auto-save-list
+.tramp
+.#*
+
+.bak
+
+__pycache__/
+*.py[cod]
+*$py.class
+
+# VS Code
+.vscode/
+
+# JetBrains
+.idea/
+
--- /dev/null
+# Author: Thomas Walker Lynch
+# 2023-10-24
+# MIT license
+
+# I purposely left out prior definitions so as to support namespaces as noted below.
+# include "/usr/share/X11/locale/en_US.UTF-8/Compose"
+
+# The goal here is not to include all of unicode. That would be silly, as
+# typing compose characters is cumbersome. If a person wants to use a
+# different script, that person should change the keyboard layout setting.
+# This file is for supporting math and science writing in English, and
+# for supporting accents.
+
+
+#--------------------------------------------------------------------------------
+# all the special characters have as their origins tricks played on
+# manual typewriters. Thus this .Xcompose file defines each sepcial
+# character by the character we start with, followed by a description
+# of what we do with it. As examples, double striking letters, turning
+# them upside down, typing a slash through it, etc.
+#
+# <namespace> <keyboard character> <typesetting trick> ... <space>: <definition> <Unumber> # comment
+#
+# Be starting with a namespace character we reduce the problem of potential
+# aliasing to that namespace. By ending each sequence with a <space>, by
+# hitting the space bar, we may make a prefix sequence to a longer sequence
+# unique. In this manner we may add more than one typesetting trick to a
+# single character.
+#
+
+#--------------------------------------------------------------------------------
+# name spaces
+# L - Latin
+# G - Greek
+# m - math
+#
+
+#--------------------------------------------------------------------------------
+# typesetting instructions
+#
+# ' : add accent
+# ` : add accent agui
+# : : place double dot over
+#
+# d : doublstrike
+#
+# u : upside down
+# r : rotate right
+# l : rotate left
+# b : backwards
+# o : occlusion (originally typed by placing another piece of paper to chop part off)
+#
+# / : strike through
+# - : overstrike with a - (underscore is used for subscript)
+# s : put a square around it
+# c : put a circle around it
+#
+# ^ : superscript
+# _ : subscript
+
+#--------------------------------------------------------------------------------
+# Latin
+
+# Double struck
+<Multi_key> <L> <A> <d> <space>: "๐ธ" U1D538 # double-struck capital A
+<Multi_key> <L> <B> <d> <space>: "๐น" U1D539 # double-struck capital B
+<Multi_key> <L> <C> <d> <space>: "โ" U2102 # double-struck capital C
+<Multi_key> <L> <D> <d> <space>: "๐ป" U1D53B # double-struck capital D
+<Multi_key> <L> <E> <d> <space>: "๐ผ" U1D53C # double-struck capital E
+<Multi_key> <L> <F> <d> <space>: "๐ฝ" U1D53D # double-struck capital F
+<Multi_key> <L> <G> <d> <space>: "๐พ" U1D53E # double-struck capital G
+<Multi_key> <L> <H> <d> <space>: "โ" U210D # double-struck capital H
+<Multi_key> <L> <I> <d> <space>: "๐" U1D540 # double-struck capital I
+<Multi_key> <L> <J> <d> <space>: "๐" U1D541 # double-struck capital J
+<Multi_key> <L> <K> <d> <space>: "๐" U1D542 # double-struck capital K
+<Multi_key> <L> <L> <d> <space>: "๐" U1D543 # double-struck capital L
+<Multi_key> <L> <M> <d> <space>: "๐" U1D544 # double-struck capital M
+<Multi_key> <L> <N> <d> <space>: "โ" U2115 # double-struck capital N
+<Multi_key> <L> <O> <d> <space>: "๐" U1D546 # double-struck capital O
+<Multi_key> <L> <P> <d> <space>: "โ" U2119 # double-struck capital P
+<Multi_key> <L> <Q> <d> <space>: "โ" U211A # double-struck capital Q
+<Multi_key> <L> <R> <d> <space>: "โ" U211D # double-struck capital R
+<Multi_key> <L> <S> <d> <space>: "๐" U1D54A # double-struck capital S
+<Multi_key> <L> <T> <d> <space>: "๐" U1D54B # double-struck capital T
+<Multi_key> <L> <U> <d> <space>: "๐" U1D54C # double-struck capital U
+<Multi_key> <L> <V> <d> <space>: "๐" U1D54D # double-struck capital V
+<Multi_key> <L> <W> <d> <space>: "๐" U1D54E # double-struck capital W
+<Multi_key> <L> <X> <d> <space>: "๐" U1D54F # double-struck capital X
+<Multi_key> <L> <Y> <d> <space>: "๐" U1D550 # double-struck capital Y
+<Multi_key> <L> <Z> <d> <space>: "โค" U2124 # double-struck capital Z
+
+<Multi_key> <L> <a> <d> <space>: "๐" U1D552 # double-struck lowercase a
+<Multi_key> <L> <b> <d> <space>: "๐" U1D553 # double-struck lowercase b
+<Multi_key> <L> <c> <d> <space>: "๐" U1D554 # double-struck lowercase c
+<Multi_key> <L> <d> <d> <space>: "๐" U1D555 # double-struck lowercase d
+<Multi_key> <L> <e> <d> <space>: "๐" U1D556 # double-struck lowercase e
+<Multi_key> <L> <f> <d> <space>: "๐" U1D557 # double-struck lowercase f
+<Multi_key> <L> <g> <d> <space>: "๐" U1D558 # double-struck lowercase g
+<Multi_key> <L> <h> <d> <space>: "๐" U1D559 # double-struck lowercase h
+<Multi_key> <L> <i> <d> <space>: "๐" U1D55A # double-struck lowercase i
+<Multi_key> <L> <j> <d> <space>: "๐" U1D55B # double-struck lowercase j
+<Multi_key> <L> <k> <d> <space>: "๐" U1D55C # double-struck lowercase k
+<Multi_key> <L> <l> <d> <space>: "๐" U1D55D # double-struck lowercase l
+<Multi_key> <L> <m> <d> <space>: "๐" U1D55E # double-struck lowercase m
+<Multi_key> <L> <n> <d> <space>: "๐" U1D55F # double-struck lowercase n
+<Multi_key> <L> <o> <d> <space>: "๐ " U1D560 # double-struck lowercase o
+<Multi_key> <L> <p> <d> <space>: "๐ก" U1D561 # double-struck lowercase p
+<Multi_key> <L> <q> <d> <space>: "๐ข" U1D562 # double-struck lowercase q
+<Multi_key> <L> <r> <d> <space>: "๐ฃ" U1D563 # double-struck lowercase r
+<Multi_key> <L> <s> <d> <space>: "๐ค" U1D564 # double-struck lowercase s
+<Multi_key> <L> <t> <d> <space>: "๐ฅ" U1D565 # double-struck lowercase t
+<Multi_key> <L> <u> <d> <space>: "๐ฆ" U1D566 # double-struck lowercase u
+<Multi_key> <L> <v> <d> <space>: "๐ง" U1D567 # double-struck lowercase v
+<Multi_key> <L> <w> <d> <space>: "๐จ" U1D568 # double-struck lowercase w
+<Multi_key> <L> <x> <d> <space>: "๐ฉ" U1D569 # double-struck lowercase x
+<Multi_key> <L> <y> <d> <space>: "๐ช" U1D56A # double-struck lowercase y
+<Multi_key> <L> <z> <d> <space>: "๐ซ" U1D56B # double-struck lowercase z
+
+# accented letters
+<Multi_key> <L> <a> <apostrophe> <space>: "รก" U00E1 # lowercase a with acute accent
+<Multi_key> <L> <a> <grave> <space>: "ร " U00E0 # lowercase a with grave accent
+<Multi_key> <L> <a> <colon> <space>: "รค" U00E4 # lowercase a with umlaut
+<Multi_key> <L> <a> <asciicircum> <space>: "รข" U00E2 # lowercase a with circumflex
+<Multi_key> <L> <a> <asciitilde> <space>: "รฃ" U00E3 # lowercase a with tilde
+<Multi_key> <L> <a> <e> <space>: "รฆ" U00E6 # lowercase ae diphthong
+<Multi_key> <L> <c> <comma> <space>: "รง" U00E7 # lowercase c with cedilla
+<Multi_key> <L> <e> <apostrophe> <space>: "รฉ" U00E9 # lowercase e with acute accent
+<Multi_key> <L> <e> <grave> <space>: "รจ" U00E8 # lowercase e with grave accent
+<Multi_key> <L> <e> <colon> <space>: "รซ" U00EB # lowercase e with umlaut
+<Multi_key> <L> <e> <asciicircum> <space>: "รช" U00EA # lowercase e with circumflex
+<Multi_key> <L> <i> <apostrophe> <space>: "รญ" U00ED # lowercase i with acute accent
+<Multi_key> <L> <i> <grave> <space>: "รฌ" U00EC # lowercase i with grave accent
+<Multi_key> <L> <i> <colon> <space>: "รฏ" U00EF # lowercase i with umlaut
+<Multi_key> <L> <i> <asciicircum> <space>: "รฎ" U00EE # lowercase i with circumflex
+<Multi_key> <L> <n> <asciitilde> <space>: "รฑ" U00F1 # lowercase n with tilde
+<Multi_key> <L> <o> <apostrophe> <space>: "รณ" U00F3 # lowercase o with acute accent
+<Multi_key> <L> <o> <grave> <space>: "รฒ" U00F2 # lowercase o with grave accent
+<Multi_key> <L> <o> <colon> <space>: "รถ" U00F6 # lowercase o with umlaut
+<Multi_key> <L> <o> <asciicircum> <space>: "รด" U00F4 # lowercase o with circumflex
+<Multi_key> <L> <o> <asciitilde> <space>: "รต" U00F5 # lowercase o with tilde
+<Multi_key> <L> <o> <e> <space>: "ล" U0153 # lowercase oe diphthong
+
+
+# #--------------------------------------------------------------------------------
+# Greek
+
+<Multi_key> <G> <A> <space>: "ฮ" U0391 # greek capital letter alpha
+<Multi_key> <G> <B> <space>: "ฮ" U0392 # greek capital letter beta
+<Multi_key> <G> <G> <space>: "ฮ" U0393 # greek capital letter gamma
+<Multi_key> <G> <D> <space>: "ฮ" U0394 # greek capital letter delta
+<Multi_key> <G> <E> <space>: "ฮ" U0395 # greek capital letter epsilon
+<Multi_key> <G> <Z> <space>: "ฮ" U0396 # greek capital letter zeta
+<Multi_key> <G> <H> <space>: "ฮ" U0397 # greek capital letter eta
+<Multi_key> <G> <J> <space>: "ฮ" U0398 # greek capital letter theta
+<Multi_key> <G> <I> <space>: "ฮ" U0399 # greek capital letter iota
+<Multi_key> <G> <K> <space>: "ฮ" U039A # greek capital letter kappa
+<Multi_key> <G> <L> <space>: "ฮ" U039B # greek capital letter lamda
+<Multi_key> <G> <M> <space>: "ฮ" U039C # greek capital letter mu
+<Multi_key> <G> <N> <space>: "ฮ" U039D # greek capital letter nu
+<Multi_key> <G> <X> <space>: "ฮ" U039E # greek capital letter xi
+<Multi_key> <G> <O> <space>: "ฮ" U039F # greek capital letter omicron
+<Multi_key> <G> <P> <space>: "ฮ " U03A0 # greek capital letter pi
+<Multi_key> <G> <R> <space>: "ฮก" U03A1 # greek capital letter rho
+<Multi_key> <G> <S> <space>: "ฮฃ" U03A3 # greek capital letter sigma
+<Multi_key> <G> <T> <space>: "ฮค" U03A4 # greek capital letter tau
+<Multi_key> <G> <U> <space>: "ฮฅ" U03A5 # greek capital letter upsilon
+<Multi_key> <G> <F> <space>: "ฮฆ" U03A6 # greek capital letter phi
+<Multi_key> <G> <Q> <space>: "ฮง" U03A7 # greek capital letter chi
+<Multi_key> <G> <Y> <space>: "ฮจ" U03A8 # greek capital letter psi
+<Multi_key> <G> <W> <space>: "ฮฉ" U03A9 # greek capital letter omega
+
+<multi_key> <G> <a> <space>: "ฮฑ" u03b1 # greek small letter alpha
+<multi_key> <G> <b> <space>: "ฮฒ" u03b2 # greek small letter beta
+<multi_key> <G> <g> <space>: "ฮณ" u03b3 # greek small letter gamma
+<multi_key> <G> <d> <space>: "ฮด" u03b4 # greek small letter delta
+<multi_key> <G> <e> <space>: "ฮต" u03b5 # greek small letter epsilon
+<multi_key> <G> <z> <space>: "ฮถ" u03b6 # greek small letter zeta
+<multi_key> <G> <h> <space>: "ฮท" u03b7 # greek small letter eta
+<multi_key> <G> <j> <space>: "ฮธ" u03b8 # greek small letter theta
+<multi_key> <G> <i> <space>: "ฮน" u03b9 # greek small letter iota
+<multi_key> <G> <k> <space>: "ฮบ" u03ba # greek small letter kappa
+<multi_key> <G> <l> <space>: "ฮป" u03bb # greek small letter lamda
+<multi_key> <G> <m> <space>: "ฮผ" u03bc # greek small letter mu
+<multi_key> <G> <n> <space>: "ฮฝ" u03bd # greek small letter nu
+<multi_key> <G> <x> <space>: "ฮพ" u03be # greek small letter xi
+<multi_key> <G> <o> <space>: "ฮฟ" u03bf # greek small letter omicron
+<multi_key> <G> <p> <space>: "ฯ" u03c0 # greek small letter pi
+<multi_key> <G> <r> <space>: "ฯ" u03c1 # greek small letter rho
+<multi_key> <G> <s> <space>: "ฯ" u03c3 # greek small letter sigma
+<multi_key> <G> <t> <space>: "ฯ" u03c4 # greek small letter tau
+<multi_key> <G> <u> <space>: "ฯ
" u03c5 # greek small letter upsilon
+<multi_key> <G> <f> <space>: "ฯ" u03c6 # greek small letter phi
+<multi_key> <G> <q> <space>: "ฯ" u03c7 # greek small letter chi
+<multi_key> <G> <y> <space>: "ฯ" u03c8 # greek small letter psi
+<multi_key> <G> <w> <space>: "ฯ" u03c9 # greek small letter omega
+
+# --------------------------------------------------------------------------------
+# math
+
+<Multi_key> <m> <x> <space>: "ร" U00D7 # multiplication sign
+<Multi_key> <m> <period> <space>: "ยท" U00B7 # middle dot
+<Multi_key> <m> <period> <s> <space>: "โก" U22A1 # squared dot operator
+
+<Multi_key> <m> <equal> <slash> <space>: "โ " U2260 # not equal to
+
+<Multi_key> <m> <less> <hyphen> <space>: "โค" U2264 # less-than or equal to
+<Multi_key> <m> <greater> <hyphen> <space>: "โฅ" U2265 # greater-than or equal to
+<Multi_key> <m> <0> <slash> <space>: "โ
" U2205 # empty set
+
+
+<Multi_key> <m> <e> <o> <space>: "โ" U2208 # element of
+<Multi_key> <m> <e> <o> <slash> <space>: "โ" U2209 # not an element of
+
+<Multi_key> <m> <U> <space>: "โช" U222A # union
+<Multi_key> <m> <U> <u> <space>: "โ" U22C2 # n-ary interesection
+<Multi_key> <m> <U> <r> <space>: "โ" U2282 # subset of
+<Multi_key> <m> <U> <r> <hyphen> <space>: "โ" U2286 # subset of or equal to
+<Multi_key> <m> <U> <l> <space>: "โ" U2283 # superset of
+<Multi_key> <m> <U> <l> <hyphen> <space>: "โ" U2287 # superset of or equal to
+
+<Multi_key> <m> <u> <space>: "โฉ" U2229 # intersection
+<Multi_key> <m> <C> <space>: "โ" U2201 # complement
+
+<Multi_key> <m> <E> <b> <space>: "โ" U2203 # there exists
+<Multi_key> <m> <E> <b> <slash> <space>: "โ" U2204 # there does not exist
+<Multi_key> <m> <A> <u> <space>: "โ" U2200 # for all
+
+<Multi_key> <m> <hyphen> <space>: "ยฌ" U00AC # not sign
+
+<Multi_key> <m> <V> <space>: "โ" U2228 # big vee, n-ary logical or
+<Multi_key> <m> <V> <u> <space>: "โ" U22C0 # big wedge n-ary LOGICAL AND
+
+<Multi_key> <m> <v> <space>: "โจ" U2228 # little vee logical or
+<Multi_key> <m> <v> <u> <space>: "โง" U2227 # little weddge logical and
+<Multi_key> <m> <v> <u> <hyphen> <space>: "โผ" U22BC # NAND
+<Multi_key> <m> <hyphen> <greater> <space>: "โ" U27A0 # implies
+<Multi_key> <m> <=> <greater> <space>: "โ" U21D2 # implies
+<Multi_key> <m> <less> <=> <greater> <space>: "โ" U21D4 # if and only if
+
+<Multi_key> <m> <O> <greater> <space>: "โณ" U27F3 # clockwise gapped circle arrow, 'do' or 'for' operator
+<Multi_key> <m> <s> <r> <space>: "โจ" U25E8 # square with right inked 'rightmost' 'maximum' operator
+<Multi_key> <m> <s> <l> <space>: "โง" U25E7 # square with left inked 'leftmost' 'minimum' operator
+<Multi_key> <m> <t> <o> <space>: "โฅ" U2625 # ankh
--- /dev/null
+
+#!/bin/bash
+# set -x
+
+subu="$1"
+if [ -z "$subu" ]; then
+ echo "No subuser name supplied"
+ exit 1
+fi
+
+# actual subu user name and subu home directory
+subu_user="Thomas-$subu"
+subu_dir="/home/Thomas/subu_data/$subu"
+
+# detect current display and authority
+display_val="${DISPLAY:-:0}"
+authority_val="${XAUTHORITY:-$HOME/.Xauthority}"
+
+# construct guest's authority path (destination)
+subu_Xauthority_path="$HOME/subu/$subu/.Xauthority"
+
+if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
+ # Wayland/XWayland uses a temporary XAUTHORITY file (already in $XAUTHORITY)
+ echo "Wayland session detected"
+ xhost +SI:localuser:"$subu_user"
+else
+ # X11 session โ extract the proper cookie
+ echo "X11 session detected"
+ mkdir -p "$(dirname "$subu_Xauthority_path")"
+ touch "$subu_Xauthority_path"
+ xauth extract "$subu_Xauthority_path" "$display_val"
+fi
+
+# allow guest processes to outlive login
+sudo loginctl enable-linger "$subu_user"
+
+# Launch the subuser shell with DISPLAY and XAUTHORITY
+sudo machinectl shell "$subu_user"@ /bin/bash -c "
+ export DISPLAY='$display_val';
+ export XAUTHORITY='$subu_Xauthority_path';
+ umask 077
+ exec \"\$SHELL\" -l
+"
--- /dev/null
+#!/bin/sh
+
+/usr/bin/date -u +"%Y-%m-%d %H:%M:%SZ"
--- /dev/null
+#!/usr/bin/env bash
+# cat_named โ print a header + filename + UTC mtime, then file contents
+
+set -euo pipefail
+
+hr() { printf '%*s\n' 80 '' | tr ' ' '-'; }
+
+if [[ $# -eq 0 ]]; then
+ echo "usage: $0 <file...>" >&2
+ exit 1
+fi
+
+for f in "$@"; do
+ if [[ ! -f "$f" ]]; then
+ echo "skip (not a regular file): $f" >&2
+ continue
+ fi
+ ts="$(date -u -r "$f" +'%Y-%m-%dT%H:%M:%SZ' 2>/dev/null || stat -c '%y' "$f" 2>/dev/null)"
+ hr
+ printf '%s %s\n\n' "$f" "$ts"
+ cat -- "$f"
+ printf '\n'
+done
--- /dev/null
+#!/usr/bin/env python3
+"""
+echo replacement in Python
+
+Options:
+ -n do not output the trailing newline
+ -e enable interpretation of backslash escapes
+ -E disable interpretation of backslash escapes (default)
+ -v vertical list (one argument per line)
+ -s sort arguments (locale-aware, like ls)
+
+Combinations:
+ -vs / -sv sort arguments, then print vertically
+ -s (alone) sorted, multi-column output (like ls)
+"""
+
+import math
+import shutil
+import sys
+import codecs
+import locale
+
+
+def decode_escapes(s):
+ """
+ Interpret C-style backslash escapes, similar to `echo -e`.
+ Uses Python's unicode_escape; handles \\n, \\t, \\xNN, \\0NNN, etc.
+ """
+ try:
+ return codecs.decode(s, "unicode_escape")
+ except Exception:
+ return s
+
+
+def format_columns(items, width):
+ """
+ Format a list of strings into multi-column text, roughly like `ls`.
+ Returns a single string with embedded newlines but no trailing newline.
+ """
+ if not items:
+ return ""
+
+ maxlen = max(len(s) for s in items)
+ col_width = maxlen + 2
+
+ if width <= 0:
+ width = 80
+
+ cols = max(1, width // col_width)
+ rows = (len(items) + cols - 1) // cols
+
+ lines = []
+ for r in range(rows):
+ row_items = []
+ for c in range(cols):
+ i = c * rows + r
+ if i >= len(items):
+ continue
+ s = items[i]
+ if c == cols - 1 or i + rows >= len(items):
+ row_items.append(s)
+ else:
+ row_items.append(s.ljust(col_width))
+ lines.append("".join(row_items))
+
+ return "\n".join(lines)
+
+
+def echo(args, interpret_escapes, no_newline, vertical, sort_items):
+ """
+ Core echo implementation.
+ Writes to stdout and returns an exit status code.
+ """
+ if interpret_escapes:
+ args = [decode_escapes(a) for a in args]
+
+ if sort_items:
+ # Locale-aware sort, to match ls behavior under current locale
+ args = sorted(args, key=locale.strxfrm)
+
+ if vertical:
+ out = "\n".join(args)
+ elif sort_items:
+ width = shutil.get_terminal_size(fallback=(80, 24)).columns
+ out = format_columns(args, width)
+ else:
+ out = " ".join(args)
+
+ if no_newline:
+ sys.stdout.write(out)
+ sys.stdout.flush()
+ else:
+ sys.stdout.write(out + "\n")
+ sys.stdout.flush()
+
+ return 0
+
+
+def CLI(argv):
+ """
+ Command-line interface: parse argv, then call echo().
+ """
+ # Use environment locale for collation, like ls
+ try:
+ locale.setlocale(locale.LC_COLLATE, "")
+ except locale.Error:
+ # If locale is broken, we just fall back to C collation
+ pass
+
+ interpret_escapes = False
+ no_newline = False
+ vertical = False
+ sort_items = False
+
+ args = []
+ stop_opts = False
+ i = 1
+
+ while i < len(argv):
+ arg = argv[i]
+
+ if stop_opts:
+ args.append(arg)
+ i += 1
+ continue
+
+ if arg == "--":
+ stop_opts = True
+ i += 1
+ continue
+
+ if arg.startswith("-") and len(arg) > 1:
+ unknown = False
+ for ch in arg[1:]:
+ if ch == "n":
+ no_newline = True
+ elif ch == "e":
+ interpret_escapes = True
+ elif ch == "E":
+ interpret_escapes = False
+ elif ch == "v":
+ vertical = True
+ elif ch == "s":
+ sort_items = True
+ else:
+ unknown = True
+ break
+
+ if unknown:
+ args.append(arg)
+ stop_opts = True
+
+ i += 1
+ continue
+
+ args.append(arg)
+ i += 1
+
+ return echo(args, interpret_escapes, no_newline, vertical, sort_items)
+
+
+if __name__ == "__main__":
+ raise SystemExit(CLI(sys.argv))
--- /dev/null
+#!/usr/bin/python3
+
+#--------------------------------------------------------------------------------
+# generate a random string length n of form
+# "" | [A-Za-z^IloO] | [A-Za-z^IloO][0-9A-Za-z_-^IloO01]*[A-Za-z^IloO]
+#
+
+import sys
+import random
+
+# note missing IloO01.
+# period and comman might be difficult, light period might be missed
+# capital I in san-serif font looks like number 1.
+# email addresses are not case sensitive
+# these are not all the legal characters, but rather the ones we think are legal and legible
+legal_chars_end = "abcdefghijkmnpqrstuvwxz"
+legal_chars = "23456789abcdefghijkmnpqrstuvwxz"
+
+def index():
+ return random.randrange(0 ,len(legal_chars))
+
+def index_end():
+ return random.randrange(0 ,len(legal_chars_end))
+
+def char():
+ return legal_chars[index()]
+
+def char_end():
+ return legal_chars_end[index_end()]
+
+def string(n=6):
+ if n < 0 : raise Exception("string called with negative length")
+ if n == 0 : return ""
+
+ result = char_end()
+ if n == 1: return result
+
+ for _ in range(n-2): result += char()
+ result += char_end()
+
+ return result
+
+def test_0():
+ limit = 1e7 # surely by then
+ i = 0
+ c = char()
+ while c != '~' and i < limit:
+ i += 1
+ c = char()
+ print(i)
+ return i < limit
+
+def test_1():
+ limit = 1e7 # surely by then
+ i = 0
+ c = char()
+ while c != '0' and i < limit:
+ i += 1
+ c = char()
+ print(i)
+ return i < limit
+
+def test_2():
+ limit = 1e7 # surely by then
+ i = 0
+ c = char_end()
+ while c != 'z' and i < limit:
+ i += 1
+ c = char_end()
+ print(i)
+ return i < limit
+
+def test_3 ():
+ limit = 1e7 # surely by then
+ i = 0
+ c = char_end()
+ while c != 'A' and i < limit:
+ i += 1
+ c = char_end()
+ print(i)
+ return i < limit
+
+def test_4():
+ s0 = string()
+ s1 = string(10)
+ s2 = string(100)
+
+ print(s0)
+ print(s1)
+ print(s2)
+
+ return len(s0)==6 and len(s1)==10 and len(s2)==100
+
+
+n=6
+if len(sys.argv) > 1:
+ n = int(sys.argv[1])
+print(string(n))
+
--- /dev/null
+#!/usr/bin/python3
+
+#--------------------------------------------------------------------------------
+# generate a random string length n of form
+# "" | [A-Za-z^IloO] | [A-Za-z^IloO][0-9A-Za-z_-^IloO01]*[A-Za-z^IloO]
+#
+
+import sys
+import random
+
+#debug = True
+debug = False
+
+# note missing IloO01.
+# period and comman might be difficult, light period might be missed
+# capital I in san-serif font looks like number 1.
+# zero and oh of course
+# SNCF does not take an & as a special hmm.
+chars_alpha_small = "abcdefghijkmnpqrstuvwxz"
+chars_alpha_big = "ABCDEFGHJKLMNPQRSTUVWXYZ"
+chars_special = "+-_$.,;?"
+chars_numeric = "23456789"
+
+sets_leftmost=[chars_alpha_small ,chars_alpha_big]
+sets_standard=[chars_alpha_small ,chars_alpha_big ,chars_special ,chars_numeric]
+sets_rightmost=[chars_alpha_small ,chars_alpha_big ,chars_numeric]
+
+def set_psets(sets):
+ len_sum = sum(len(x) for x in sets)
+ psets = [len(x)/len_sum + 1e-7 for x in sets]
+ if debug: print("psets" ,psets ,"sum:" ,sum(psets))
+ return psets
+
+def choose_set(sets):
+ psets = set_psets(sets)
+ x = random.random()
+ if debug: print("x:" ,x)
+ if len(psets) == 0: return 0
+ p = psets[0]
+ choice = len(psets) - 1
+ i = 0
+ while i != len(psets) - 1:
+ if x <= p :
+ choice = i
+ break
+ i += 1
+ p += psets[i]
+ if debug: print("choice:" ,choice)
+ return choice
+
+def get_char_set(set):
+ index = random.randrange(0 ,len(set))
+ return set[index]
+
+def get_char(sets):
+ set = sets[choose_set(sets)]
+ return get_char_set(set)
+
+def get_string(n):
+ if n < 0 : raise Exception("string called with negative length")
+ if n == 0: return ""
+ if n == 1: return get_char_set(chars_alpha)
+
+ result = ""
+ result += get_char(sets_leftmost)
+ for _ in range(n-2): result += get_char(sets_standard)
+ result += get_char(sets_rightmost)
+
+ return result
+
+def get_passwd(n ,strict):
+ s = get_string(n)
+ while strict:
+ has_special = any(i in s for i in chars_special)
+ has_numeric = any(i in s for i in chars_numeric)
+ if debug: print("strict:" ,has_special ,has_numeric)
+ if has_special and has_numeric:
+ break
+ s = get_string(n)
+ return s
+
+strict = False
+n=9
+for arg in sys.argv[1:]:
+ if arg.isdigit(): n = int(arg)
+ if arg == "strict": strict = True
+
+if debug:
+ print("n:" ,n)
+ print("strict:" ,strict)
+
+pw = get_passwd(n ,strict)
+print(pw)
+sys.exit(0)
+
+
--- /dev/null
+#!/usr/bin/python3
+
+#--------------------------------------------------------------------------------
+# generate a random string length n of form
+#
+
+import sys
+import random
+
+# note missing IloO01.
+# period and comman might be difficult, light period might be missed
+# capital I in san-serif font looks like number 1.
+legal_chars_end = "abcdefghjkmnpqrstuvwxz"
+legal_chars = "23456789abcdefghijkmnpqrstuvwxz"
+
+def index():
+ return random.randrange(0 ,len(legal_chars))
+
+def index_end():
+ return random.randrange(0 ,len(legal_chars_end))
+
+def char():
+ return legal_chars[index()]
+
+def char_end():
+ return legal_chars_end[index_end()]
+
+def string(n=6):
+ if n < 0 : raise Exception("string called with negative length")
+ if n == 0 : return ""
+
+ result = char_end()
+ if n == 1: return result
+
+ for _ in range(n-2): result += char()
+ result += char_end()
+
+ return result
+
+def test_0():
+ limit = 1e7 # surely by then
+ i = 0
+ c = char()
+ while c != '~' and i < limit:
+ i += 1
+ c = char()
+ print(i)
+ return i < limit
+
+def test_1():
+ limit = 1e7 # surely by then
+ i = 0
+ c = char()
+ while c != '0' and i < limit:
+ i += 1
+ c = char()
+ print(i)
+ return i < limit
+
+def test_2():
+ limit = 1e7 # surely by then
+ i = 0
+ c = char_end()
+ while c != 'z' and i < limit:
+ i += 1
+ c = char_end()
+ print(i)
+ return i < limit
+
+def test_3 ():
+ limit = 1e7 # surely by then
+ i = 0
+ c = char_end()
+ while c != 'A' and i < limit:
+ i += 1
+ c = char_end()
+ print(i)
+ return i < limit
+
+def test_4():
+ s0 = string()
+ s1 = string(10)
+ s2 = string(100)
+
+ print(s0)
+ print(s1)
+ print(s2)
+
+ return len(s0)==6 and len(s1)==10 and len(s2)==100
+
+
+n=16
+if len(sys.argv) > 1:
+ n = int(sys.argv[1])
+print(string(n))
+
--- /dev/null
+#!/usr/bin/env python3
+"""
+printenv replacement in Python
+
+Behavior:
+ - With no NAME arguments: print all environment variables as NAME=value,
+ sorted by NAME.
+ - With one or more NAME arguments: print only their values (one per line),
+ in the order given.
+
+Options:
+ -0, --null separate entries with NUL instead of newline
+ -q, --quote-newlines print embedded newlines as literal "\\n"
+ -h, --help show usage
+"""
+
+import os
+import sys
+from textwrap import dedent
+
+
+def usage(prog):
+ return dedent(f"""\
+ Usage: {prog} [OPTION]... [NAME]...
+
+ With no NAME arguments, print all environment variables as NAME=value,
+ sorted by NAME.
+
+ With one or more NAME arguments, print only their values (one per line),
+ in the order given.
+
+ Options:
+ -0, --null separate entries with NUL instead of newline
+ -q, --quote-newlines print embedded newlines as literal "\\n"
+ -h, --help display this help and exit
+
+ Notes:
+ - This implementation sorts variables by NAME by default.
+ - The original system printenv is usually at /usr/bin/printenv
+ if you ever need the unsorted version.
+ """)
+
+
+def printenv(null_terminate, quote_newlines, names, prog):
+ """
+ Core printenv implementation.
+ Uses os.environ directly, writes to stdout, returns exit status.
+ """
+ sep = "\0" if null_terminate else "\n"
+
+ def fmt_value(val):
+ if quote_newlines:
+ return val.replace("\n", "\\n")
+ return val
+
+ if names:
+ for name in names:
+ if name in os.environ:
+ out = fmt_value(os.environ[name])
+ sys.stdout.write(out)
+ sys.stdout.write(sep)
+ return 0
+
+ items = sorted(os.environ.items(), key=lambda kv: kv[0])
+
+ for name, val in items:
+ line = f"{name}={fmt_value(val)}"
+ sys.stdout.write(line)
+ sys.stdout.write(sep)
+
+ return 0
+
+
+def CLI(argv):
+ """
+ Command-line interface: parse argv, then call printenv().
+ """
+ prog = argv[0] if argv else "printenv"
+
+ null_terminate = False
+ quote_newlines = False
+ names = []
+
+ args = argv[1:]
+ i = 0
+
+ while i < len(args):
+ arg = args[i]
+
+ if arg == "--":
+ names.extend(args[i + 1 :])
+ break
+
+ if arg in ("-h", "--help"):
+ sys.stdout.write(usage(prog))
+ return 0
+
+ if arg in ("-0", "--null"):
+ null_terminate = True
+ i += 1
+ continue
+
+ if arg in ("-q", "--quote-newlines"):
+ quote_newlines = True
+ i += 1
+ continue
+
+ if arg.startswith("-") and len(arg) > 1:
+ sys.stderr.write(f"{prog}: unknown option: {arg}\n")
+ sys.stderr.write(f"Try '{prog} --help' for more information.\n")
+ return 1
+
+ names.append(arg)
+ names.extend(args[i + 1 :])
+ break
+
+ return printenv(null_terminate, quote_newlines, names, prog)
+
+
+if __name__ == "__main__":
+ raise SystemExit(CLI(sys.argv))
--- /dev/null
+#!/bin/bash
+
+# Fix permissions script
+# Usage: ./fix_permissions.sh <directory>
+# Recursively makes the directory and its contents group readable
+# and if user executable, also group executable.
+
+# Check if argument is provided
+if [ -z "$1" ]; then
+ echo "Usage: $0 <directory>"
+ exit 1
+fi
+
+# Directory to fix
+target_dir="$1"
+
+# Check if the directory exists
+if [ ! -d "$target_dir" ]; then
+ echo "Error: Directory '$target_dir' does not exist."
+ exit 1
+fi
+
+# Fix permissions
+echo "Fixing permissions for directory: $target_dir"
+find "$target_dir" -type f -exec chmod g+r {} \; # Make files group-readable
+find "$target_dir" -type d -exec chmod g+rx {} \; # Make directories group-readable and executable
+find "$target_dir" -perm -u+x -exec chmod g+x {} \; # Make group executable if user executable
+
+echo "Permissions fixed for '$target_dir'."
--- /dev/null
+#!/bin/bash
+# launch_subu.sh โ Start a subuser shell (console or GUI-aware, with systemd user session)
+
+set -euo pipefail
+umask 0077
+
+subu="$1"
+if [ -z "$subu" ]; then
+ echo "โ No subuser name supplied"
+ exit 1
+fi
+
+subu_user="Thomas-$subu"
+if ! id "$subu_user" &>/dev/null; then
+ echo "โ User $subu_user does not exist"
+ exit 1
+fi
+
+# Check required commands
+error_flag=0
+for cmd in machinectl xauth xhost dbus-run-session; do
+ if ! command -v "$cmd" &>/dev/null; then
+ echo "โ $cmd not found"
+ error_flag=1
+ fi
+done
+if [ "$error_flag" -eq 1 ]; then
+ exit 1
+fi
+
+# don't use sudo -v, because it will echo the password into the emacs shell
+sudo echo >& /dev/null
+
+
+# Something broke when I turned this off. What was it. Will have to turn it off again and
+# test.
+#
+# Enable lingering so user services can persist
+sudo loginctl enable-linger "$subu_user"
+
+# Decide how to set the use_xauth and use_xhost flags.
+#
+# As of the time of this writing, on my machines, Wayland insists on
+# xauth, while my X11 is refuses to use it, thus it needs xhost control.
+# So this is how I determine how to set the flags here.
+#
+
+# bash will evaluate this variables inside a quoted if even when the
+# gate is falase, so everything needs to be initialized, whether used
+# or not.
+subu_Xauthority_path=""
+use_xauth=0
+use_xhost=0
+if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then
+ has_display=true
+ XDG_SESSION_TYPE="wayland"
+ subu_Xauthority_path="$HOME/subu/$subu/.Xauthority"
+ use_xauth=1
+ use_xhost=0
+ echo "๐ Wayland session - Using xauth for access control"
+
+elif [[ -n "${DISPLAY:-}" ]]; then
+ has_display=true
+ XDG_SESSION_TYPE="x11"
+ use_xauth=0
+ use_xhost=1
+ echo "๐งฑ X11 session - Using xhost for access control"
+
+else
+ has_display=false
+ XDG_SESSION_TYPE="tty"
+ use_xauth=0
+ use_xhost=0
+ echo "๐ณ Console session (no X detected)"
+fi
+
+if [[ "$use_xhost" -eq 1 ]]; then
+ xhost +SI:localuser:"$subu_user"
+fi
+if [[ "$use_xauth" -eq 1 ]]; then
+ mkdir -p "$(dirname "$subu_Xauthority_path")"
+ touch "$subu_Xauthority_path"
+ xauth extract "$subu_Xauthority_path" "$DISPLAY"
+fi
+
+if $has_display; then
+
+
+ sudo machinectl shell "$subu_user"@ /bin/bash -c "
+
+ # --- session env from parent ---
+ export DISPLAY=\"${DISPLAY:-${WAYLAND_DISPLAY}}\";
+ export XDG_RUNTIME_DIR='/run/user/$(id -u "$subu_user")';
+ export XDG_SESSION_TYPE=\"$XDG_SESSION_TYPE\";
+ export XDG_SESSION_CLASS=\"user\";
+ export XDG_DATA_DIRS=\"/usr/share/gnome:/usr/local/share/:/usr/share/\";
+ export USE_XAUTH=$use_xauth
+
+ # Only set XAUTHORITY when we actually prepared it (Wayland/xauth case)
+ if [[ \"\$USE_XAUTH\" -eq 1 ]]; then
+ export XAUTHORITY=\"$subu_Xauthority_path\"
+ fi
+
+ if command -v /usr/bin/gnome-keyring-daemon &>/dev/null; then
+ eval \$(/usr/bin/gnome-keyring-daemon --start)
+ export GNOME_KEYRING_CONTROL GNOME_KEYRING_PID
+ fi
+
+ # WirePlumber: ignore logind (subuser isn't the active seat)
+ systemctl --user set-environment WIREPLUMBER_DISABLE_PLUGINS=logind
+ systemctl --user import-environment DISPLAY XAUTHORITY WAYLAND_DISPLAY XDG_RUNTIME_DIR XDG_SESSION_TYPE
+
+ # Bring up audio (sockets first, then services)
+ systemctl --user enable --now pipewire.socket pipewire-pulse.socket >/dev/null 2>&1 || true
+ systemctl --user restart wireplumber pipewire pipewire-pulse
+
+ exec dbus-run-session -- bash -l
+ "
+
+else
+
+ # Console mode with DBus session (give it audio too)
+ sudo machinectl shell "$subu_user"@ /bin/bash -c "
+ export XDG_RUNTIME_DIR='/run/user/$(id -u "$subu_user")}';
+
+ systemctl --user set-environment WIREPLUMBER_DISABLE_PLUGINS=logind
+ systemctl --user import-environment XDG_RUNTIME_DIR
+ systemctl --user enable --now pipewire.socket pipewire-pulse.socket >/dev/null 2>&1 || true
+ systemctl --user restart wireplumber pipewire pipewire-pulse
+
+ exec dbus-run-session -- bash -l
+ "
+fi
+
+
--- /dev/null
+#!/bin/bash
+# launch_subu.sh โ Start a subuser shell (console or GUI-aware)
+
+set -euo pipefail
+
+subu="$1"
+if [ -z "$subu" ]; then
+ echo "โ No subuser name supplied"
+ exit 1
+fi
+
+subu_user="Thomas-$subu"
+subu_dir="/home/Thomas/subu_data/$subu"
+
+# Enable lingering to survive logout
+sudo loginctl enable-linger "$subu_user"
+
+# Check for X11 or Wayland
+has_display=false
+if [[ "${DISPLAY:-}" != "" ]]; then
+ has_display=true
+ echo "๐ฅ Graphical session detected: $DISPLAY"
+else
+ echo "๐ณ Console session (no X detected)"
+fi
+
+if $has_display; then
+ # Start subuser shell with full GUI + DBus + user session
+ sudo machinectl shell "$subu_user"@ /bin/bash -c "
+ export DISPLAY='$DISPLAY';
+ if [[ $use_xauth -eq 1 ]]; then
+ export XAUTHORITY='$subu_Xauthority_path';
+ fi
+
+ export XDG_RUNTIME_DIR='/run/user/$(id -u "$subu_user")';
+
+ if command -v /usr/bin/gnome-keyring-daemon &>/dev/null; then
+ eval \$(/usr/bin/gnome-keyring-daemon --start)
+ export GNOME_KEYRING_CONTROL GNOME_KEYRING_PID
+ fi
+
+ exec dbus-run-session -- bash -l
+ "
+else
+ # Start subuser shell without X env
+ sudo machinectl shell "$subu_user"@ /bin/bash -l
+fi
--- /dev/null
+
+# alsactl init seemed to be required, though sound is already working
+# for Thomas.
+root@Stanley:/home/Thomas-masu# alsactl init
+
+Found hardware: "HDA-Intel" "ATI R6xx HDMI" "HDA:1002aa01,00aa0100,00100700" "0x1002" "0x1637"
+Hardware is initialized using a generic method
+Found hardware: "HDA-Intel" "Realtek ALC294" "HDA:10ec0294,104311af,00100004" "0x1043" "0x11af"
+Hardware is initialized using a generic method
+Found hardware: "USB-Audio" "USB Mixer" "USB046d:0a8f" "" ""
+Hardware is initialized using a generic method
+
+dnf reinstall pipewire-alsa
+
+
+
+
+#!/bin/bash
+set -e
+
+# Check for subuser name
+if [ -z "$1" ]; then
+ echo "Usage: $0 <subu_name>"
+ exit 1
+fi
+
+SUBU_NAME=$1
+SUBU_USER="Thomas-$SUBU_NAME"
+SUBU_HOME="/home/$SUBU_USER"
+
+# Check if the subuser exists
+if ! id "$SUBU_USER" &>/dev/null; then
+ echo "Error: Subuser $SUBU_USER does not exist!"
+ exit 1
+fi
+
+echo "Setting up subuser: $SUBU_USER"
+
+# 1. Enable linger for the subuser
+echo "Enabling linger for $SUBU_USER..."
+sudo loginctl enable-linger "$SUBU_USER"
+
+# 2. Enable pipewire services for the subuser
+echo "Enabling pipewire services for $SUBU_USER..."
+sudo -u "$SUBU_USER" systemctl --user enable pipewire
+sudo -u "$SUBU_USER" systemctl --user enable pipewire-pulse
+
+# 3. Set up X11 access (XAUTHORITY)
+echo "Setting up X11 access for $SUBU_USER..."
+XAUTH_PATH="$SUBU_HOME/.Xauthority"
+if [ ! -f "$XAUTH_PATH" ]; then
+ sudo -u "$SUBU_USER" touch "$XAUTH_PATH"
+fi
+
+# Generate a trusted X11 cookie
+echo "Generating trusted X11 cookie..."
+xauth generate "$DISPLAY" . trusted
+xauth extract - "$DISPLAY" | sudo -u "$SUBU_USER" xauth merge -
+
+# 4. Set up a basic .bashrc if not already present
+echo "Setting up .bashrc for $SUBU_USER..."
+BASHRC_PATH="$SUBU_HOME/.bashrc"
+if [ ! -f "$BASHRC_PATH" ]; then
+ sudo -u "$SUBU_USER" cp /etc/skel/.bashrc "$BASHRC_PATH"
+ echo "# Custom settings for $SUBU_USER" | sudo -u "$SUBU_USER" tee -a "$BASHRC_PATH"
+fi
+
+# 5. Adjust permissions for the subuser home directory (optional)
+echo "Ensuring correct permissions for $SUBU_HOME..."
+sudo chown -R "$SUBU_USER:$SUBU_USER" "$SUBU_HOME"
+
+echo "Subuser setup complete for $SUBU_USER!"
--- /dev/null
+;;--------------------------------------------------------------------------------
+;; TTCA
+
+ (global-set-key [f1] 'help-command)
+ (global-set-key "\C-h" 'nil)
+ (define-key key-translation-map (kbd "M-S") (kbd "ยง"))
+
+ ;; extended character set moved to XCompose, done on the compose key
+ ;; for ibus driver for the US keyboard instead of in Emacs
+
+ ; ;; extended character set for programming examples in the TTCA book
+ ; ;;
+ ; ;; preferable to have keys for the characters, but the keyboard is already overloaded ..
+ ; ;; (define-key key-translation-map (kbd "<f9> p") (kbd "ยฌ"))
+ ; ;; (set-input-method โlatin-9-prefix)
+ ; (global-set-key [f1] 'help-command)
+ ; (global-set-key "\C-h" 'nil)
+ ; (define-key key-translation-map (kbd "M-S") (kbd "ยง"))
+
+ ; (global-set-key (kbd "C-x g phi SPC") [?ฯ]) ; phi for phase
+ ; (global-set-key (kbd "C-x g Phi SPC") [?ฮฆ])
+
+ ; (global-set-key (kbd "C-x g d SPC") [?ฮด])
+ ; (global-set-key (kbd "C-x g D SPC") [?ฮ]) ; this is 'delta' is not 'increment'!
+ ; (global-set-key (kbd "C-x g delta SPC") [?ฮด])
+ ; (global-set-key (kbd "C-x g Delta SPC") [?ฮ]) ; this is 'delta' is not 'increment'!
+
+ ; (global-set-key (kbd "C-x g g SPC") [?ฮณ])
+ ; (global-set-key (kbd "C-x g G SPC") [?ฮ])
+ ; (global-set-key (kbd "C-x g gamma SPC") [?ฮณ])
+ ; (global-set-key (kbd "C-x g Gamma SPC") [?ฮ])
+
+ ; (global-set-key (kbd "C-x g l SPC") [?ฮป])
+ ; (global-set-key (kbd "C-x g L SPC") [?ฮ])
+ ; (global-set-key (kbd "C-x g lambda SPC") [?ฮป])
+ ; (global-set-key (kbd "C-x g Lambda SPC") [?ฮ])
+
+ ; (global-set-key (kbd "C-x g p SPC") [?ฯ])
+ ; (global-set-key (kbd "C-x g P SPC") [?ฮ ])
+ ; (global-set-key (kbd "C-x g pi SPC") [?ฯ])
+ ; (global-set-key (kbd "C-x g Pi SPC") [?ฮ ])
+
+ ; (global-set-key (kbd "C-x g > = SPC") [?โฅ])
+ ; (global-set-key (kbd "C-x g < = SPC") [?โค])
+ ; (global-set-key (kbd "C-x g ! = SPC") [?โ ])
+ ; (global-set-key (kbd "C-x g neq SPC") [?โ ])
+
+ ; (global-set-key (kbd "C-x g nil SPC") [?โ
])
+
+ ; (global-set-key (kbd "C-x g not SPC") [?ยฌ])
+
+ ; (global-set-key (kbd "C-x g and SPC") [?โง])
+ ; (global-set-key (kbd "C-x g or SPC") [?โจ])
+
+ ; (global-set-key (kbd "C-x g exists SPC") [?โ])
+ ; (global-set-key (kbd "C-x g all SPC") [?โ])
+
+ ; (global-set-key (kbd "C-x g do SPC") [?โณ]) ; do
+ ; (global-set-key (kbd "C-x g rm SPC") [?โจ])
+ ; (global-set-key (kbd "C-x g lm SPC") [?โง])
+
+ ; (global-set-key (kbd "C-x g cont SPC") [?โ]) ; continue
+ ; (global-set-key (kbd "C-x g thread SPC") [?โฅ]) ; thread
+
+ ; (global-set-key (kbd "C-x g in SPC") [?โ]) ; set membership
+
+ ; (global-set-key (kbd "C-x g times SPC") [?ร]) ; set membership
+
+ ; (global-set-key (kbd "C-x g cdot SPC") [?ยท]) ; scoping sepearator for gcc C
+ ; (global-set-key (kbd "C-x g inc SPC") [?โก]) ; a b + a + b
--- /dev/null
+# Author: Thomas Walker Lynch
+# 2023-10-24
+# MIT license
+
+# I purposely left out prior definitions so as to support namespaces as noted below.
+# include "/usr/share/X11/locale/en_US.UTF-8/Compose"
+
+# The goal here is not to include all of unicode. That would be silly, as
+# typing compose characters is cumbersome. If a person wants to use a
+# different script, that person should change the keyboard layout setting.
+# This file is for supporting math and science writing in English, and
+# for supporting accents.
+
+
+#--------------------------------------------------------------------------------
+# all the special characters have as their origins tricks played on
+# manual typewriters. Thus this .Xcompose file defines each sepcial
+# character by the character we start with, followed by a description
+# of what we do with it. As examples, double striking letters, turning
+# them upside down, typing a slash through it, etc.
+#
+# <namespace> <keyboard character> <typesetting trick> ... <space>: <definition> <Unumber> # comment
+#
+# Be starting with a namespace character we reduce the problem of potential
+# aliasing to that namespace. By ending each sequence with a <space>, by
+# hitting the space bar, we may make a prefix sequence to a longer sequence
+# unique. In this manner we may add more than one typesetting trick to a
+# single character.
+#
+
+#--------------------------------------------------------------------------------
+# name spaces
+# L - Latin
+# G - Greek
+# m - math
+#
+
+#--------------------------------------------------------------------------------
+# typesetting instructions
+#
+# ' : add accent
+# ` : add accent agui
+# : : place double dot over
+#
+# d : doublstrike
+#
+# u : upside down
+# r : rotate right
+# l : rotate left
+# b : backwards
+# o : occlusion (originally typed by placing another piece of paper to chop part off)
+#
+# / : strike through
+# - : overstrike with a - (underscore is used for subscript)
+# s : put a square around it
+# c : put a circle around it
+#
+# ^ : superscript
+# _ : subscript
+
+#--------------------------------------------------------------------------------
+# Latin
+
+# Double struck
+<Multi_key> <L> <A> <d> <space>: "๐ธ" U1D538 # double-struck capital A
+<Multi_key> <L> <B> <d> <space>: "๐น" U1D539 # double-struck capital B
+<Multi_key> <L> <C> <d> <space>: "โ" U2102 # double-struck capital C
+<Multi_key> <L> <D> <d> <space>: "๐ป" U1D53B # double-struck capital D
+<Multi_key> <L> <E> <d> <space>: "๐ผ" U1D53C # double-struck capital E
+<Multi_key> <L> <F> <d> <space>: "๐ฝ" U1D53D # double-struck capital F
+<Multi_key> <L> <G> <d> <space>: "๐พ" U1D53E # double-struck capital G
+<Multi_key> <L> <H> <d> <space>: "โ" U210D # double-struck capital H
+<Multi_key> <L> <I> <d> <space>: "๐" U1D540 # double-struck capital I
+<Multi_key> <L> <J> <d> <space>: "๐" U1D541 # double-struck capital J
+<Multi_key> <L> <K> <d> <space>: "๐" U1D542 # double-struck capital K
+<Multi_key> <L> <L> <d> <space>: "๐" U1D543 # double-struck capital L
+<Multi_key> <L> <M> <d> <space>: "๐" U1D544 # double-struck capital M
+<Multi_key> <L> <N> <d> <space>: "โ" U2115 # double-struck capital N
+<Multi_key> <L> <O> <d> <space>: "๐" U1D546 # double-struck capital O
+<Multi_key> <L> <P> <d> <space>: "โ" U2119 # double-struck capital P
+<Multi_key> <L> <Q> <d> <space>: "โ" U211A # double-struck capital Q
+<Multi_key> <L> <R> <d> <space>: "โ" U211D # double-struck capital R
+<Multi_key> <L> <S> <d> <space>: "๐" U1D54A # double-struck capital S
+<Multi_key> <L> <T> <d> <space>: "๐" U1D54B # double-struck capital T
+<Multi_key> <L> <U> <d> <space>: "๐" U1D54C # double-struck capital U
+<Multi_key> <L> <V> <d> <space>: "๐" U1D54D # double-struck capital V
+<Multi_key> <L> <W> <d> <space>: "๐" U1D54E # double-struck capital W
+<Multi_key> <L> <X> <d> <space>: "๐" U1D54F # double-struck capital X
+<Multi_key> <L> <Y> <d> <space>: "๐" U1D550 # double-struck capital Y
+<Multi_key> <L> <Z> <d> <space>: "โค" U2124 # double-struck capital Z
+
+<Multi_key> <L> <a> <d> <space>: "๐" U1D552 # double-struck lowercase a
+<Multi_key> <L> <b> <d> <space>: "๐" U1D553 # double-struck lowercase b
+<Multi_key> <L> <c> <d> <space>: "๐" U1D554 # double-struck lowercase c
+<Multi_key> <L> <d> <d> <space>: "๐" U1D555 # double-struck lowercase d
+<Multi_key> <L> <e> <d> <space>: "๐" U1D556 # double-struck lowercase e
+<Multi_key> <L> <f> <d> <space>: "๐" U1D557 # double-struck lowercase f
+<Multi_key> <L> <g> <d> <space>: "๐" U1D558 # double-struck lowercase g
+<Multi_key> <L> <h> <d> <space>: "๐" U1D559 # double-struck lowercase h
+<Multi_key> <L> <i> <d> <space>: "๐" U1D55A # double-struck lowercase i
+<Multi_key> <L> <j> <d> <space>: "๐" U1D55B # double-struck lowercase j
+<Multi_key> <L> <k> <d> <space>: "๐" U1D55C # double-struck lowercase k
+<Multi_key> <L> <l> <d> <space>: "๐" U1D55D # double-struck lowercase l
+<Multi_key> <L> <m> <d> <space>: "๐" U1D55E # double-struck lowercase m
+<Multi_key> <L> <n> <d> <space>: "๐" U1D55F # double-struck lowercase n
+<Multi_key> <L> <o> <d> <space>: "๐ " U1D560 # double-struck lowercase o
+<Multi_key> <L> <p> <d> <space>: "๐ก" U1D561 # double-struck lowercase p
+<Multi_key> <L> <q> <d> <space>: "๐ข" U1D562 # double-struck lowercase q
+<Multi_key> <L> <r> <d> <space>: "๐ฃ" U1D563 # double-struck lowercase r
+<Multi_key> <L> <s> <d> <space>: "๐ค" U1D564 # double-struck lowercase s
+<Multi_key> <L> <t> <d> <space>: "๐ฅ" U1D565 # double-struck lowercase t
+<Multi_key> <L> <u> <d> <space>: "๐ฆ" U1D566 # double-struck lowercase u
+<Multi_key> <L> <v> <d> <space>: "๐ง" U1D567 # double-struck lowercase v
+<Multi_key> <L> <w> <d> <space>: "๐จ" U1D568 # double-struck lowercase w
+<Multi_key> <L> <x> <d> <space>: "๐ฉ" U1D569 # double-struck lowercase x
+<Multi_key> <L> <y> <d> <space>: "๐ช" U1D56A # double-struck lowercase y
+<Multi_key> <L> <z> <d> <space>: "๐ซ" U1D56B # double-struck lowercase z
+
+# accented letters
+<Multi_key> <L> <a> <apostrophe> <space>: "รก" U00E1 # lowercase a with acute accent
+<Multi_key> <L> <a> <grave> <space>: "ร " U00E0 # lowercase a with grave accent
+<Multi_key> <L> <a> <colon> <space>: "รค" U00E4 # lowercase a with umlaut
+<Multi_key> <L> <a> <asciicircum> <space>: "รข" U00E2 # lowercase a with circumflex
+<Multi_key> <L> <a> <asciitilde> <space>: "รฃ" U00E3 # lowercase a with tilde
+<Multi_key> <L> <a> <e> <space>: "รฆ" U00E6 # lowercase ae diphthong
+<Multi_key> <L> <c> <comma> <space>: "รง" U00E7 # lowercase c with cedilla
+<Multi_key> <L> <e> <apostrophe> <space>: "รฉ" U00E9 # lowercase e with acute accent
+<Multi_key> <L> <e> <grave> <space>: "รจ" U00E8 # lowercase e with grave accent
+<Multi_key> <L> <e> <colon> <space>: "รซ" U00EB # lowercase e with umlaut
+<Multi_key> <L> <e> <asciicircum> <space>: "รช" U00EA # lowercase e with circumflex
+<Multi_key> <L> <i> <apostrophe> <space>: "รญ" U00ED # lowercase i with acute accent
+<Multi_key> <L> <i> <grave> <space>: "รฌ" U00EC # lowercase i with grave accent
+<Multi_key> <L> <i> <colon> <space>: "รฏ" U00EF # lowercase i with umlaut
+<Multi_key> <L> <i> <asciicircum> <space>: "รฎ" U00EE # lowercase i with circumflex
+<Multi_key> <L> <n> <asciitilde> <space>: "รฑ" U00F1 # lowercase n with tilde
+<Multi_key> <L> <o> <apostrophe> <space>: "รณ" U00F3 # lowercase o with acute accent
+<Multi_key> <L> <o> <grave> <space>: "รฒ" U00F2 # lowercase o with grave accent
+<Multi_key> <L> <o> <colon> <space>: "รถ" U00F6 # lowercase o with umlaut
+<Multi_key> <L> <o> <asciicircum> <space>: "รด" U00F4 # lowercase o with circumflex
+<Multi_key> <L> <o> <asciitilde> <space>: "รต" U00F5 # lowercase o with tilde
+<Multi_key> <L> <o> <e> <space>: "ล" U0153 # lowercase oe diphthong
+
+
+# #--------------------------------------------------------------------------------
+# Greek
+
+<Multi_key> <G> <A> <space>: "ฮ" U0391 # greek capital letter alpha
+<Multi_key> <G> <B> <space>: "ฮ" U0392 # greek capital letter beta
+<Multi_key> <G> <G> <space>: "ฮ" U0393 # greek capital letter gamma
+<Multi_key> <G> <D> <space>: "ฮ" U0394 # greek capital letter delta
+<Multi_key> <G> <E> <space>: "ฮ" U0395 # greek capital letter epsilon
+<Multi_key> <G> <Z> <space>: "ฮ" U0396 # greek capital letter zeta
+<Multi_key> <G> <H> <space>: "ฮ" U0397 # greek capital letter eta
+<Multi_key> <G> <J> <space>: "ฮ" U0398 # greek capital letter theta
+<Multi_key> <G> <I> <space>: "ฮ" U0399 # greek capital letter iota
+<Multi_key> <G> <K> <space>: "ฮ" U039A # greek capital letter kappa
+<Multi_key> <G> <L> <space>: "ฮ" U039B # greek capital letter lamda
+<Multi_key> <G> <M> <space>: "ฮ" U039C # greek capital letter mu
+<Multi_key> <G> <N> <space>: "ฮ" U039D # greek capital letter nu
+<Multi_key> <G> <X> <space>: "ฮ" U039E # greek capital letter xi
+<Multi_key> <G> <O> <space>: "ฮ" U039F # greek capital letter omicron
+<Multi_key> <G> <P> <space>: "ฮ " U03A0 # greek capital letter pi
+<Multi_key> <G> <R> <space>: "ฮก" U03A1 # greek capital letter rho
+<Multi_key> <G> <S> <space>: "ฮฃ" U03A3 # greek capital letter sigma
+<Multi_key> <G> <T> <space>: "ฮค" U03A4 # greek capital letter tau
+<Multi_key> <G> <U> <space>: "ฮฅ" U03A5 # greek capital letter upsilon
+<Multi_key> <G> <F> <space>: "ฮฆ" U03A6 # greek capital letter phi
+<Multi_key> <G> <Q> <space>: "ฮง" U03A7 # greek capital letter chi
+<Multi_key> <G> <Y> <space>: "ฮจ" U03A8 # greek capital letter psi
+<Multi_key> <G> <W> <space>: "ฮฉ" U03A9 # greek capital letter omega
+
+<multi_key> <G> <a> <space>: "ฮฑ" u03b1 # greek small letter alpha
+<multi_key> <G> <b> <space>: "ฮฒ" u03b2 # greek small letter beta
+<multi_key> <G> <g> <space>: "ฮณ" u03b3 # greek small letter gamma
+<multi_key> <G> <d> <space>: "ฮด" u03b4 # greek small letter delta
+<multi_key> <G> <e> <space>: "ฮต" u03b5 # greek small letter epsilon
+<multi_key> <G> <z> <space>: "ฮถ" u03b6 # greek small letter zeta
+<multi_key> <G> <h> <space>: "ฮท" u03b7 # greek small letter eta
+<multi_key> <G> <j> <space>: "ฮธ" u03b8 # greek small letter theta
+<multi_key> <G> <i> <space>: "ฮน" u03b9 # greek small letter iota
+<multi_key> <G> <k> <space>: "ฮบ" u03ba # greek small letter kappa
+<multi_key> <G> <l> <space>: "ฮป" u03bb # greek small letter lamda
+<multi_key> <G> <m> <space>: "ฮผ" u03bc # greek small letter mu
+<multi_key> <G> <n> <space>: "ฮฝ" u03bd # greek small letter nu
+<multi_key> <G> <x> <space>: "ฮพ" u03be # greek small letter xi
+<multi_key> <G> <o> <space>: "ฮฟ" u03bf # greek small letter omicron
+<multi_key> <G> <p> <space>: "ฯ" u03c0 # greek small letter pi
+<multi_key> <G> <r> <space>: "ฯ" u03c1 # greek small letter rho
+<multi_key> <G> <s> <space>: "ฯ" u03c3 # greek small letter sigma
+<multi_key> <G> <t> <space>: "ฯ" u03c4 # greek small letter tau
+<multi_key> <G> <u> <space>: "ฯ
" u03c5 # greek small letter upsilon
+<multi_key> <G> <f> <space>: "ฯ" u03c6 # greek small letter phi
+<multi_key> <G> <q> <space>: "ฯ" u03c7 # greek small letter chi
+<multi_key> <G> <y> <space>: "ฯ" u03c8 # greek small letter psi
+<multi_key> <G> <w> <space>: "ฯ" u03c9 # greek small letter omega
+
+# --------------------------------------------------------------------------------
+# math
+
+<Multi_key> <m> <x> <space>: "ร" U00D7 # multiplication sign
+<Multi_key> <m> <period> <space>: "ยท" U00B7 # middle dot
+<Multi_key> <m> <period> <s> <space>: "โก" U22A1 # squared dot operator
+
+<Multi_key> <m> <equal> <slash> <space>: "โ " U2260 # not equal to
+
+<Multi_key> <m> <less> <hyphen> <space>: "โค" U2264 # less-than or equal to
+<Multi_key> <m> <greater> <hyphen> <space>: "โฅ" U2265 # greater-than or equal to
+<Multi_key> <m> <0> <slash> <space>: "โ
" U2205 # empty set
+
+
+<Multi_key> <m> <e> <o> <space>: "โ" U2208 # element of
+<Multi_key> <m> <e> <o> <slash> <space>: "โ" U2209 # not an element of
+
+<Multi_key> <m> <U> <space>: "โช" U222A # union
+<Multi_key> <m> <U> <u> <space>: "โ" U22C2 # n-ary interesection
+<Multi_key> <m> <U> <r> <space>: "โ" U2282 # subset of
+<Multi_key> <m> <U> <r> <hyphen> <space>: "โ" U2286 # subset of or equal to
+<Multi_key> <m> <U> <l> <space>: "โ" U2283 # superset of
+<Multi_key> <m> <U> <l> <hyphen> <space>: "โ" U2287 # superset of or equal to
+
+<Multi_key> <m> <u> <space>: "โฉ" U2229 # intersection
+<Multi_key> <m> <C> <space>: "โ" U2201 # complement
+
+<Multi_key> <m> <E> <b> <space>: "โ" U2203 # there exists
+<Multi_key> <m> <E> <b> <slash> <space>: "โ" U2204 # there does not exist
+<Multi_key> <m> <A> <u> <space>: "โ" U2200 # for all
+
+<Multi_key> <m> <hyphen> <space>: "ยฌ" U00AC # not sign
+
+<Multi_key> <m> <V> <space>: "โ" U2228 # big vee, n-ary logical or
+<Multi_key> <m> <V> <u> <space>: "โ" U22C0 # big wedge n-ary LOGICAL AND
+
+<Multi_key> <m> <v> <space>: "โจ" U2228 # little vee logical or
+<Multi_key> <m> <v> <u> <space>: "โง" U2227 # little weddge logical and
+<Multi_key> <m> <v> <u> <hyphen> <space>: "โผ" U22BC # NAND
+<Multi_key> <m> <hyphen> <greater> <space>: "โ" U27A0 # implies
+<Multi_key> <m> <=> <greater> <space>: "โ" U21D2 # implies
+<Multi_key> <m> <less> <=> <greater> <space>: "โ" U21D4 # if and only if
+
+<Multi_key> <m> <O> <greater> <space>: "โณ" U27F3 # clockwise gapped circle arrow, 'do' or 'for' operator
+<Multi_key> <m> <s> <r> <space>: "โจ" U25E8 # square with right inked 'rightmost' 'maximum' operator
+<Multi_key> <m> <s> <l> <space>: "โง" U25E7 # square with left inked 'leftmost' 'minimum' operator
+<Multi_key> <m> <t> <o> <space>: "โฅ" U2625 # ankh
--- /dev/null
+;;--------------------------------------------------------------------------------
+;; set the title at the top of the frame
+;;
+ (defun frame-title (s)
+ "sets the frame title"
+ (interactive "stitle: ")
+ (setq frame-title-format s)
+ )
+
+;;--------------------------------------------------------------------------------
+;; turn off the annoying bell
+;;
+;; (setq ring-bell-function (lambda ()
+;; (call-process-shell-command
+;; "xset led 3; xset -led 3" nil 0 nil)))
+;;
+;; (setq ring-bell-function nil)
+
+ (setq ring-bell-function
+ (lambda ()
+ (call-process-shell-command "xset led named 'Scroll Lock'")
+ (call-process-shell-command "xset -led named 'Scroll Lock'")))
+
+;;--------------------------------------------------------------------------------
+;; tell emacs not to make new files in the working directory
+;; so that backups and git repos don't get polluted
+;;
+
+ ;; use a backrevs dir rather than leaving ~file droppings everywhere
+ ;;
+ (setq backup-directory-alist `(("." . "~/emacs_backrevs")))
+ (setq backup-by-copying t)
+
+ ;; so that lock files do not end up in the repo
+ ;;
+ (setq create-lockfiles nil)
+
+;;--------------------------------------------------------------------------------
+;; Font
+;;
+
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(default ((t (:family "Noto Sans Mono" :foundry "GOOG" :slant normal :weight normal :height 98 :width normal))))
+ '(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0)))))
+
+;;--------------------------------------------------------------------------------
+;; elisp utilities
+;;
+ ;; get buffer filename -- emacs does not have a built in function for this.
+ ;;
+ (defun filename-get ()
+ "Gets the name of the file the current buffer is based on."
+ (buffer-file-name (window-buffer (minibuffer-selected-window))))
+
+ (defun filename-insert ()
+ "Inserts the name of the file the current buffer is based on."
+ (interactive)
+ (insert (filename-get)))
+
+ (global-set-key (kbd "C-c f") 'filename-insert)
+
+ (defun filename ()
+ "Gets the name of the file the current buffer is based on."
+ (interactive)
+ (message (filename-get))
+ )
+
+;;--------------------------------------------------------------------------------
+;; Melpa
+;;
+ (require 'package)
+ (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
+ (add-to-list 'load-path "~/projects/neotree")
+ (package-initialize)
+
+ ;; M-x package-install
+ (if (not (package-installed-p 'neotree)) (package-install 'neotree))
+ (if (not (package-installed-p 'ace-window)) (package-install 'ace-window))
+
+;;--------------------------------------------------------------------------------
+;; emacs shell
+;;
+
+ ;; get the pwd in shell mode from the prompt rather than guessing by
+ ;; watching the commands typed .. yes! now shell variables and source
+ ;; scripts will work
+ ;; in bashrc: export PS1='\n$(/usr/local/bin/Z)\u@\hยง\wยง\n> '
+ ;;
+ (add-hook 'shell-mode-hook
+ (lambda ()
+ (shell-dirtrack-mode -1)
+ (dirtrack-mode 1)))
+
+ (add-hook 'dirtrack-directory-change-hook
+ (lambda ()
+ (message default-directory)))
+
+;; (setq dirtrack-list '("ยง\\(.*\\)ยง\n[>#] " 1))
+ (setq dirtrack-list '("ยง\\([^ยง]*\\)ยง" 1))
+
+;;--------------------------------------------------------------------------------
+;; Ace Window Manager
+;;
+
+; (use-package ace-window
+; :init
+; (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
+; (setq aw-background nil))
+
+ ;(global-set-key (kbd "M-o") 'switch-window)
+ ;(require 'ace-window)
+; (global-set-key (kbd "M-o") 'ace-window)
+; (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
+; (setq aw-background nil)
+
+;;--------------------------------------------------------------------------------
+;; neotree
+;;
+ ; (require 'neotree)
+ ; (global-set-key [f8] 'neotree-toggle)
+ ; (setq neo-window-fixed-size nil)
+ ; (setq neo-smart-open t)
+ ; (setq neo-window-width 45)
+
+;;--------------------------------------------------------------------------------
+;; Tramp
+;;
+;;;https://www.gnu.org/software/emacs/manual/html_node/tramp/Frequently-Asked-Questions.html
+;;
+
+
+ ;; trap wants to write to /tmp, but when logged in as root it causes failures and pop up new frames with warnings
+ ;;
+ (add-to-list 'backup-directory-alist (cons tramp-file-name-regexp nil))
+
+
+ (setq tramp-completion-reread-directory-timeout nil)
+
+ (defun shell-make (dir buffer-name)
+ (let* (
+ (default-directory dir)
+ (buffer (get-buffer-create buffer-name))
+ )
+ (set-buffer buffer)
+ (shell buffer)
+ ))
+
+ (defun shell~ () (interactive) (shell-make "~" "shell~"))
+ (defun shell-root () (interactive) (shell-make "/sudo::/root" "shell-root"))
+ (defun shell-rt () (interactive) (shell-make "/ssh:thomas_lynch@reasoningtechnology.com:~" "shell-rt"))
+ ;(defun shell-rt-root() (interactive) (shell-make "/ssh:thomas_lynch@reasoningtechnology.com|sudo:reasoningtechnology.com:" "shell-rt-root"))
+ (defun shell-rt-root() (interactive) (shell-make "/ssh:root@reasoningtechnology.com:~" "shell-rt-root"))
+
+ (defun shell-LFS () (interactive) (shell-make "/ssh:lfs@192.168.122.115:~" "shell-LFS"))
+ (defun shell-LFS-root () (interactive) (shell-make "/ssh:root@192.168.122.115:~" "shell-LFS-root"))
+
+ (defun shell-Shihju () (interactive) (shell-make "/sudo:Shihju@localhost:/home/Shihju" "shell-Shihju"))
+ (defun shell-Wendell () (interactive) (shell-make "/ssh:Morpheus@Wendell:~" "shell-Wendell"))
+ (defun shell-Wendell-root () (interactive) (shell-make "/ssh:Morpheus@Wendell|sudo:Wendell:" "shell-Wendell-root"))
+ (defun shell-Wendell-Shihju () (interactive) (shell-make "/ssh:Morpheus@Wendell|sudo:Shihju@Wendell:" "shell-Wendell-Shihju"))
+
+
+ (defun dired-rt ()
+ (interactive)
+ (dired "/ssh:thomas_lynch@reasoningtechnology.com:")
+ )
+
+ (defun dired-rt-root ()
+ (interactive)
+ (dired "/ssh:thomas_lynch@reasoningtechnology.com|sudo:reasoningtechnology.com:")
+ )
+
+;;--------------------------------------------------------------------------------
+;; gdb
+;; use gud-gdb instead of gdb and we won't need this.
+;; fix 'feature' of broken gdb where it takes control of an
+;; emacs window, and locks the user out from switching from it
+;;
+ (defun unlock-window ()
+ "Turns off window dedication."
+ (interactive)
+ (set-window-dedicated-p (get-buffer-window (current-buffer)) nil)
+ )
+
+;;--------------------------------------------------------------------------------
+;; shell scripting
+;;
+ (setq sh-basic-offset 2)
+
+;;--------------------------------------------------------------------------------
+;; json
+;;
+ (setq json-encoding-pretty-print t)
+ (setq json-encoding-lisp-style-closings t)
+ ;(setq json-encoding-lisp-style-closings nil)
+ (defun wrap-comma ()
+ "wrap end of line comma to first of next line"
+ (interactive)
+ (while (re-search-forward "\\(.*\\), *\n\\( *\\)" nil t) (replace-match "\\1\n\\2,"))
+ )
+
+;;--------------------------------------------------------------------------------
+;; rust
+;;
+;; (require 'package)
+;; (add-to-list 'package-archives
+;; '("melpa-stable" . "https://stable.melpa.org/packages/"))
+;; (package-initialize)
+;; (package-refresh-contents)
+;;
+;;; (setq rust-indent-offset 2)
+;;; (require 'rust-mode)
+
+;;--------------------------------------------------------------------------------
+;; python
+;;
+ (add-hook 'python-mode-hook '(lambda () (setq python-indent 2)))
+
+;;--------------------------------------------------------------------------------
+;; Lisp
+;;
+ (setq lisp-indent-offset 2)
+ (setq inferior-lisp-program "sbcl")
+
+ (modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
+ (modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
+ (modify-syntax-entry ?{ "(}" lisp-mode-syntax-table)
+ (modify-syntax-entry ?} "){" lisp-mode-syntax-table)
+
+;;--------------------------------------------------------------------------------
+;; Web page development
+;;
+ ;(setq browse-url-browser-function 'browse-url-firefox)
+ (setq browse-url-browser-function 'browse-url-chrome)
+ ;(setq browse-url-browser-function 'browse-url-chromium)
+
+ (setq js-indent-level 2)
+ (setq css-indent-offset 2)
+ (add-to-list 'auto-mode-alist '("\\.php\\'" . html-mode))
+
+;;--------------------------------------------------------------------------------
+;; C
+;;
+ (add-hook 'c-mode-hook (lambda () (modify-syntax-entry ?ยท "_")))
+ ; in customer variables '(c-offsets-alist (quote ((label . 2))))
+ (add-to-list 'auto-mode-alist '("\\.isq\\'" . c-mode))
+
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(ansi-color-names-vector
+ ["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"])
+ '(c-basic-offset 2)
+ '(c-offsets-alist '((label . 2)))
+ '(column-number-mode t)
+ '(custom-enabled-themes '(wheatgrass deeper-blue))
+ '(direx:closed-icon "โ")
+ '(direx:leaf-icon "โ")
+ '(direx:open-icon "โ")
+ '(ediff-diff-options "-w")
+ '(ediff-split-window-function 'split-window-horizontally)
+ '(ediff-window-setup-function 'ediff-setup-windows-plain)
+ '(geiser-racket-binary "racket")
+; '(package-selected-packages '(ace-window neotree))
+ '(send-mail-function 'smtpmail-send-it)
+ '(tool-bar-mode nil))
+
+
+;;--------------------------------------------------------------------------------
+;; emacs behavior
+
+ (setq inhibit-startup-screen t)
+
+ ;; stop the 'tab' character polution
+ ;;
+ (setq-default indent-tabs-mode nil)
+
+ ;; turn off the poison C-z key. Use C-x C-z or the command suspend-emacs
+ ;;
+ (global-set-key (kbd "C-z") nil)
+
+ ;; truncate rather than wrapping lines (use horizontal scroll to see to the right)
+ ;;
+ (set-default 'truncate-lines t)
+ (setq truncate-partial-width-windows nil)
+ (setq-default fill-column 80)
+ (setq fill-column 80)
+
+ ;; recover some window real estate - note also F11 to rid of the top window splash bar
+ ;;
+ ;;(set-face-attribute 'mode-line nil :height 75)
+
+ ;; c-x mode-line to toggle the mode-line on and off
+ (defun mode-line () "toggles the modeline on and off"
+ (interactive)
+ (setq mode-line-format
+ (if (equal mode-line-format nil)
+ (default-value 'mode-line-format)) )
+ (redraw-display))
+
+ ;(setq-default mode-line-format nil)
+ (tool-bar-mode -1)
+ (menu-bar-mode -1)
+
+ (put 'narrow-to-region 'disabled nil)
+ (put 'downcase-region 'disabled nil)
+ (put 'set-goal-column 'disabled nil)
+ (put 'erase-buffer 'disabled nil)
+
+(put 'upcase-region 'disabled nil)
+;; vertical split for ediff
+
+;; '(package-selected-packages
+;; '(ace-window switch-window dired-git ztree dirtree-prosjekt dired-sidebar dirtree direx neotree treemacs markdown-mode rust-mode))
+
--- /dev/null
+;;--------------------------------------------------------------------------------
+;; set the title at the top of the frame
+;;
+ (defun frame-title (s)
+ "sets the frame title"
+ (interactive "stitle: ")
+ (setq frame-title-format s)
+ )
+
+;;--------------------------------------------------------------------------------
+;; turn off the annoying bell
+;;
+ (setq visible-bell t)
+
+;;--------------------------------------------------------------------------------
+;; tell emacs not to make new files in the working directory
+;;
+ ;; use a backrevs dir rather than leaving ~file droppings everywhere
+ ;;
+ (setq backup-directory-alist `(("." . "~/emacs_backrevs")))
+ (setq backup-by-copying t)
+
+ ;; so that lock files do not end up in the repo
+ ;;
+ (setq create-lockfiles nil)
+
+;;--------------------------------------------------------------------------------
+;; Font
+;;
+ (custom-set-faces
+ '(default ((t (:family "Noto Sans Mono" :foundry "GOOG" :slant normal :weight normal :height 98 :width normal))))
+ '(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0)))))
+
+;;--------------------------------------------------------------------------------
+;; elisp utilities
+;;
+ (defun filename-get ()
+ "Gets the name of the file the current buffer is based on."
+ (buffer-file-name (window-buffer (minibuffer-selected-window)))
+ )
+
+ (defun filename-insert ()
+ "Inserts the name of the file the current buffer is based on."
+ (interactive)
+ (insert (filename-get))
+ )
+
+ (global-set-key (kbd "C-c f") 'filename-insert)
+
+ (defun filename ()
+ "Gets the name of the file the current buffer is based on."
+ (interactive)
+ (message (filename-get))
+ )
+
+;;--------------------------------------------------------------------------------
+;; Melpa
+;;
+ (require 'package)
+ (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
+ (add-to-list 'load-path "~/projects/neotree")
+ (package-initialize)
+
+ ;; M-x package-install
+ (if (not (package-installed-p 'neotree)) (package-install 'neotree))
+ (if (not (package-installed-p 'ace-window)) (package-install 'ace-window))
+
+;;--------------------------------------------------------------------------------
+;; emacs shell
+;;
+
+ ;; get the pwd in shell mode from the prompt rather than guessing by
+ ;; watching the commands typed .. yes! now shell variables and source
+ ;; scripts will work
+ ;; in bashrc: export PS1='\n$(/usr/local/bin/Z)\u@\hยง\wยง\n> '
+ ;;
+ (add-hook 'shell-mode-hook
+ (lambda ()
+ (shell-dirtrack-mode -1)
+ (dirtrack-mode 1)))
+
+ (add-hook 'dirtrack-directory-change-hook
+ (lambda ()
+ (message default-directory)))
+
+;; (setq dirtrack-list '("ยง\\(.*\\)ยง\n[>#] " 1))
+ (setq dirtrack-list '("ยง\\([^ยง]*\\)ยง" 1))
+
+;;--------------------------------------------------------------------------------
+;; gdb
+;; use gud-gdb instead of gdb and we won't need this.
+;; fix 'feature' of broken gdb where it takes control of an
+;; emacs window, and locks the user out from switching from it
+;;
+ (defun unlock-window ()
+ "Turns off window dedication."
+ (interactive)
+ (set-window-dedicated-p (get-buffer-window (current-buffer)) nil)
+ )
+
+;;--------------------------------------------------------------------------------
+;; shell scripting
+;;
+ (setq sh-basic-offset 2)
+
+;;--------------------------------------------------------------------------------
+;; json
+;;
+ (setq json-encoding-pretty-print t)
+ (setq json-encoding-lisp-style-closings t)
+
+ (defun wrap-comma ()
+ "wrap end of line comma to first of next line"
+ (interactive)
+ (while (re-search-forward "\\(.*\\), *\n\\( *\\)" nil t) (replace-match "\\1\n\\2,"))
+ )
+
+;;--------------------------------------------------------------------------------
+;; python
+;;
+ (add-hook 'python-mode-hook '(lambda () (setq python-indent 2)))
+
+;;--------------------------------------------------------------------------------
+;; Lisp
+;;
+ (setq lisp-indent-offset 2)
+ (setq inferior-lisp-program "sbcl")
+
+ (modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
+ (modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
+ (modify-syntax-entry ?{ "(}" lisp-mode-syntax-table)
+ (modify-syntax-entry ?} "){" lisp-mode-syntax-table)
+
+;;--------------------------------------------------------------------------------
+;; Web page development
+;;
+ (setq browse-url-browser-function 'browse-url-chrome)
+ ;(setq browse-url-browser-function 'browse-url-firefox)
+ ;(setq browse-url-browser-function 'browse-url-chromium)
+
+ (setq js-indent-level 2)
+ (setq css-indent-offset 2)
+ (add-to-list 'auto-mode-alist '("\\.php\\'" . html-mode))
+
+;;--------------------------------------------------------------------------------
+;; C
+;;
+ (add-hook 'c-mode-hook (lambda () (modify-syntax-entry ?ยท "_")))
+ (add-to-list 'auto-mode-alist '("\\.isq\\'" . c-mode))
+ ; in customer variables '(c-offsets-alist (quote ((label . 2))))
+
+;;--------------------------------------------------------------------------------
+;; neotree
+;;
+ (require 'neotree)
+ (global-set-key [f8] 'neotree-toggle)
+ (setq neo-window-fixed-size nil)
+ (setq neo-smart-open t)
+ (setq neo-window-width 45)
+
+;;--------------------------------------------------------------------------------
+;; Ace Window Manager
+;;
+ (require 'ace-window)
+ (global-set-key (kbd "M-p") 'ace-window)
+
+;;--------------------------------------------------------------------------------
+;; emacs behavior
+;;
+ (setq inhibit-startup-screen t)
+ (setq-default indent-tabs-mode nil)
+ (global-set-key (kbd "C-z") nil)
+ (set-default 'truncate-lines t)
+ (setq truncate-partial-width-windows nil)
+ (setq-default fill-column 80)
+ (setq fill-column 80)
+ (tool-bar-mode -1)
+ (menu-bar-mode -1)
+ (put 'narrow-to-region 'disabled nil)
+ (put 'downcase-region 'disabled nil)
+ (put 'set-goal-column 'disabled nil)
+ (put 'erase-buffer 'disabled nil)
+ (put 'upcase-region 'disabled nil)
+ (setq byte-compile-warnings '(cl-functions))
+
+
--- /dev/null
+;;--------------------------------------------------------------------------------
+;; set the title at the top of the frame
+;;
+ (defun frame-title (s)
+ "sets the frame title"
+ (interactive "stitle: ")
+ (setq frame-title-format s)
+ )
+
+;;--------------------------------------------------------------------------------
+;; turn off the annoying bell
+;;
+;; (setq ring-bell-function (lambda ()
+;; (call-process-shell-command
+;; "xset led 3; xset -led 3" nil 0 nil)))
+;;
+;; (setq ring-bell-function nil)
+
+ (setq ring-bell-function
+ (lambda ()
+ (call-process-shell-command "xset led named 'Scroll Lock'")
+ (call-process-shell-command "xset -led named 'Scroll Lock'")))
+
+;;--------------------------------------------------------------------------------
+;; tell emacs not to make new files in the working directory
+;; so that backups and git repos don't get polluted
+;;
+
+ ;; use a backrevs dir rather than leaving ~file droppings everywhere
+ ;;
+ (setq backup-directory-alist `(("." . "~/emacs_backrevs")))
+ (setq backup-by-copying t)
+
+ ;; so that lock files do not end up in the repo
+ ;;
+ (setq create-lockfiles nil)
+
+;;--------------------------------------------------------------------------------
+;; Font
+;;
+
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(default ((t (:family "Noto Sans Mono" :foundry "GOOG" :slant normal :weight normal :height 98 :width normal))))
+ '(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0)))))
+
+;;--------------------------------------------------------------------------------
+;; elisp utilities
+;;
+ ;; get buffer filename -- emacs does not have a built in function for this.
+ ;;
+ (defun filename-get ()
+ "Gets the name of the file the current buffer is based on."
+ (buffer-file-name (window-buffer (minibuffer-selected-window))))
+
+ (defun filename-insert ()
+ "Inserts the name of the file the current buffer is based on."
+ (interactive)
+ (insert (filename-get)))
+
+ (global-set-key (kbd "C-c f") 'filename-insert)
+
+ (defun filename ()
+ "Gets the name of the file the current buffer is based on."
+ (interactive)
+ (message (filename-get))
+ )
+
+;;--------------------------------------------------------------------------------
+;; Melpa
+;;
+ (require 'package)
+ (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
+ (add-to-list 'load-path "~/projects/neotree")
+ (package-initialize)
+
+ ;; M-x package-install
+ (if (not (package-installed-p 'neotree)) (package-install 'neotree))
+ (if (not (package-installed-p 'ace-window)) (package-install 'ace-window))
+
+;;--------------------------------------------------------------------------------
+;; emacs shell
+;;
+
+ ;; get the pwd in shell mode from the prompt rather than guessing by
+ ;; watching the commands typed .. yes! now shell variables and source
+ ;; scripts will work
+ ;; in bashrc: export PS1='\n$(/usr/local/bin/Z)\u@\hยง\wยง\n> '
+ ;;
+ (add-hook 'shell-mode-hook
+ (lambda ()
+ (shell-dirtrack-mode -1)
+ (dirtrack-mode 1)))
+
+ (add-hook 'dirtrack-directory-change-hook
+ (lambda ()
+ (message default-directory)))
+
+;; (setq dirtrack-list '("ยง\\(.*\\)ยง\n[>#] " 1))
+ (setq dirtrack-list '("ยง\\([^ยง]*\\)ยง" 1))
+
+;;--------------------------------------------------------------------------------
+;; Ace Window Manager
+;;
+
+; (use-package ace-window
+; :init
+; (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
+; (setq aw-background nil))
+
+ ;(global-set-key (kbd "M-o") 'switch-window)
+ ;(require 'ace-window)
+; (global-set-key (kbd "M-o") 'ace-window)
+; (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
+; (setq aw-background nil)
+
+;;--------------------------------------------------------------------------------
+;; neotree
+;;
+ ; (require 'neotree)
+ ; (global-set-key [f8] 'neotree-toggle)
+ ; (setq neo-window-fixed-size nil)
+ ; (setq neo-smart-open t)
+ ; (setq neo-window-width 45)
+
+;;--------------------------------------------------------------------------------
+;; Tramp
+;;
+;;;https://www.gnu.org/software/emacs/manual/html_node/tramp/Frequently-Asked-Questions.html
+;;
+
+
+ ;; trap wants to write to /tmp, but when logged in as root it causes failures and pop up new frames with warnings
+ ;;
+ (add-to-list 'backup-directory-alist (cons tramp-file-name-regexp nil))
+
+
+ (setq tramp-completion-reread-directory-timeout nil)
+
+ (defun shell-make (dir buffer-name)
+ (let* (
+ (default-directory dir)
+ (buffer (get-buffer-create buffer-name))
+ )
+ (set-buffer buffer)
+ (shell buffer)
+ ))
+
+ (defun shell~ () (interactive) (shell-make "~" "shell~"))
+ (defun shell-root () (interactive) (shell-make "/sudo::/root" "shell-root"))
+ (defun shell-rt () (interactive) (shell-make "/ssh:thomas_lynch@reasoningtechnology.com:~" "shell-rt"))
+ ;(defun shell-rt-root() (interactive) (shell-make "/ssh:thomas_lynch@reasoningtechnology.com|sudo:reasoningtechnology.com:" "shell-rt-root"))
+ (defun shell-rt-root() (interactive) (shell-make "/ssh:root@reasoningtechnology.com:~" "shell-rt-root"))
+
+ (defun shell-LFS () (interactive) (shell-make "/ssh:lfs@192.168.122.115:~" "shell-LFS"))
+ (defun shell-LFS-root () (interactive) (shell-make "/ssh:root@192.168.122.115:~" "shell-LFS-root"))
+
+ (defun shell-Shihju () (interactive) (shell-make "/sudo:Shihju@localhost:/home/Shihju" "shell-Shihju"))
+ (defun shell-Wendell () (interactive) (shell-make "/ssh:Morpheus@Wendell:~" "shell-Wendell"))
+ (defun shell-Wendell-root () (interactive) (shell-make "/ssh:Morpheus@Wendell|sudo:Wendell:" "shell-Wendell-root"))
+ (defun shell-Wendell-Shihju () (interactive) (shell-make "/ssh:Morpheus@Wendell|sudo:Shihju@Wendell:" "shell-Wendell-Shihju"))
+
+
+ (defun dired-rt ()
+ (interactive)
+ (dired "/ssh:thomas_lynch@reasoningtechnology.com:")
+ )
+
+ (defun dired-rt-root ()
+ (interactive)
+ (dired "/ssh:thomas_lynch@reasoningtechnology.com|sudo:reasoningtechnology.com:")
+ )
+
+;;--------------------------------------------------------------------------------
+;; gdb
+;; use gud-gdb instead of gdb and we won't need this.
+;; fix 'feature' of broken gdb where it takes control of an
+;; emacs window, and locks the user out from switching from it
+;;
+ (defun unlock-window ()
+ "Turns off window dedication."
+ (interactive)
+ (set-window-dedicated-p (get-buffer-window (current-buffer)) nil)
+ )
+
+;;--------------------------------------------------------------------------------
+;; shell scripting
+;;
+ (setq sh-basic-offset 2)
+
+;;--------------------------------------------------------------------------------
+;; json
+;;
+ (setq json-encoding-pretty-print t)
+ (setq json-encoding-lisp-style-closings t)
+ ;(setq json-encoding-lisp-style-closings nil)
+ (defun wrap-comma ()
+ "wrap end of line comma to first of next line"
+ (interactive)
+ (while (re-search-forward "\\(.*\\), *\n\\( *\\)" nil t) (replace-match "\\1\n\\2,"))
+ )
+
+;;--------------------------------------------------------------------------------
+;; rust
+;;
+;; (require 'package)
+;; (add-to-list 'package-archives
+;; '("melpa-stable" . "https://stable.melpa.org/packages/"))
+;; (package-initialize)
+;; (package-refresh-contents)
+;;
+;;; (setq rust-indent-offset 2)
+;;; (require 'rust-mode)
+
+;;--------------------------------------------------------------------------------
+;; python
+;;
+ (add-hook 'python-mode-hook '(lambda () (setq python-indent 2)))
+
+;;--------------------------------------------------------------------------------
+;; Lisp
+;;
+ (setq lisp-indent-offset 2)
+ (setq inferior-lisp-program "sbcl")
+
+ (modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
+ (modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
+ (modify-syntax-entry ?{ "(}" lisp-mode-syntax-table)
+ (modify-syntax-entry ?} "){" lisp-mode-syntax-table)
+
+;;--------------------------------------------------------------------------------
+;; Web page development
+;;
+ ;(setq browse-url-browser-function 'browse-url-firefox)
+ (setq browse-url-browser-function 'browse-url-chrome)
+ ;(setq browse-url-browser-function 'browse-url-chromium)
+
+ (setq js-indent-level 2)
+ (setq css-indent-offset 2)
+ (add-to-list 'auto-mode-alist '("\\.php\\'" . html-mode))
+
+;;--------------------------------------------------------------------------------
+;; C
+;;
+ (add-hook 'c-mode-hook (lambda () (modify-syntax-entry ?ยท "_")))
+ ; in customer variables '(c-offsets-alist (quote ((label . 2))))
+ (add-to-list 'auto-mode-alist '("\\.isq\\'" . c-mode))
+
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(ansi-color-names-vector
+ ["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"])
+ '(c-basic-offset 2)
+ '(c-offsets-alist '((label . 2)))
+ '(column-number-mode t)
+ '(custom-enabled-themes '(wheatgrass deeper-blue))
+ '(direx:closed-icon "โ")
+ '(direx:leaf-icon "โ")
+ '(direx:open-icon "โ")
+ '(ediff-diff-options "-w")
+ '(ediff-split-window-function 'split-window-horizontally)
+ '(ediff-window-setup-function 'ediff-setup-windows-plain)
+ '(geiser-racket-binary "racket")
+; '(package-selected-packages '(ace-window neotree))
+ '(send-mail-function 'smtpmail-send-it)
+ '(tool-bar-mode nil))
+
+
+;;--------------------------------------------------------------------------------
+;; emacs behavior
+
+ (setq inhibit-startup-screen t)
+
+ ;; stop the 'tab' character polution
+ ;;
+ (setq-default indent-tabs-mode nil)
+
+ ;; turn off the poison C-z key. Use C-x C-z or the command suspend-emacs
+ ;;
+ (global-set-key (kbd "C-z") nil)
+
+ ;; truncate rather than wrapping lines (use horizontal scroll to see to the right)
+ ;;
+ (set-default 'truncate-lines t)
+ (setq truncate-partial-width-windows nil)
+ (setq-default fill-column 80)
+ (setq fill-column 80)
+
+ ;; recover some window real estate - note also F11 to rid of the top window splash bar
+ ;;
+ ;;(set-face-attribute 'mode-line nil :height 75)
+
+ ;; c-x mode-line to toggle the mode-line on and off
+ (defun mode-line () "toggles the modeline on and off"
+ (interactive)
+ (setq mode-line-format
+ (if (equal mode-line-format nil)
+ (default-value 'mode-line-format)) )
+ (redraw-display))
+
+ ;(setq-default mode-line-format nil)
+ (tool-bar-mode -1)
+ (menu-bar-mode -1)
+
+ (put 'narrow-to-region 'disabled nil)
+ (put 'downcase-region 'disabled nil)
+ (put 'set-goal-column 'disabled nil)
+ (put 'erase-buffer 'disabled nil)
+
+(put 'upcase-region 'disabled nil)
+;; vertical split for ediff
+
+;; '(package-selected-packages
+;; '(ace-window switch-window dired-git ztree dirtree-prosjekt dired-sidebar dirtree direx neotree treemacs markdown-mode rust-mode))
+
+
--- /dev/null
+
+;;--------------------------------------------------------------------------------
+;; Melpa
+;;
+ (require 'package)
+ (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
+ (not (gnutls-available-p))))
+ (proto (if no-ssl "http" "https")))
+ (when no-ssl (warn "\
+ Your version of Emacs does not support SSL connections,
+ which is unsafe because it allows man-in-the-middle attacks.
+ There are two things you can do about this warning:
+ 1. Install an Emacs version that does support SSL and be safe.
+ 2. Remove this warning from your init file so you won't see it again."))
+ (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
+ ;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
+ ;; and `package-pinned-packages`. Most users will not need or want to do this.
+ ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
+ )
+ (package-initialize)
+
+ ;(global-set-key (kbd "M-o") 'switch-window)
+ (global-set-key (kbd "M-o") 'ace-window)
+ (setq aw-background nil)
+ ;(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
+
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(default ((t (:family "Noto Sans Mono CJK JP" :foundry "GOOG" :slant normal :weight normal :height 98 :width normal))))
+ '(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0)))))
+
+ ;; (use-package ace-window
+ ;; :init
+ ;; (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
+ ;; (setq aw-background nil))
+
+;;--------------------------------------------------------------------------------
+;; set the title at the top of the frame
+;;
+ (defun frame-title (s)
+ "sets the frame title"
+ (interactive "stitle: ")
+ (setq frame-title-format s)
+ )
+
+;;--------------------------------------------------------------------------------
+;; neotree
+;;
+ ; now installed via Melpa
+ ;(add-to-list 'load-path "~/projects/neotree")
+ (require 'neotree)
+ (global-set-key [f8] 'neotree-toggle)
+ (setq neo-window-fixed-size nil)
+ (setq neo-smart-open t)
+ (setq neo-window-width 45)
+
+;;--------------------------------------------------------------------------------
+;; get buffer filename -- emacs does not have a built in functin for this.
+;;
+ (defun filename-get ()
+ "Gets the name of the file the current buffer is based on."
+ (buffer-file-name (window-buffer (minibuffer-selected-window))))
+
+ (defun filename-insert ()
+ "Inserts the name of the file the current buffer is based on."
+ (interactive)
+ (insert (filename-get)))
+
+ (global-set-key (kbd "C-c f") 'filename-insert)
+
+ (defun filename ()
+ "Gets the name of the file the current buffer is based on."
+ (interactive)
+ (message (filename-get))
+ )
+
+;;--------------------------------------------------------------------------------
+;; Tramp
+;;
+;;;https://www.gnu.org/software/emacs/manual/html_node/tramp/Frequently-Asked-Questions.html
+;;
+ (setq tramp-completion-reread-directory-timeout nil)
+
+ (defun shell-make (dir buffer-name)
+ (let* (
+ (default-directory dir)
+ (buffer (get-buffer-create buffer-name))
+ )
+ (set-buffer buffer)
+ (shell buffer)
+ ))
+
+ (defun shell~ () (interactive) (shell-make "~" "shell~"))
+ (defun shell-root () (interactive) (shell-make "/sudo::/root" "shell-root"))
+ (defun shell-rt () (interactive) (shell-make "/ssh:thomas_lynch@reasoningtechnology.com:~" "shell-rt"))
+ ;(defun shell-rt-root() (interactive) (shell-make "/ssh:thomas_lynch@reasoningtechnology.com|sudo:reasoningtechnology.com:" "shell-rt-root"))
+ (defun shell-rt-root() (interactive) (shell-make "/ssh:root@reasoningtechnology.com:~" "shell-rt-root"))
+
+ (defun shell-LFS () (interactive) (shell-make "/ssh:lfs@192.168.122.115:~" "shell-LFS"))
+ (defun shell-LFS-root () (interactive) (shell-make "/ssh:root@192.168.122.115:~" "shell-LFS-root"))
+
+ (defun shell-Shihju () (interactive) (shell-make "/sudo:Shihju@localhost:/home/Shihju" "shell-Shihju"))
+ (defun shell-Wendell () (interactive) (shell-make "/ssh:Morpheus@Wendell:~" "shell-Wendell"))
+ (defun shell-Wendell-root () (interactive) (shell-make "/ssh:Morpheus@Wendell|sudo:Wendell:" "shell-Wendell-root"))
+ (defun shell-Wendell-Shihju () (interactive) (shell-make "/ssh:Morpheus@Wendell|sudo:Shihju@Wendell:" "shell-Wendell-Shihju"))
+
+
+ (defun dired-rt ()
+ (interactive)
+ (dired "/ssh:thomas_lynch@reasoningtechnology.com:")
+ )
+
+ (defun dired-rt-root ()
+ (interactive)
+ (dired "/ssh:thomas_lynch@reasoningtechnology.com|sudo:reasoningtechnology.com:")
+ )
+
+;;--------------------------------------------------------------------------------
+;; gdb
+;; use gud-gdb instead of gdb and we won't need this.
+;; fix 'feature' of broken gdb where it takes control of an
+;; emacs window, and locks the user out from switching from it
+;;
+ (defun unlock-window ()
+ "Turns off window dedication."
+ (interactive)
+ (set-window-dedicated-p (get-buffer-window (current-buffer)) nil)
+ )
+
+
+;;--------------------------------------------------------------------------------
+;; json
+;;
+ (setq json-encoding-pretty-print t)
+ (setq json-encoding-lisp-style-closings t)
+ ;(setq json-encoding-lisp-style-closings nil)
+ (defun wrap-comma ()
+ "wrap end of line comma to first of next line"
+ (interactive)
+ (while (re-search-forward "\\(.*\\), *\n\\( *\\)" nil t) (replace-match "\\1\n\\2,"))
+ )
+
+;;--------------------------------------------------------------------------------
+;; rust
+;;
+;; (require 'package)
+;; (add-to-list 'package-archives
+;; '("melpa-stable" . "https://stable.melpa.org/packages/"))
+;; (package-initialize)
+;; (package-refresh-contents)
+;;
+;;; (setq rust-indent-offset 2)
+;;; (require 'rust-mode)
+
+;;--------------------------------------------------------------------------------
+;; python
+;;
+ (add-hook 'python-mode-hook '(lambda () (setq python-indent 2)))
+
+;;--------------------------------------------------------------------------------
+;; Lisp
+;;
+ (setq lisp-indent-offset 2)
+ (setq inferior-lisp-program "sbcl")
+
+ (modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
+ (modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
+ (modify-syntax-entry ?{ "(}" lisp-mode-syntax-table)
+ (modify-syntax-entry ?} "){" lisp-mode-syntax-table)
+
+;;--------------------------------------------------------------------------------
+;; Javascript
+;;
+ (setq js-indent-level 2)
+ (setq css-indent-offset 2)
+
+;;--------------------------------------------------------------------------------
+;; C
+;;
+ (add-hook 'c-mode-hook (lambda () (modify-syntax-entry ?ยท "_")))
+ ; in customer variables '(c-offsets-alist (quote ((label . 2))))
+
+;;--------------------------------------------------------------------------------
+;; shell scripting
+;;
+ (setq sh-basic-offset 2)
+
+;;--------------------------------------------------------------------------------
+;; extended character set for programming examples in the TTCA book
+;;
+;; preferable to have keys for the characters, but the keyboard is already overloaded ..
+;; (define-key key-translation-map (kbd "<f9> p") (kbd "ยฌ"))
+;; (set-input-method โlatin-9-prefix)
+
+ (global-set-key [f1] 'help-command)
+ (global-set-key "\C-h" 'nil)
+ (define-key key-translation-map (kbd "M-S") (kbd "ยง"))
+
+ (global-set-key (kbd "C-x g phi SPC") [?ฯ]) ; phi for phase
+ (global-set-key (kbd "C-x g Phi SPC") [?ฮฆ])
+
+ (global-set-key (kbd "C-x g d SPC") [?ฮด])
+ (global-set-key (kbd "C-x g D SPC") [?ฮ]) ; this is 'delta' is not 'increment'!
+ (global-set-key (kbd "C-x g delta SPC") [?ฮด])
+ (global-set-key (kbd "C-x g Delta SPC") [?ฮ]) ; this is 'delta' is not 'increment'!
+
+ (global-set-key (kbd "C-x g g SPC") [?ฮณ])
+ (global-set-key (kbd "C-x g G SPC") [?ฮ])
+ (global-set-key (kbd "C-x g gamma SPC") [?ฮณ])
+ (global-set-key (kbd "C-x g Gamma SPC") [?ฮ])
+
+ (global-set-key (kbd "C-x g l SPC") [?ฮป])
+ (global-set-key (kbd "C-x g L SPC") [?ฮ])
+ (global-set-key (kbd "C-x g lambda SPC") [?ฮป])
+ (global-set-key (kbd "C-x g Lambda SPC") [?ฮ])
+
+ (global-set-key (kbd "C-x g p SPC") [?ฯ])
+ (global-set-key (kbd "C-x g P SPC") [?ฮ ])
+ (global-set-key (kbd "C-x g pi SPC") [?ฯ])
+ (global-set-key (kbd "C-x g Pi SPC") [?ฮ ])
+
+ (global-set-key (kbd "C-x g > = SPC") [?โฅ])
+ (global-set-key (kbd "C-x g < = SPC") [?โค])
+ (global-set-key (kbd "C-x g ! = SPC") [?โ ])
+ (global-set-key (kbd "C-x g neq SPC") [?โ ])
+
+ (global-set-key (kbd "C-x g nil SPC") [?โ
])
+
+ (global-set-key (kbd "C-x g not SPC") [?ยฌ])
+
+ (global-set-key (kbd "C-x g and SPC") [?โง])
+ (global-set-key (kbd "C-x g or SPC") [?โจ])
+
+ (global-set-key (kbd "C-x g exists SPC") [?โ])
+ (global-set-key (kbd "C-x g all SPC") [?โ])
+
+ (global-set-key (kbd "C-x g do SPC") [?โณ]) ; do
+ (global-set-key (kbd "C-x g rb SPC") [?โจ])
+ (global-set-key (kbd "C-x g lb SPC") [?โง])
+
+ (global-set-key (kbd "C-x g cont SPC") [?โ]) ; continue
+ (global-set-key (kbd "C-x g thread SPC") [?โฅ]) ; thread
+
+ (global-set-key (kbd "C-x g in SPC") [?โ]) ; set membership
+
+ (global-set-key (kbd "C-x g times SPC") [?ร]) ; set membership
+
+ (global-set-key (kbd "C-x g cdot SPC") [?ยท]) ; scoping sepearator for gcc C
+
+
+;;--------------------------------------------------------------------------------
+;; turn off the annoying bell
+;;
+;; (setq ring-bell-function (lambda ()
+;; (call-process-shell-command
+;; "xset led 3; xset -led 3" nil 0 nil)))
+;;
+;; (setq ring-bell-function nil)
+
+ (setq ring-bell-function
+ (lambda ()
+ (call-process-shell-command "xset led named 'Scroll Lock'")
+ (call-process-shell-command "xset -led named 'Scroll Lock'")))
+
+
+;;--------------------------------------------------------------------------------
+;; dirtrack
+;;
+;; get the pwd in shell mode from the prompt rather than guessing by
+;; watching the commands typed .. yes! now shell variables and source
+;; scripts will work
+;; in bashrc: export PS1='\n$(/usr/local/bin/Z)\u@\hยง\wยง\n> '
+;;
+ (add-hook 'shell-mode-hook
+ (lambda ()
+ (shell-dirtrack-mode -1)
+ (dirtrack-mode 1)))
+
+ (add-hook 'dirtrack-directory-change-hook
+ (lambda ()
+ (message default-directory)))
+
+;; (setq dirtrack-list '("ยง\\(.*\\)ยง\n[>#] " 1))
+ (setq dirtrack-list '("ยง\\([^ยง]*\\)ยง" 1))
+
+;;--------------------------------------------------------------------------------
+;; emacs behavior
+
+ ;; use a backrevs dir rather than leaving ~file droppings everywhere
+ ;;
+ (setq backup-directory-alist `(("." . "~/emacs_backrevs")))
+ (setq backup-by-copying t)
+
+ ;; stop the 'tab' character polution
+ ;;
+ (setq-default indent-tabs-mode nil)
+
+ ;; turn off the poison C-z key. Use C-x C-z or the command suspend-emacs
+ ;;
+ (global-set-key (kbd "C-z") nil)
+
+ ;; truncate rather than wrapping lines (use horizontal scroll to see to the right)
+ ;;
+ (set-default 'truncate-lines t)
+ (setq truncate-partial-width-windows nil)
+ (setq-default fill-column 120)
+ (setq fill-column 120)
+
+ ;; recover some window real estate - note also F11 to rid of the top window splash bar
+ ;;
+ ;;(set-face-attribute 'mode-line nil :height 75)
+
+ ;; c-x mode-line to toggle the mode-line on and off
+ (defun mode-line () "toggles the modeline on and off"
+ (interactive)
+ (setq mode-line-format
+ (if (equal mode-line-format nil)
+ (default-value 'mode-line-format)) )
+ (redraw-display))
+
+ ;(setq-default mode-line-format nil)
+ (tool-bar-mode -1)
+ (menu-bar-mode -1)
+
+ (put 'upcase-region 'disabled nil)
+ (put 'narrow-to-region 'disabled nil)
+ (put 'downcase-region 'disabled nil)
+ (put 'set-goal-column 'disabled nil)
+ (put 'erase-buffer 'disabled nil)
+
+;(setq browse-url-browser-function 'browse-url-firefox)
+(setq browse-url-browser-function 'browse-url-chrome)
+;(setq browse-url-browser-function 'browse-url-chromium)
+
+
+
+;; vertical split for ediff
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(ansi-color-names-vector
+ ["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"])
+ '(c-offsets-alist '((label . 2)))
+ '(column-number-mode t)
+ '(custom-enabled-themes '(wheatgrass))
+ '(direx:closed-icon "โ")
+ '(direx:leaf-icon "โ")
+ '(direx:open-icon "โ")
+ '(ediff-diff-options "-w")
+ '(ediff-split-window-function 'split-window-horizontally)
+ '(ediff-window-setup-function 'ediff-setup-windows-plain)
+ '(geiser-racket-binary "racket")
+ '(package-selected-packages
+ '(ace-window switch-window dired-git ztree dirtree-prosjekt dired-sidebar dirtree direx neotree treemacs markdown-mode rust-mode))
+ '(send-mail-function 'smtpmail-send-it)
+ '(smtpmail-smtp-server "smtp.sendgrid.net")
+ '(tool-bar-mode nil))
+
+;;--------------------------------------------------------------------------------
+;; direx
+;;
+;; (add-to-list 'load-path "~/.emacs.d/lisp/direx")
+;; (require 'direx)
+;; (global-set-key (kbd "C-x C-j") 'direx:jump-to-directory)
+;; (push '(direx:direx-mode :position left :width 75 :dedicated t)
+;; popwin:special-display-config)
+(global-set-key (kbd "C-x C-j") 'direx:jump-to-directory-other-window)
+
+ ;; (define-key map (kbd "R") 'direx:do-rename-file)
+ ;; (define-key map (kbd "C") 'direx:do-copy-files)
+ ;; (define-key map (kbd "D") 'direx:do-delete-files)
+ ;; (define-key map (kbd "+") 'direx:create-directory)
+ ;; (define-key map (kbd "M") 'direx:do-chmod-file)
+ ;; (define-key map (kbd "L") 'direx:do-load-file)
+ ;; (define-key map (kbd "B") 'direx:do-byte-compile-file)
+ ;; (define-key map (kbd "G") 'direx:do-chgrp)
+ ;; (define-key map (kbd "O") 'direx:do-chown)
+ ;; (define-key map (kbd "T") 'direx:do-touch)
+
+
+;;----------
+
+;(add-to-list 'tramp-connection-properties
+; (list (regexp-quote "/ssh:thomas_lynch@reasoningtechnology.com:")
+; "remote-shell" "/usr/bin/bash"))
+;
+;(customize-set-variable 'tramp-encoding-shell "/usr/bin/bash")
+
+(connection-local-set-profile-variables
+ 'remote-bash
+ '((explicit-shell-file-name . "/bin/bash")
+ (explicit-bash-args . ("-i"))))
+
+;(add-to-list 'tramp-connection-properties
+; (list (regexp-quote "/ssh:thomas_lynch@reasoningtechnology.com:")
+; "remote-shell" "/usr/bin/bash"))
+;
+;(customize-set-variable 'tramp-encoding-shell "/usr/bin/bash")
+
+;; (connection-local-set-profile-variables
+;; 'remote-bash
+;; '((explicit-shell-file-name . "/bin/bash")
+;; (explicit-bash-args . ("-i"))))
+
+;; (connection-local-set-profiles
+;; '(:application tramp :protocol "ssh" :machine "localhost")
+;; 'remote-bash)
+
+;; (connection-local-set-profiles
+;; '(:application tramp :protocol "ssh" :machine "reasoningtechnology.com")
+;; 'remote-bash)
+
+;;(add-to-list 'tramp-connection-properties
+;; (list nil "remote-shell" "/bin/bash"))
+
+(setq inhibit-startup-screen t)
--- /dev/null
+#!/bin/bash
+export PATH="/home/Thomas/subu_data/incommon/executable:$PATH"
+systemctl --user import-environment PATH
+if [ -f "$HOME/.bashrc" ]; then
+ . "$HOME/.bashrc"
+fi
+
--- /dev/null
+# .bashrc
+
+# because in x11 bash_profile is not getting sourced, so I've
+# temporarily copied it here
+
+incommon=/home/Thomas/subu_data/incommon/executable
+if [[ ":$PATH:" != *":$incommon:"* ]]; then
+ export PATH="$incommon:$PATH"
+fi
+systemctl --user import-environment PATH
+
+
+# Localizations and editor preferences
+export EDITOR=emacs
+export PS_FORMAT='user:15,group:15,pid,command'
+
+# Shell behaviors
+shopt -s histappend
+shopt -s checkwinsize
+HISTSIZE=400
+HISTFILESIZE=2000
+
+# Prompt and visual environment
+export PPS1='\n$(Z) [$PROMPT_DECOR:$ROLE] \u@\h\nยง$(pwd)ยง\n> '
+export PPS2='>> '
+export PS1="$PPS1"
+export PS2="$PPS2"
+
+# Aliases
+alias emacs='emacs --title="${USER} ${PROMPT_DECOR}:$ROLE ${MODE}"'
+alias pstree='pstree -lp'
+alias printenv='printenv | awk '\''{gsub(/\n/, "\\n")}1'\'' | sort'
+alias ls='ls -a -h --time-style=long-iso'
+alias zzz="kill -STOP \$\$"
+alias ps="ps -eo user:20,group:20,pid,command"
+
+# Visual tweaks โ only if graphical session is available
+if [[ -n "$DISPLAY" ]] && command -v gsettings >/dev/null 2>&1; then
+ export NO_AT_BRIDGE=1
+ gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' 2>/dev/null
+ export GTK_THEME=Adwaita:dark
+fi
+
+# Developer-specific env
+if [[ "$user" == "Thomas-developer" ]]; then
+ export REPO_DIR=$(home)
+fi
+
+# export JAVA_HOME=/usr/lib/jvm/default-java
+# export ANDROID_HOME=$HOME/android-sdk
+
--- /dev/null
+# .bashrc
+
+# because in x11 bash_profile is not getting sourced, so I've
+# temporarily copied it here
+
+# Localizations and editor preferences
+export EDITOR=emacs
+export PS_FORMAT='user:20,group:20,pid,command'
+
+# Shell behaviors
+shopt -s histappend
+shopt -s checkwinsize
+HISTSIZE=400
+HISTFILESIZE=2000
+
+# Prompt and visual environment
+export PPS1='\n$(/usr/bin/date -u +"%Y-%m-%d %H:%M:%SZ") [root] \u@\h\nยง$(pwd)ยง\n# '
+export PPS2='>> '
+export PS1="$PPS1"
+export PS2="$PPS2"
+
+# Aliases
+alias pstree='pstree -lp'
+alias ls='ls -a -h --time-style=long-iso'
+alias zzz="kill -STOP \$\$"
+
+
--- /dev/null
+;; I abandoned this approach due to the many vagaries of assigning keys in
+;; Emacs. The mappings are not orthogonal, and carry a heavy burden to legacy
+;; terminal compatibility. I will instead attempt to define a custom keyboard
+;; layout with chords and macros, and re-assign the keys from that layer.
+;;
+
+;; the sake of sanity...
+;;
+(global-set-key (kbd "C-z") nil) ;; turn off the poison C-z key. Use C-x C-z or the command suspend-emacs
+(global-set-key (kbd "C-v") nil) ;; tempting to put paste (yank) for a common typo, but at least lets not jump down the page
+;; would be nice to clear C-c but minor modes redefine it
+
+;;--------------------------------------------------------------------------------
+(when t ; key-matrix minor mode
+
+ (defadvice add-to-ordered-list (around key-matrix-add-to-ordered-list-advice activate)
+ "Ensure that `key-matrix-mode` always has precedence."
+ (if (eq (ad-get-arg 0) 'minor-mode-map-alist)
+ (let (
+ (key-matrix-mode-pair (assoc 'key-matrix-mode minor-mode-map-alist))
+ )
+ (when key-matrix-mode-pair
+ (setq minor-mode-map-alist (delq key-matrix-mode-pair minor-mode-map-alist))
+ (setq minor-mode-map-alist (cons key-matrix-mode-pair minor-mode-map-alist))))
+ ad-do-it))
+
+ (defun key-matrix-make-minor-mode (mode-name)
+ "Make a custom minor mode with MODE-NAME."
+ (let* (
+ (mode-symbol (intern (concat mode-name "-mode")))
+ (lighter (concat " " mode-name))
+ (keymap (make-sparse-keymap))
+ )
+ (eval `(define-minor-mode ,mode-symbol
+ ,(concat "A minor mode for " mode-name " key bindings.")
+ :init-value t
+ :lighter ,lighter
+ :keymap ',keymap))
+ (eval `(,mode-symbol 1))
+ mode-symbol))
+)
+
+;;--------------------------------------------------------------------------------
+(when t ; key-matrix support functions
+
+ (defun key-matrix-dimensions (matrix)
+ "Return the dimensions of MATRIX as a list of two positive integers [rows, columns]."
+ (let ((rows (length matrix))
+ (cols (if matrix (length (car matrix)) 0)))
+ (list rows cols)))
+
+ (defun key-matrix-access (matrix row col)
+ "Return the value at the given coordinates (ROW, COL) from the provided MATRIX."
+ (if (and (>= row 0) (< row (length matrix))
+ (>= col 0) (< col (length (nth row matrix))))
+ (nth col (nth row matrix))
+ (error "Coordinates out of range")))
+
+ (defun key-matrix-make-wrapper-matrix (wrapper-function button-matrix filter-list)
+ "Return a matrix of lambdas that call 'wrapper-function' with BUTTON-MATRIX and coordinates, filtered by FILTER-LIST."
+ (let* ((dimensions (key-matrix-dimensions button-matrix))
+ (rows (car dimensions))
+ (cols (cadr dimensions))
+ (wrapper-matrix (make-vector rows nil)))
+ (message "key-matrix-make-wrapper-matrix dimensions: %d %d" rows cols)
+ (dotimes (i rows)
+ (aset wrapper-matrix i (make-vector cols nil))
+ (dotimes (j cols)
+ (let ((button-function (key-matrix-access button-matrix i j)))
+ (when (or (not filter-list) (member button-function filter-list))
+ (aset (aref wrapper-matrix i) j
+ `(lambda ()
+ (interactive)
+ (message "Calling wrapper-function %s with button-function %s"
+ ',wrapper-function ',button-function)
+ (,wrapper-function ',button-function)))))))
+ wrapper-matrix))
+
+ ;; (defun key-matrix-make-wrapper-matrix (wrapper-function button-matrix filter-list)
+ ;; "Return a matrix of lambdas that call 'wrapper-function' with BUTTON-MATRIX and coordinates, filtered by FILTER-LIST."
+ ;; (let* ((dimensions (key-matrix-dimensions button-matrix))
+ ;; (rows (car dimensions))
+ ;; (cols (cadr dimensions))
+ ;; (wrapper-matrix (make-vector rows nil)))
+ ;; (dotimes (i rows)
+ ;; (aset wrapper-matrix i (make-vector cols nil))
+ ;; (dotimes (j cols)
+ ;; (let ((button-function (key-matrix-access button-matrix i j)))
+ ;; (when (or (not filter-list) (member button-function filter-list))
+ ;; (aset (aref wrapper-matrix i) j
+ ;; `(lambda ()
+ ;; (interactive)
+ ;; (,wrapper-function ,button-function)))))))
+ ;; wrapper-matrix))
+
+ (defun key-matrix-get-minor-mode-keymap (mode-symbol)
+ "Get the keymap of the minor mode specified by MODE-SYMBOL."
+ (cdr (assoc mode-symbol minor-mode-map-alist)))
+
+ (defun key-matrix-bind (keymap button-matrix function-matrix &optional modifiers)
+ "Bind keys based on BUTTON-MATRIX and FUNCTION-MATRIX with optional MODIFIERS, string such as \"C-\" for Control, \"M-\" for Meta, etc.
+KEYMAP specifies the keymap to use for these bindings."
+ (let ((rows (length button-matrix))
+ (cols (if button-matrix (length (car button-matrix)) 0)))
+ (dotimes (i rows)
+ (dotimes (j cols)
+ (let ((button (nth j (nth i button-matrix)))
+ (function (nth j (nth i function-matrix))))
+ (when function
+ (let ((key-binding
+ (if (and (string= button "m") (string= modifiers "C-"))
+ (kbd "<f13>")
+ (kbd (concat (or modifiers "") (if (stringp button) button (symbol-name button)))))))
+ (when t ; Change to nil to disable debugging
+ (message "Binding key %s to function %s in keymap %s"
+ (key-description key-binding)
+ function
+ keymap))
+ (define-key keymap key-binding function))))))))
+
+
+)
+
+;;--------------------------------------------------------------------------------
+(when t ; places emacs functions into categories
+ (defun key-matrix-get-function-categories-alist ()
+ "Return an associative list of function category lists."
+ (list
+ (cons 'navigation-function
+ '( forward-char backward-char forward-word backward-word
+ beginning-of-line end-of-line next-line previous-line
+ beginning-of-buffer end-of-buffer forward-sentence backward-sentence
+ forward-paragraph backward-paragraph forward-page backward-page
+ forward-list backward-list beginning-of-defun end-of-defun ))
+ (cons 'search-function
+ '( isearch-backward isearch-backward-regexp isearch-forward
+ isearch-forward-regexp re-search-backward re-search-forward
+ search-backward search-forward word-search-backward
+ word-search-forward query-replace replace-string ))
+ (cons 'edit-function
+ '( backward-kill-word capitalize-word comment-region
+ delete-backward-char delete-char downcase-region downcase-word
+ fill-paragraph indent-region join-line kill-line kill-region
+ kill-whole-line kill-word transpose-chars transpose-lines
+ transpose-words uncomment-region undo undo-tree-redo upcase-region
+ upcase-word yank ))
+ (cons 'buffer-function
+ '( switch-to-buffer kill-buffer save-buffer revert-buffer list-buffers
+ next-buffer previous-buffer rename-buffer clone-indirect-buffer ))
+ (cons 'file-function
+ '( find-file write-file save-some-buffers delete-file copy-file
+ rename-file set-visited-file-name ))
+ (cons 'window-function
+ '( split-window-right split-window-below delete-window
+ delete-other-windows other-window previous-window select-window
+ enlarge-window shrink-window enlarge-window-horizontally
+ shrink-window-horizontally save-window-excursion
+ window-configuration-to-register jump-to-register balance-windows
+ balance-windows-area windmove-right windmove-left windmove-up
+ windmove-down toggle-frame-fullscreen maximize-window minimize-window
+ ))
+ (cons 'frame-functions
+ '( make-frame-command delete-frame other-frame toggle-frame-fullscreen
+ frame-configuration-to-register jump-to-register
+ ))
+ ))
+
+ (when nil
+ (let ((categories (key-matrix-get-function-categories-alist)))
+ (dolist (category categories)
+ (set (car category) (cdr category))))
+
+ (message "Navigation Functions: %S" navigation-function)
+ (message "Search Functions: %S" search-function)
+ (message "Edit Functions: %S" edit-function)
+ (message "Buffer Functions: %S" buffer-function)
+ (message "File Functions: %S" file-function)
+ (message "Window Functions: %S" window-function)
+ (message "Frame Functions: %S" frame-functions)
+ )
+ )
+
+;;--------------------------------------------------------------------------------
+(when t ; these functions can also be bound to keys
+
+ (defun deactivate-mark-command ()
+ "Deactivate the mark."
+ (interactive)
+ (deactivate-mark))
+
+ (defun toggle-picture-mode ()
+ "Toggle between picture mode and the current mode."
+ (interactive)
+ (if (derived-mode-p 'picture-mode)
+ (picture-mode-exit)
+ (picture-mode)))
+
+ (defun switch-to-previous-buffer ()
+ "Switch to the previous buffer."
+ (interactive)
+ (switch-to-buffer (other-buffer (current-buffer) 1)))
+
+ (defun switch-to-next-buffer ()
+ "Switch to the next buffer."
+ (interactive)
+ (bury-buffer)
+ (switch-to-buffer (other-buffer (current-buffer) 1)))
+
+ (defun start-scope ()
+ "Move to the start of the current scope or paragraph."
+ (interactive)
+ (if (derived-mode-p 'prog-mode)
+ (progn
+ (condition-case nil
+ (backward-up-list)
+ (error (beginning-of-defun))))
+ (scroll-up-command)))
+
+ (defun end-scope ()
+ "Move to the start of the current scope or paragraph."
+ (interactive)
+ (if (derived-mode-p 'prog-mode)
+ (progn
+ (condition-case nil
+ (backward-down-list)
+ (error (beginning-of-defun))))
+ (scroll-up-command)))
+
+ (defun delete-region-using-navigation (navigation-function)
+ "Set the mark, call the NAVIGATION-FUNCTION, then delete the resulting region."
+ (interactive)
+ (if navigation-function
+ (progn
+ (save-excursion
+ (let ((region (region-active-p)))
+ (unless region
+ (set-mark-command nil))
+ (call-interactively navigation-function)
+ (kill-region (mark) (point))
+ (when region
+ (activate-mark)))))
+ (message "No function defined at the specified coordinates.")))
+)
+
+;;--------------------------------------------------------------------------------
+(when t ; button matrices
+ (defun key-matrix-get-button-matrices-alist ()
+ "Return an associative list of button matrices."
+ (list
+ (cons 'button-matrix-keypad
+ '(
+ ("kp-add" "kp-subtract" "<f13>") ; from numlock: xmodmap -e "keycode 77 = F13"
+ ("kp-home" "kp-up" "kp-prior")
+ ("kp-left" "kp-begin" "kp-right")
+ ("kp-end" "kp-down" "kp-next")
+ ("kp-insert" "kp-delete" "kp-enter")
+ ))
+ (cons 'button-matrix-qwerty-right
+ '(
+ ("7" "8" "9" "0")
+ ("u" "i" "o" "p")
+ ("j" "k" "l" ";")
+ ("m" "," "." "/")
+ ))
+ (cons 'button-matrix-workman-right
+ '(
+ ("7" "8" "9" "0")
+ ("y" "u" "o" "i")
+ ("n" "e" "a" ";")
+ ("k" "," "." "/")
+ ))))
+
+ (when nil
+ (let ((button-matrices (key-matrix-get-button-matrices-alist)))
+ (dolist (matrix button-matrices)
+ (set (car matrix) (cdr matrix))))
+
+ (message "Keypad Button Matrix: %S" button-matrix-keypad)
+ (message "QWERTY Right Button Matrix: %S" button-matrix-qwerty-right)
+ (message "Workman Right Button Matrix: %S" button-matrix-workman-right)
+ )
+)
+
+;;--------------------------------------------------------------------------------
+(when t ; function matrices
+
+ (defun key-matrix-get-function-matrices-alist ()
+ "Return an associative list of function matrices."
+ (let* ((categories (key-matrix-get-function-categories-alist))
+ (navigation-function (cdr (assoc 'navigation-function categories)))
+ (function-matrix-navigation
+ '(
+ (keyboard-quit set-mark-command exchange-point-and-mark nil)
+ (backward-word forward-word start-scope end-scope)
+ (backward-char forward-char previous-line next-line)
+ (beginning-of-line end-of-line beginning-of-buffer end-of-buffer)
+ )))
+ (list
+ (cons 'function-matrix-keypad-default
+ '(
+ ('+ '- num-lock)
+ (beginning-of-buffer previous-line scroll-down)
+ (backward-char recenter forward-char)
+ (end-of-buffer next-line scroll-up)
+ (nil delete-char newline)
+ ))
+ (cons 'function-matrix-navigation function-matrix-navigation)
+ (cons 'function-matrix-navigation-deletion
+ (key-matrix-make-wrapper-matrix 'delete-region-using-navigation function-matrix-navigation navigation-function))
+ (cons 'function-matrix-edit
+ '(
+ (comment-region uncomment-region upcase-region downcase-region)
+ (indent-region fill-paragraph nil nil)
+ (copy-region cut-region paste-region delete-region)
+ (undo redo nil nil)
+ ))
+ (cons 'function-matrix-search
+ '(
+ (nil nil nil nil)
+ (query-replace replace-string replace-regexp nil)
+ (isearch-forward isearch-forward-regexp search-forward re-search-forward)
+ (isearch-backward isearch-backward-regexp search-backward re-search-backward)
+ ))
+ (cons 'function-matrix-buffer-file
+ '(
+ (nil nil nil nil)
+ (save-buffer rename-buffer kill-buffer revert-buffer)
+ (next-buffer previous-buffer switch-to-buffer list-buffers)
+ (find-file write-file nil nil)
+ ))
+ (cons 'function-matrix-window
+ '(
+ (toggle-frame-fullscreen other-frame make-frame-command delete-frame)
+ (nil nil nil nil)
+ (ace-window aw-delete-window delete-other-windows balance-windows)
+ (split-window-right split-window-below nil nil)
+ )))))
+
+ (when nil
+ (let (
+ (function-matrices (key-matrix-get-function-matrices-alist))
+ )
+ (dolist (matrix function-matrices)
+ (set (car matrix) (cdr matrix))))
+
+ (message "Keypad Default Function Matrix: %S" function-matrix-keypad-default)
+ (message "Navigation Function Matrix: %S" function-matrix-navigation)
+ (message "Navigation Deletion Function Matrix: %S" function-matrix-navigation-deletion)
+ (message "Edit Function Matrix: %S" function-matrix-edit)
+ (message "Search Function Matrix: %S" function-matrix-search)
+ (message "Buffer File Function Matrix: %S" function-matrix-buffer-file)
+ (message "Window Function Matrix: %S" function-matrix-window)
+ )
+)
+
+;;--------------------------------------------------------------------------------
+(when t ; does the key binding
+
+ (defun key-matrix-main (mode-name)
+ "Bind keys based on matrices and ensure they are set in a custom minor mode."
+
+ ;; Translate C-m to F13 using key codes
+ (define-key input-decode-map (kbd "C-m") (kbd "<f13>"))
+
+ (let (
+ (button-matrices (key-matrix-get-button-matrices-alist))
+ (function-matrices (key-matrix-get-function-matrices-alist))
+ (mode-symbol (key-matrix-make-minor-mode mode-name))
+ )
+ (let (
+ (keymap (key-matrix-get-minor-mode-keymap mode-symbol))
+ (button-matrix-qwerty-right (cdr (assoc 'button-matrix-qwerty-right button-matrices)))
+ (navigation (cdr (assoc 'function-matrix-navigation function-matrices)))
+ (deletion (cdr (assoc 'function-matrix-deletion function-matrices)))
+ (edit (cdr (assoc 'function-matrix-edit function-matrices)))
+ (search (cdr (assoc 'function-matrix-search function-matrices)))
+ (file (cdr (assoc 'function-matrix-file function-matrices)))
+ (window (cdr (assoc 'function-matrix-window function-matrices)))
+ )
+ ;;(message "QWERTY Right Button Matrix: %S" button-matrix-qwerty-right)
+ ;;(message "Keymap for %s: %s" mode-name keymap)
+ ;; Bind keys from the matrix
+ (key-matrix-bind keymap button-matrix-qwerty-right navigation "C-")
+ (key-matrix-bind keymap button-matrix-qwerty-right deletion "S-A-")
+ (key-matrix-bind keymap button-matrix-qwerty-right edit "A-")
+ (key-matrix-bind keymap button-matrix-qwerty-right search "S-C-")
+ (key-matrix-bind keymap button-matrix-qwerty-right file "S-C-A-")
+ (key-matrix-bind keymap button-matrix-qwerty-right window "C-A-")
+ )))
+
+ (defun key-matrix-disable-mode (mode-name)
+ "Disable the specified custom minor mode."
+ (let ((mode-symbol (intern (concat mode-name "-mode"))))
+ ;; Deactivate the minor mode
+ (when (boundp mode-symbol) (funcall mode-symbol 0))
+ ;; Reset keyboard translation
+ (define-key input-decode-map (kbd "C-m") (kbd "RET"))
+ (message "Matrix key mode %s disabled." mode-name)))
+
+ )
+
+ ;; Call key-matrix-main
+ ;; (key-matrix-main "RT-keys")
+
+ ;; Example call to disable the custom key mode
+ ; (key-matrix-disable-mode "RT-keys")
+
+;; 1. navigation
+;; 2. deletion
+;; 3. edit
+;; 4. search
+;; 5. file
+;; 6. window
+
+
+;; Shift Control Alt Window (super)
+;; supper is currently the compose key, so avoiding it.
+;; SCAW
+;; 0000 x
+;; 1000 x
+;; 0100 navigation
+;; 1100 search
+;; 0010 edit
+;; 1010 deletion
+;; 0110 window
+;; 1110 file
+;; 0001
+;; 1001
+;; 0101
+;; 1101
+;; 0011
+;; 1011
+;; 0111
+;; 1111
--- /dev/null
+;; the sake of sanity...
+;;
+(global-set-key (kbd "C-z") nil) ;; turn off the poison C-z key. Use C-x C-z or the command suspend-emacs
+(global-set-key (kbd "C-v") nil) ;; tempting to put paste (yank) for a common typo, but at least lets not jump down the page
+;; would be nice to clear C-c but minor modes redefine it
+
+
+;;--------------------------------------------------------------------------------
+;; extended character set for programming examples in the TTCA book
+;;
+;; preferable to use an Xcompose file definition when available
+;;
+(when t
+
+ (global-set-key [f1] 'help-command)
+ (global-set-key "\C-h" 'nil)
+ (define-key key-translation-map (kbd "M-S") (kbd "ยง"))
+
+ (global-set-key (kbd "C-x g copyright SPC") [?ยฉ])
+
+ (global-set-key (kbd "C-x g phi SPC") [?ฯ]) ; phi for phase
+ (global-set-key (kbd "C-x g Phi SPC") [?ฮฆ])
+
+ (global-set-key (kbd "C-x g d SPC") [?ฮด])
+ (global-set-key (kbd "C-x g D SPC") [?ฮ]) ; this is 'delta' is not 'increment'!
+ (global-set-key (kbd "C-x g delta SPC") [?ฮด])
+ (global-set-key (kbd "C-x g Delta SPC") [?ฮ]) ; this is 'delta' is not 'increment'!
+
+ (global-set-key (kbd "C-x g g SPC") [?ฮณ])
+ (global-set-key (kbd "C-x g G SPC") [?ฮ])
+ (global-set-key (kbd "C-x g gamma SPC") [?ฮณ])
+ (global-set-key (kbd "C-x g Gamma SPC") [?ฮ])
+
+ (global-set-key (kbd "C-x g l SPC") [?ฮป])
+ (global-set-key (kbd "C-x g L SPC") [?ฮ])
+ (global-set-key (kbd "C-x g lambda SPC") [?ฮป])
+ (global-set-key (kbd "C-x g Lambda SPC") [?ฮ])
+
+ (global-set-key (kbd "C-x g m SPC") [?ฮผ])
+ (global-set-key (kbd "C-x g M SPC") [?ฮ])
+ (global-set-key (kbd "C-x g mu SPC") [?ฮผ])
+ (global-set-key (kbd "C-x g Mu SPC") [?ฮ])
+
+ (global-set-key (kbd "C-x g p SPC") [?ฯ])
+ (global-set-key (kbd "C-x g P SPC") [?ฮ ])
+ (global-set-key (kbd "C-x g pi SPC") [?ฯ])
+ (global-set-key (kbd "C-x g Pi SPC") [?ฮ ])
+
+ (global-set-key (kbd "C-x g x SPC") [?ฮพ])
+ (global-set-key (kbd "C-x g X SPC") [?ฮ])
+ (global-set-key (kbd "C-x g xi SPC") [?ฮพ])
+ (global-set-key (kbd "C-x g Xi SPC") [?ฮ])
+
+ (global-set-key (kbd "C-x g > = SPC") [?โฅ])
+ (global-set-key (kbd "C-x g < = SPC") [?โค])
+ (global-set-key (kbd "C-x g ! = SPC") [?โ ])
+ (global-set-key (kbd "C-x g neq SPC") [?โ ])
+
+ (global-set-key (kbd "C-x g nil SPC") [?โ
])
+
+ (global-set-key (kbd "C-x g not SPC") [?ยฌ])
+
+ (global-set-key (kbd "C-x g and SPC") [?โง])
+ (global-set-key (kbd "C-x g or SPC") [?โจ])
+
+ (global-set-key (kbd "C-x g exists SPC") [?โ])
+ (global-set-key (kbd "C-x g all SPC") [?โ])
+
+ (global-set-key (kbd "C-x g do SPC") [?โณ]) ; do
+
+ ;; instead of using these for leftmost, rightmost instead using C, and ฦ.
+ (global-set-key (kbd "C-x g rb SPC") [?โจ])
+ (global-set-key (kbd "C-x g lb SPC") [?โง])
+
+ (global-set-key (kbd "C-x g cont SPC") [?โ]) ; continue
+ (global-set-key (kbd "C-x g thread SPC") [?โฅ]) ; thread
+
+ (global-set-key (kbd "C-x g in SPC") [?โ]) ; set membership
+
+ (global-set-key (kbd "C-x g times SPC") [?ร]) ; set membership
+
+ (global-set-key (kbd "C-x g cdot SPC") [?ยท]) ; scoping sepearator for gcc C
+ (global-set-key (kbd "C-x g pencil SPC") [?๐]) ; scoping sepearator for gcc C
+ (global-set-key (kbd "C-x g CO SPC") [?ฦ]) ; scoping sepearator for gcc C
+
+
+)
--- /dev/null
+;;================================================================================
+;; ;;----------------------------------------
+;; ;; key-chord
+;; ;; Example of defining key chords
+;; ;; Install and configure Key Chord Mode
+;; (use-package key-chord
+;; :ensure t
+;; :config
+;; (key-chord-mode 1)
+;; (setq key-chord-two-keys-delay 0.1)
+
+;; (defun chord-from-bin (str bin)
+;; "Return characters in STR that correspond to ones in BIN."
+;; ;;ex: (chord-from-bin "abcdef" "101001") -> "acf"
+;; (let ((result ""))
+;; (dotimes (i (min (length str) (length bin)))
+;; (when (= (aref bin i) ?1)
+;; (setq result (concat result (string (aref str i))))))
+;; result))
+
+;; (defun make-chord-define (str)
+;; (lambda (bin f)
+;; (let (
+;; (chord (filter-by-binary str bin))
+;; )
+;; (key-chord-define-global chord f)
+;; )))
+
+;; ;; str must be 4 chars
+;; (defun chord-buffer (str)
+;; (setq define-chord (make-chord-define str))
+;; ;; 0000 -
+;; ;; 1000 -
+;; ;; 0100 -
+;; ;; 1100 2
+;; (funcall define-chord "1100" 'save-buffer)
+;; ;; 0010 -
+;; ;; 1010 2
+;; (funcall define-chord "1010" 'kill-buffer)
+;; ;; 0110 2
+;; (funcall define-chord "0110" 'rename-buffer)
+;; ;; 1110 3
+;; (funcall define-chord "1110" 'buffer-menu)
+;; ;; 0001 -
+;; ;; 1001 2
+;; (funcall define-chord "1001" 'ace-window)
+;; ;; 0101 2
+;; (funcall define-chord "0101" 'list-buffers)
+;; ;; 1101 3
+;; (funcall define-chord "1101" 'diff-buffer-with-file)
+;; ;; 0011 2
+;; ;; 1011 3
+;; (funcall define-chord "1011" 'revert-buffer)
+;; ;; 0111 3
+;; ;; 1111 3
+;; (funcall define-chord "1111" 'keyboard-quit)
+;; )
+
+;; (chord-buffer "qwer")
+
+;; )
+
+
--- /dev/null
+;;--------------------------------------------------------------------------------
+;; get the name of the file being 'visited' by the buffer
+;;
+(when t
+ (setq lisp-indent-offset 2)
+ (setq inferior-lisp-program "sbcl")
+
+ (modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
+ (modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
+ (modify-syntax-entry ?{ "(}" lisp-mode-syntax-table)
+ (modify-syntax-entry ?} "){" lisp-mode-syntax-table)
+
+ ;; get buffer filename -- emacs does not have a builtin function for this.
+ (when t
+ (defun filename-get ()
+ "Gets the name of the file the current buffer is based on."
+ (buffer-file-name (window-buffer (minibuffer-selected-window)))
+ )
+
+ (defun filename-insert ()
+ "Inserts the name of the file the current buffer is based on."
+ (interactive)
+ (insert (filename-get))
+ )
+
+ (global-set-key (kbd "C-c f") 'filename-insert)
+
+ (defun filename ()
+ "Gets the name of the file the current buffer is based on."
+ (interactive)
+ (message (filename-get))
+ )
+
+ )
+ )
+
+;;--------------------------------------------------------------------------------
+;; unfill a paragraph
+;;
+
+(defun unfill-paragraph ()
+ "Transform a filled paragraph into a single line of text."
+ (interactive)
+ (let ((fill-column (point-max)))
+ (fill-paragraph nil)))
+
+
+;;--------------------------------------------------------------------------------
+;; misc
+;;
+
+ (defun mode-line () "toggles the modeline on and off"
+ (interactive)
+ (setq mode-line-format
+ (if (equal mode-line-format nil)
+ (default-value 'mode-line-format)) )
+ (redraw-display))
+
+ ;; use set set-frame-name
+ ;;
+ ;; (defun frame-title (s)
+ ;; "sets the frame title"
+ ;; (interactive "stitle: ")
+ ;; (setq frame-title-format s)
+ ;; )
+
--- /dev/null
+;; ;; The rest of your appearance settings...
+;; )
+
+;; (when t
+;; (setq ansi-color-names-vector
+;; ["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"])
+;; (setq custom-enabled-themes '(wheatgrass deeper-blue))
+
+;; (custom-set-faces
+;; '(default ((t (:family "Noto Sans Mono" :foundry "GOOG" :slant normal :weight normal :height 98 :width normal))))
+;; '(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0)))))
+
+
+;;--------------------------------------------------------------------------------
+;; appearance
+(when t
+ (setq ansi-color-names-vector
+ ["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"])
+
+ (custom-set-faces
+ '(default ((t (:family "Noto Sans Mono" :foundry "GOOG" :slant normal :weight normal :height 98 :width normal))))
+ '(aw-leading-char-face ((t (:inherit ace-jump-face-foreground :height 2.0)))))
+
+ (load-theme 'wheatgrass t)
+
+ (setq inhibit-startup-screen t)
+
+ (setq ring-bell-function 'ignore)
+ (setq visible-bell nil)
+
+ (setq column-number-mode t)
+ (tool-bar-mode -1)
+ (menu-bar-mode -1)
+ (scroll-bar-mode -1)
+
+ )
+
+;;--------------------------------------------------------------------------------
+;; basic settings
+(when t
+ (setq-default indent-tabs-mode nil) ;; stop the 'tab' character pollution
+ (put 'narrow-to-region 'disabled nil)
+ (put 'downcase-region 'disabled nil)
+ (put 'set-goal-column 'disabled nil)
+ (put 'erase-buffer 'disabled nil)
+ (put 'upcase-region 'disabled nil)
+ (set-language-environment "UTF-8")
+ (add-hook 'text-mode-hook 'flyspell-mode)
+ (add-hook 'prog-mode-hook 'flyspell-prog-mode)
+ (setq ispell-dictionary "en_US")
+ (setq fill-column 80)
+ )
+
+;;--------------------------------------------------------------------------------
+;; prevent repo pollution
+;; (when t
+;; ;; so that lock files do not end up in the repo
+;; (setq create-lockfiles nil)
+
+;; ;; use a backrevs dir rather than leaving ~file droppings everywhere
+;; (setq backup-directory-alist `(("." . "~/emacs_backrevs")))
+;; (setq backup-by-copying t)
+;; )
+
+;;--------------------------------------------------------------------------------
+;; prevent repo pollution (localize all backups/autosaves, incl. TRAMP)
+(when t
+ (setq create-lockfiles nil) ;; avoid .# lock files anywhere (esp. remote)
+
+ (let* ((backrevs (expand-file-name "~/emacs_backrevs/"))
+ (autosave (expand-file-name "~/emacs_backrevs/auto-save/"))
+ (tramp-as (expand-file-name "~/emacs_backrevs/tramp-auto-save/")))
+ (dolist (d (list backrevs autosave tramp-as))
+ (unless (file-directory-p d) (make-directory d t)))
+
+ ;; Backups (~ files) go to backrevs, for both local and TRAMP
+ (setq backup-by-copying t
+ version-control t
+ delete-old-versions t
+ kept-new-versions 10
+ kept-old-versions 2
+ backup-directory-alist `(("." . ,backrevs))
+ tramp-backup-directory-alist `(("." . ,backrevs)))
+
+ ;; Autosaves (#โฆ#) go to autosave dirs (TRAMP separate)
+ (setq auto-save-default t
+ auto-save-include-big-deletions t
+ auto-save-file-name-transforms `((".*" ,autosave t))
+ tramp-auto-save-directory tramp-as)))
+
+ (setq backup-by-copying-when-linked t)
+
+
+;;--------------------------------------------------------------------------------
+;; tell emacs to write customizations stuff back into the users .emacs file
+;; without this it will try to write them here, and fail
+(when t
+ (setq custom-file nil) ; using '.emacs' causes a 'ciruclar reference error' .. why? dunno.
+ )
+
+;;--------------------------------------------------------------------------------
+;; dired
+(when t
+ (defun dired-open-shell ()
+ "Open a shell in the directory associated with the current buffer."
+ (interactive)
+ (let* (
+ (dir-dired (dired-current-directory))
+ (buffer-shell-name (concat "shell-" (replace-regexp-in-string "/" "-" dir-dired) "*"))
+ )
+ (if dir-dired
+ (progn
+ (kill-buffer (current-buffer))
+ (switch-to-buffer buffer-shell-name)
+ (shell (current-buffer))
+ (cd dir-dired)
+ ))))
+
+ (eval-after-load "dired"
+ '(define-key dired-mode-map "1" 'dired-open-shell)
+ )
+ )
+
+;;--------------------------------------------------------------------------------
+;; emacs shell
+(when t
+ ;; get the pwd in shell mode from the prompt rather than guessing by
+ ;; watching the commands typed .. yes! now shell variables and source
+ ;; scripts will work
+ ;; in bashrc: export PS1='\n$(/usr/local/bin/Z)\u@\hยง\wยง\n> '
+ ;;
+
+ ;; (setq dirtrack-list '("ยง\\(.*\\)ยง\n[>#] " 1))
+ (setq dirtrack-list '("ยง\\([^ยง]*\\)ยง" 1))
+
+ (add-hook 'shell-mode-hook
+ (lambda ()
+ (shell-dirtrack-mode -1)
+ (dirtrack-mode 1)
+ (comint-send-input) ;; send an input at the shell start so it will boot the dir track
+ ))
+
+ (add-hook 'dirtrack-directory-change-hook
+ (lambda ()
+ (message default-directory)))
+
+ )
+
--- /dev/null
+;; Package setup
+(when t
+ (setq byte-compile-warnings '(cl-functions))
+
+ ;; Ensure package archives are set up
+ (require 'package)
+ (setq package-archives '(("melpa" . "https://melpa.org/packages/")
+ ("gnu" . "https://elpa.gnu.org/packages/")))
+ (package-initialize)
+
+ (defun update-packages ()
+ "Interactively update all packages from package-archives."
+ (interactive)
+ (when (y-or-n-p "Do you want to refresh package contents and update missing packages?")
+ (message "Refreshing package contents...")
+ (package-refresh-contents)
+; (ensure-package-installed '(neotree groovy-mode ace-window adaptive-wrap))
+ (ensure-package-installed 'neotree)
+ (ensure-package-installed 'groovy-mode)
+ (ensure-package-installed 'ace-window)
+ (ensure-package-installed 'adaptive-wrap)
+ (message "Package updates complete!")))
+
+ ;; Notify on startup
+ (add-hook 'emacs-startup-hook
+ (lambda ()
+ (message "To update packages, run M-x update-packages.")))
+
+ (defun maybe-refresh-packages ()
+ "Prompt user to refresh package contents if desired."
+ (when (y-or-n-p "Refresh package contents? ")
+ (package-refresh-contents)))
+
+ (defun ensure-package-installed (pkg)
+ "Ensure the given PKG is installed. Prompt to refresh packages if necessary."
+ (unless (package-installed-p pkg)
+ (maybe-refresh-packages)
+ (unless (package-installed-p pkg)
+ (package-install pkg))))
+
+
+ ;; Configure NeoTree
+ (with-eval-after-load 'neotree
+ (setq neo-window-fixed-size nil)
+ (setq neo-smart-open t)
+ (setq neo-window-width 45))
+
+ (global-set-key [f8] 'neotree-toggle)
+
+ ;; Custom NeoTree sorting
+ (defadvice neo-buffer--get-nodes
+ (after neo-buffer--get-nodes-new-sorter activate)
+ (setq ad-return-value
+ (let ((nodes ad-return-value)
+ (comparator (lambda (s1 s2) (string< (downcase (reverse-file-extension s1))
+ (downcase (reverse-file-extension s2))))))
+ (apply 'cons (mapcar (lambda (x) (sort (apply x (list nodes))
+ comparator))
+ '(car cdr))))))
+
+ (defun reverse-file-extension (filename) filename)
+ ;; Original categorizes by filename extension
+ ;; (defun reverse-file-extension (filename)
+ ;; (mapconcat 'identity (reverse (split-string filename "\\.")) "."))
+
+ ;; Ace Window Manager configuration
+ (when (package-installed-p 'ace-window)
+ (require 'ace-window)
+ (global-set-key (kbd "C-x o") 'ace-window))
+
+ ;; adaptive-wrap line mode
+ (if
+ (package-installed-p 'adaptive-wrap)
+ (progn
+ (require 'adaptive-wrap)
+ (setq-default visual-line-mode-desired-column 80)
+ (global-visual-line-mode 1)
+ (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode)
+ )
+ (progn
+ (set-default 'truncate-lines t) ;; truncate rather than wrapping lines (use horizontal scroll to see to the right)
+ (setq truncate-partial-width-windows nil)
+ (setq-default fill-column 80)
+ (setq fill-column 80)
+ ))
+)
--- /dev/null
+;;--------------------------------------------------------------------------------
+;; gdb
+;; use gud-gdb instead of gdb and we won't need this.
+;; fix 'feature' of broken gdb where it takes control of an
+;; emacs window, and locks the user out from switching from it
+(when t
+ (defun unlock-window ()
+ "Turns off window dedication."
+ (interactive)
+ (set-window-dedicated-p (get-buffer-window (current-buffer)) nil)
+ )
+ )
+
+;;--------------------------------------------------------------------------------
+;; shell
+;;
+(when t
+ (setq sh-basic-offset 2)
+ )
+
+;;--------------------------------------------------------------------------------
+;; json
+(when t
+ (setq json-encoding-pretty-print t)
+ (setq json-encoding-lisp-style-closings t)
+ ;(setq json-encoding-lisp-style-closings nil)
+ (defun wrap-comma ()
+ "wrap end of line comma to first of next line"
+ (interactive)
+ (while (re-search-forward "\\(.*\\), *\n\\( *\\)" nil t) (replace-match "\\1\n\\2,"))
+ )
+ )
+
+;;--------------------------------------------------------------------------------
+;; rust
+;;
+;; (require 'package)
+;; (add-to-list 'package-archives
+;; '("melpa-stable" . "https://stable.melpa.org/packages/"))
+;; (package-initialize)
+;; (package-refresh-contents)
+;;
+;;; (setq rust-indent-offset 2)
+;;; (require 'rust-mode)
+
+;;--------------------------------------------------------------------------------
+;; python
+(when t
+ (add-hook 'python-mode-hook '(lambda () (setq python-indent 2)))
+ )
+
+;;--------------------------------------------------------------------------------
+;; Web page development
+(when t
+ ;(setq browse-url-browser-function 'browse-url-firefox)
+ ;(setq browse-url-browser-function 'browse-url-chrome)
+ ;(setq browse-url-browser-function 'browse-url-chromium)
+
+(setq browse-url-browser-function 'browse-url-generic
+ browse-url-generic-program "firefox")
+
+ (setq js-indent-level 2)
+ (setq css-indent-offset 2)
+ (add-to-list 'auto-mode-alist '("\\.php\\'" . html-mode))
+ )
+
+;;--------------------------------------------------------------------------------
+;; C
+;;
+(when t
+ (setq c-basic-offset 2)
+ (setq c-offsets-alist '((label . 2)))
+ (add-hook 'c-mode-hook (lambda () (modify-syntax-entry ?ยท "_")))
+ ; in customer variables '(c-offsets-alist (quote ((label . 2))))
+ (add-to-list 'auto-mode-alist '("\\.isq\\'" . c-mode))
+ )
+
+
+;;--------------------------------------------------------------------------------
+;; lisp
+;;
+ (setq-default lisp-indent-offset 2) ; Set indentation for Lisp modes
+
+;;--------------------------------------------------------------------------------
+;; groovy
+;;
+
+ ;; Configure NeoTree
+ (with-eval-after-load 'groovy-mode
+ (setq groovy-indent-offset 2)
+ )
+
+ ;; Enable Groovy mode for files with `#!/usr/bin/env groovy` shebang
+ (add-to-list 'interpreter-mode-alist '("groovy" . groovy-mode))
--- /dev/null
+;;--------------------------------------------------------------------------------
+;; Tramp
+;;
+;;;https://www.gnu.org/software/emacs/manual/html_node/tramp/Frequently-Asked-Questions.html
+;;
+
+
+;; remote shells with Tramp always come up in sh, not bash.
+;; This tries to convince tramp to use bash.
+(when t
+
+ ;; this does nothing in fact
+ (with-eval-after-load 'tramp
+ ;; Use bash for remote commands, and treat them as login (-l) so profile/rc files run.
+ (setq tramp-remote-shell "/bin/bash")
+ (setq tramp-remote-shell-args '("-lc"))) ;; login + run command
+
+ ;; this should force all shells to be bash
+ (defun shell-make (dir buffer-name)
+ (let* ((default-directory dir)
+ (buffer (get-buffer-create buffer-name)))
+ (with-current-buffer buffer
+ ;; Force bash for this shell buffer (remote or local)
+ (setq-local explicit-shell-file-name "/bin/bash")
+ (setq-local shell-file-name "/bin/bash")
+ ;; Login shell; interactive because comint allocates a pty
+ (setq-local explicit-bash-args '("-l"))
+ ;; Avoid echoed input in TRAMP shells
+ (setq-local comint-process-echoes t))
+ (shell buffer)))
+
+ ;; maybe this would do it
+ (with-eval-after-load 'tramp
+ (connection-local-set-profile-variables
+ 'rt/remote-bash
+ '((explicit-shell-file-name . "/bin/bash")
+ (shell-file-name . "/bin/bash")
+ (explicit-bash-args . ("-l"))
+ (comint-process-echoes . t)))
+
+ ;; Apply to all SSH TRAMP connections
+ (connection-local-set-profiles '(:application tramp :protocol "ssh") 'rt/remote-bash))
+
+)
+
+(when t
+
+ ;; trap wants to write to /tmp, but when logged in as root it causes failures and pop up new frames with warnings
+ ;;
+ ;; --> this is causing it to leave emacs droppings all over:
+ ;; (add-to-list 'backup-directory-alist (cons tramp-file-name-regexp nil))
+
+ (setq tramp-completion-reread-directory-timeout nil)
+
+ (defun shell-make (dir buffer-name)
+ (let* (
+ (default-directory dir)
+ (buffer (get-buffer-create buffer-name))
+ )
+ (set-buffer buffer)
+ (shell buffer)
+ ))
+
+ (defun shell~ () (interactive) (shell-make "~" "shell~"))
+ (defun shell-root () (interactive) (shell-make "/sudo::/root" "shell-root"))
+
+ (defun shell-rt-Thomas () (interactive) (shell-make "/ssh:rt-Thomas:~" "shell-rt"))
+ (defun shell-rt-root () (interactive) (shell-make "/ssh:rt-root:~" "shell-rt-root"))
+
+ (defun shell-x6-Thomas () (interactive) (shell-make "/ssh:x6-Thomas:~" "shell-x6-Thomas"))
+ (defun shell-x6-root () (interactive) (shell-make "/ssh:x6-root:~" "shell-x6-root"))
+
+
+;; (defun shell-rt () (interactive) (shell-make "/ssh:thomas_lynch@reasoningtechnology.com:~" "shell-rt"))
+;; (defun shell-rt-root() (interactive) (shell-make "/ssh:root@reasoningtechnology.com:~" "shell-rt-root"))
+
+ ;;(defun shell-rt-root() (interactive) (shell-make "/ssh:thomas_lynch@reasoningtechnology.com|sudo:reasoningtechnology.com:" "shell-rt-root"))
+ ;;(defun shell-rt-root() (interactive) (shell-make "/ssh:reasoningtechnology-root:~" "shell-rt-root"))
+ ;;(defun shell-rt-root() (interactive) (shell-make "/ssh:root@35.194.71.194:~" "shell-rt-root"))
+
+
+ (defun shell-LFS () (interactive) (shell-make "/ssh:lfs@192.168.122.115:~" "shell-LFS"))
+ (defun shell-LFS-root () (interactive) (shell-make "/ssh:root@192.168.122.115:~" "shell-LFS-root"))
+
+ (defun shell-Shihju () (interactive) (shell-make "/sudo:Shihju@localhost:/home/Shihju" "shell-Shihju"))
+ (defun shell-Wendell () (interactive) (shell-make "/ssh:Morpheus@Wendell:~" "shell-Wendell"))
+ (defun shell-Wendell-root () (interactive) (shell-make "/ssh:Morpheus@Wendell|sudo:Wendell:" "shell-Wendell-root"))
+ (defun shell-Wendell-Shihju () (interactive) (shell-make "/ssh:Morpheus@Wendell|sudo:Shihju@Wendell:" "shell-Wendell-Shihju"))
+
+ (defun shell-Pi
+ ()
+ (interactive)
+ (shell-make "/ssh:piuser@Pi:~" "shell-Pi")
+ )
+
+ (defun shell-Pi-root
+ ()
+ (interactive)
+ (shell-make
+ "/ssh:piuser@Pi|sudo:root@Pi:"
+ "shell-Pi-root"
+ ))
+
+
+
+ (defun dired-rt ()
+ (interactive)
+ (dired "/ssh:thomas_lynch@reasoningtechnology.com:")
+ )
+
+ (defun dired-rt-root ()
+ (interactive)
+ (dired "/ssh:thomas_lynch@reasoningtechnology.com|sudo:reasoningtechnology.com:")
+ )
+
+)
--- /dev/null
+
+(when t
+ (message ".emacs/emacs")
+ (let (
+ (el-dir (concat "el/" (file-name-directory load-file-name)))
+ )
+ (load (concat el-dir "el/lisp.el"))
+ (load (concat el-dir "el/main.el"))
+ (load (concat el-dir "el/key.el"))
+ (load (concat el-dir "el/package.el"))
+ (load (concat el-dir "el/tramp.el"))
+ (load (concat el-dir "el/programming.el"))
+ )
+)
--- /dev/null
+
+;; Load the common configuration file
+(load "/home/Thomas-mastu/incommon/library/emacs")
+
+;; User-specific configurations go below this line
+
--- /dev/null
+
+If we use the terminology state and nation
+
+both ...
+
+taiwan contested
+
+the chinese have referred to officially as ancient sacred territory
+the taiwanse
+
+one government two system .. so in an uncontested manner we can refer
+to Taiwan as that second system.
+
+due to this desparaty any community wiki article on Taiwan will of course present unique challenges..
+
+today's political situation is not unique, similar situation in Qing era
+
+
+systemctl --user restart pipewire pipewire-pulse wireplumber
+
+pactl set-default-source alsa_input.usb-Logi_USB_Headset_Logi_USB_Headset-00.mono-fallback
+
+
+
+
+pactl list sinks short
+pactl list sources short
+
+pactl set-default-sink <sink_name_or_index>
+pactl set-default-source <source_name_or_index>
+
+----
+for aldervine or whatever it is called, to work (these will already be installed)
+dnf install xdg-desktop-portal xdg-desktop-portal-gtk
+
+as user:
+systemctl --user restart xdg-desktop-portal
+
+
+
+
+# set defaults to the current device
+# pactl move-sink-input <input_index> <sink_name_or_index>
+# pactl move-source-output <output_index> <source_name_or_index>
+
+
+Yes, you can use pactl or alsamixer to set the microphone and speaker devices on Fedora. Here's how:
+
+Using pactl (PulseAudio):
+List available sinks (speakers):
+
+bash
+Copy code
+pactl list sinks short
+Identify the sink (speaker) you'd like to use. Note its name or index.
+
+Set the default sink (speaker):
+
+bash
+Copy code
+pactl set-default-sink <sink_name_or_index>
+List available sources (microphones):
+
+bash
+Copy code
+pactl list sources short
+Identify the source (microphone) you'd like to use. Note its name or index.
+
+Set the default source (microphone):
+
+bash
+Copy code
+pactl set-default-source <source_name_or_index>
+Move currently active streams to the new default sink/source: For sink:
+
+bash
+Copy code
+pactl move-sink-input <input_index> <sink_name_or_index>
+For source:
+
+bash
+Copy code
+pactl move-source-output <output_index> <source_name_or_index>
+You can find input/output indices using:
+
+bash
+Copy code
+pactl list sink-inputs
+pactl list source-outputs
+Using alsamixer (for ALSA directly):
+Open alsamixer:
+bash
+Copy code
+alsamixer
+Press F6 to select the sound card.
+Use arrow keys to navigate and adjust volumes or toggle input/output devices.
+Automating Device Selection:
+To make this persistent across reboots:
+
+Create or edit a PulseAudio configuration file:
+bash
+Copy code
+nano ~/.config/pulse/default.pa
+Add lines to set your preferred devices:
+text
+Copy code
+set-default-sink <sink_name>
+set-default-source <source_name>
+Restart PulseAudio:
+bash
+Copy code
+systemctl --user restart pulseaudio
+