From 6b4d12ca58f54d6bea69c67c80e421b3db7181a9 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Fri, 7 Nov 2025 10:21:40 +0000 Subject: [PATCH 1/1] initial commit --- .gitignore | 33 ++ Authorization | 0 XCompose | 243 +++++++++++++ executable/2025-06-13_subu.sh | 43 +++ executable/Z | 3 + executable/cat_named | 23 ++ executable/echo | 163 +++++++++ executable/gen_email | 99 ++++++ executable/gen_passwd | 96 ++++++ executable/gen_sig | 96 ++++++ executable/home | Bin 0 -> 20280 bytes executable/printenv | 121 +++++++ executable/share_directory | 29 ++ executable/subu_login | 135 ++++++++ executable/subu_orig | 47 +++ executable/subu_setup | 72 ++++ executable/user | Bin 0 -> 20184 bytes executable/user-stem | Bin 0 -> 20240 bytes executable/user-subu | Bin 0 -> 20240 bytes library/TTCA.elisp | 70 ++++ library/XCompose | 243 +++++++++++++ library/archive/emacs_2024-04-11 | 321 ++++++++++++++++++ library/archive/emacs_cp | 186 ++++++++++ library/archive/emacs_orig | 322 ++++++++++++++++++ library/archive/emacs_with_indent_stuff | 421 +++++++++++++++++++++++ library/bash_profile | 7 + library/bashrc | 51 +++ library/bashrc_root | 27 ++ library/el/key-matrix.el | 434 ++++++++++++++++++++++++ library/el/key.el | 87 +++++ library/el/key_key-chord.el | 63 ++++ library/el/lisp.el | 66 ++++ library/el/main.el | 148 ++++++++ library/el/package.el | 86 +++++ library/el/programming.el | 94 +++++ library/el/tramp.el | 116 +++++++ library/emacs | 14 + library/emacs_local | 6 + library/sound_headphone | 113 ++++++ 39 files changed, 4078 insertions(+) create mode 100644 .gitignore create mode 100644 Authorization create mode 100644 XCompose create mode 100644 executable/2025-06-13_subu.sh create mode 100755 executable/Z create mode 100755 executable/cat_named create mode 100755 executable/echo create mode 100755 executable/gen_email create mode 100755 executable/gen_passwd create mode 100755 executable/gen_sig create mode 100755 executable/home create mode 100755 executable/printenv create mode 100755 executable/share_directory create mode 100755 executable/subu_login create mode 100644 executable/subu_orig create mode 100644 executable/subu_setup create mode 100755 executable/user create mode 100755 executable/user-stem create mode 100755 executable/user-subu create mode 100644 library/TTCA.elisp create mode 100644 library/XCompose create mode 100644 library/archive/emacs_2024-04-11 create mode 100644 library/archive/emacs_cp create mode 100644 library/archive/emacs_orig create mode 100644 library/archive/emacs_with_indent_stuff create mode 100644 library/bash_profile create mode 100644 library/bashrc create mode 100644 library/bashrc_root create mode 100644 library/el/key-matrix.el create mode 100644 library/el/key.el create mode 100644 library/el/key_key-chord.el create mode 100644 library/el/lisp.el create mode 100644 library/el/main.el create mode 100644 library/el/package.el create mode 100644 library/el/programming.el create mode 100644 library/el/tramp.el create mode 100644 library/emacs create mode 100644 library/emacs_local create mode 100644 library/sound_headphone diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..937dfaa --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ + +# 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/ + diff --git a/Authorization b/Authorization new file mode 100644 index 0000000..e69de29 diff --git a/XCompose b/XCompose new file mode 100644 index 0000000..0964a42 --- /dev/null +++ b/XCompose @@ -0,0 +1,243 @@ +# 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. +# +# ... : # comment +# +# Be starting with a namespace character we reduce the problem of potential +# aliasing to that namespace. By ending each sequence with a , 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 + : "𝔸" U1D538 # double-struck capital A + : "𝔹" U1D539 # double-struck capital B + : "ℂ" U2102 # double-struck capital C + : "𝔻" U1D53B # double-struck capital D + : "𝔼" U1D53C # double-struck capital E + : "𝔽" U1D53D # double-struck capital F + : "𝔾" U1D53E # double-struck capital G + : "ℍ" U210D # double-struck capital H + : "𝕀" U1D540 # double-struck capital I + : "𝕁" U1D541 # double-struck capital J + : "𝕂" U1D542 # double-struck capital K + : "𝕃" U1D543 # double-struck capital L + : "𝕄" U1D544 # double-struck capital M + : "ℕ" U2115 # double-struck capital N + : "𝕆" U1D546 # double-struck capital O +

: "𝕡" U1D561 # double-struck lowercase p + : "𝕢" U1D562 # double-struck lowercase q + : "𝕣" U1D563 # double-struck lowercase r + : "𝕤" U1D564 # double-struck lowercase s + : "𝕥" U1D565 # double-struck lowercase t + : "𝕦" U1D566 # double-struck lowercase u + : "𝕧" U1D567 # double-struck lowercase v + : "𝕨" U1D568 # double-struck lowercase w + : "𝕩" U1D569 # double-struck lowercase x + : "𝕪" U1D56A # double-struck lowercase y + : "𝕫" U1D56B # double-struck lowercase z + +# accented letters + : "á" U00E1 # lowercase a with acute accent + : "à" U00E0 # lowercase a with grave accent + : "ä" U00E4 # lowercase a with umlaut + : "â" U00E2 # lowercase a with circumflex + : "ã" U00E3 # lowercase a with tilde + : "æ" U00E6 # lowercase ae diphthong + : "ç" U00E7 # lowercase c with cedilla + : "é" U00E9 # lowercase e with acute accent + : "è" U00E8 # lowercase e with grave accent + : "ë" U00EB # lowercase e with umlaut + : "ê" U00EA # lowercase e with circumflex + : "í" U00ED # lowercase i with acute accent + : "ì" U00EC # lowercase i with grave accent + : "ï" U00EF # lowercase i with umlaut + : "î" U00EE # lowercase i with circumflex + : "ñ" U00F1 # lowercase n with tilde + : "ó" U00F3 # lowercase o with acute accent + : "ò" U00F2 # lowercase o with grave accent + : "ö" U00F6 # lowercase o with umlaut + : "ô" U00F4 # lowercase o with circumflex + : "õ" U00F5 # lowercase o with tilde + : "œ" U0153 # lowercase oe diphthong + + +# #-------------------------------------------------------------------------------- +# Greek + + : "Α" U0391 # greek capital letter alpha + : "Β" U0392 # greek capital letter beta + : "Γ" U0393 # greek capital letter gamma + : "Δ" U0394 # greek capital letter delta + : "Ε" U0395 # greek capital letter epsilon + : "Ζ" U0396 # greek capital letter zeta + : "Η" U0397 # greek capital letter eta + : "Θ" U0398 # greek capital letter theta + : "Ι" U0399 # greek capital letter iota + : "Κ" U039A # greek capital letter kappa + : "Λ" U039B # greek capital letter lamda + : "Μ" U039C # greek capital letter mu + : "Ν" U039D # greek capital letter nu + : "Ξ" U039E # greek capital letter xi + : "Ο" U039F # greek capital letter omicron +

: "Π" U03A0 # greek capital letter pi + : "Ρ" U03A1 # greek capital letter rho + : "Σ" U03A3 # greek capital letter sigma + : "Τ" U03A4 # greek capital letter tau + : "Υ" U03A5 # greek capital letter upsilon + : "Φ" U03A6 # greek capital letter phi + : "Χ" U03A7 # greek capital letter chi + : "Ψ" U03A8 # greek capital letter psi + : "Ω" U03A9 # greek capital letter omega + + : "α" u03b1 # greek small letter alpha + : "β" u03b2 # greek small letter beta + : "γ" u03b3 # greek small letter gamma + : "δ" u03b4 # greek small letter delta + : "ε" u03b5 # greek small letter epsilon + : "ζ" u03b6 # greek small letter zeta + : "η" u03b7 # greek small letter eta + : "θ" u03b8 # greek small letter theta + : "ι" u03b9 # greek small letter iota + : "κ" u03ba # greek small letter kappa + : "λ" u03bb # greek small letter lamda + : "μ" u03bc # greek small letter mu + : "ν" u03bd # greek small letter nu + : "ξ" u03be # greek small letter xi + : "ο" u03bf # greek small letter omicron +

: "π" u03c0 # greek small letter pi + : "ρ" u03c1 # greek small letter rho + : "σ" u03c3 # greek small letter sigma + : "τ" u03c4 # greek small letter tau + : "υ" u03c5 # greek small letter upsilon + : "φ" u03c6 # greek small letter phi + : "χ" u03c7 # greek small letter chi + : "ψ" u03c8 # greek small letter psi + : "ω" u03c9 # greek small letter omega + +# -------------------------------------------------------------------------------- +# math + + : "×" U00D7 # multiplication sign + : "·" U00B7 # middle dot + : "⊡" U22A1 # squared dot operator + + : "≠" U2260 # not equal to + + : "≤" U2264 # less-than or equal to + : "≥" U2265 # greater-than or equal to + <0> : "∅" U2205 # empty set + + + : "∈" U2208 # element of + : "∉" U2209 # not an element of + + : "∪" U222A # union + : "⋂" U22C2 # n-ary interesection + : "⊂" U2282 # subset of + : "⊆" U2286 # subset of or equal to + : "⊃" U2283 # superset of + : "⊇" U2287 # superset of or equal to + + : "∩" U2229 # intersection + : "∁" U2201 # complement + + : "∃" U2203 # there exists + : "∄" U2204 # there does not exist + : "∀" U2200 # for all + + : "¬" U00AC # not sign + + : "⋁" U2228 # big vee, n-ary logical or + : "⋀" U22C0 # big wedge n-ary LOGICAL AND + + : "∨" U2228 # little vee logical or + : "∧" U2227 # little weddge logical and + : "⊼" U22BC # NAND + : "➜" U27A0 # implies + <=> : "⇒" U21D2 # implies + <=> : "⇔" U21D4 # if and only if + + : "⟳" U27F3 # clockwise gapped circle arrow, 'do' or 'for' operator + : "◨" U25E8 # square with right inked 'rightmost' 'maximum' operator + : "◧" U25E7 # square with left inked 'leftmost' 'minimum' operator + : "☥" U2625 # ankh diff --git a/executable/2025-06-13_subu.sh b/executable/2025-06-13_subu.sh new file mode 100644 index 0000000..f734616 --- /dev/null +++ b/executable/2025-06-13_subu.sh @@ -0,0 +1,43 @@ + +#!/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 +" diff --git a/executable/Z b/executable/Z new file mode 100755 index 0000000..7b77248 --- /dev/null +++ b/executable/Z @@ -0,0 +1,3 @@ +#!/bin/sh + +/usr/bin/date -u +"%Y-%m-%d %H:%M:%SZ" diff --git a/executable/cat_named b/executable/cat_named new file mode 100755 index 0000000..3f208fc --- /dev/null +++ b/executable/cat_named @@ -0,0 +1,23 @@ +#!/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 " >&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 diff --git a/executable/echo b/executable/echo new file mode 100755 index 0000000..48db1eb --- /dev/null +++ b/executable/echo @@ -0,0 +1,163 @@ +#!/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)) diff --git a/executable/gen_email b/executable/gen_email new file mode 100755 index 0000000..a1057d9 --- /dev/null +++ b/executable/gen_email @@ -0,0 +1,99 @@ +#!/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)) + diff --git a/executable/gen_passwd b/executable/gen_passwd new file mode 100755 index 0000000..d7cc5d4 --- /dev/null +++ b/executable/gen_passwd @@ -0,0 +1,96 @@ +#!/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) + + diff --git a/executable/gen_sig b/executable/gen_sig new file mode 100755 index 0000000..c6b254b --- /dev/null +++ b/executable/gen_sig @@ -0,0 +1,96 @@ +#!/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)) + diff --git a/executable/home b/executable/home new file mode 100755 index 0000000000000000000000000000000000000000..569a200467248489ce880d402bca0c083cea8734 GIT binary patch literal 20280 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 literal 0 HcmV?d00001 diff --git a/executable/printenv b/executable/printenv new file mode 100755 index 0000000..c266c97 --- /dev/null +++ b/executable/printenv @@ -0,0 +1,121 @@ +#!/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)) diff --git a/executable/share_directory b/executable/share_directory new file mode 100755 index 0000000..ea80f0c --- /dev/null +++ b/executable/share_directory @@ -0,0 +1,29 @@ +#!/bin/bash + +# Fix permissions script +# Usage: ./fix_permissions.sh +# 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 " + 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'." diff --git a/executable/subu_login b/executable/subu_login new file mode 100755 index 0000000..ca28743 --- /dev/null +++ b/executable/subu_login @@ -0,0 +1,135 @@ +#!/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 + + diff --git a/executable/subu_orig b/executable/subu_orig new file mode 100644 index 0000000..0c8d838 --- /dev/null +++ b/executable/subu_orig @@ -0,0 +1,47 @@ +#!/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 diff --git a/executable/subu_setup b/executable/subu_setup new file mode 100644 index 0000000..42c2343 --- /dev/null +++ b/executable/subu_setup @@ -0,0 +1,72 @@ + +# 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 " + 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!" diff --git a/executable/user b/executable/user new file mode 100755 index 0000000000000000000000000000000000000000..15e1bcbba3ef5764d20685d2608d100287dd1970 GIT binary patch literal 20184 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 Pt@zl0@>uH%aEapI+SVCV literal 0 HcmV?d00001 diff --git a/executable/user-stem b/executable/user-stem new file mode 100755 index 0000000000000000000000000000000000000000..3df796e36dca512b15829bcfd83dd55b90b9e57d GIT binary patch literal 20240 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 I!6l0S0G5$Wj{pDw literal 0 HcmV?d00001 diff --git a/executable/user-subu b/executable/user-subu new file mode 100755 index 0000000000000000000000000000000000000000..2712e78186bf20aba2769657b83b3d5f3a2ea008 GIT binary patch literal 20240 zcmeHPU2Ggz6~4Q+lWmi%H)%|rq-`c4g#_x&+BC+cF`c#7_82*dNu3~|&SdRf+gtX> z?9Qf6D5{auN=tB?N<;!g9}qA6NrV>^0a9%xYE&Ljg7_1ZVoD;MLRrGiUBNGjnI|6J34XexFZpsS%$PC{2bWqm$xv4^;qk(I(cw z_8xJ!SOs#e!%4j^0kpD=`71F%d<`J_eUJ2Byo>A@IYLDATd9OFASjH2_5=Ou90hKm z5YM=e;$URH+@I!n3E@El4WKZ({hUxDQZGDcQ2+g&I4}(K3z5AS=cqqM&L`#se-~&! zych!=7Dlwi(tp)TV7*pDX*uqdv|wbvPlF$&nk?QMcsCDHf8KnQWi}+F-4(mjsiD^U zcc&9g=~T8j(KON4+SGb~xR49CIQzX3y2mlqv;UCjADsP#b^ZC*j`eIZwe;kdZ+~v! zU5p!>#P-kz3))k<9J~!=)XV+)3exQx^i~%e!pvd1bc{_PtkNTfbF@8p>m+zcyz>x%ZDK<0bI5OOE_& zl=0H^+KeOr5@oz3y>`}-zXe^5oCet`&9C*AE*~*UuNYHT7WxPJrt5wHZ5h++Ivr@A z1uMH@Klr>;zcq%M_Gh6%W4i9E2oEe;4G{i^K#$?yX3y1coy3OE6M}u*vETDKgk86c z(tKxIH> zKxIH>KxIH>KxIH>;J+vXIEUujQuAON#Dw!wcP-d9-Z`cLe+2kAAkJ;Z-?Z%ufG+`F z0o?nRZQlpC=s53+#dqSM@J)n#Th^`)oc65_A&+zS8u)({4X9MN7h(tK(f;%sw%w1m z!BBUw@l*9{9t%v0hc-X>k&o@zjx_qm;CBw}-1AoG`w0BbKz{{55ezvs)G8y`HnqAZs6QHPiv}an;LeVq z))8z3`;K71nM1}r1RxKv`>Lo6s0^qKs0^qKs0^qKs0^qKs0^qKs0^qK{7+SfjJLkys(kj0*tJOMY z<#%Nxq{sKEv3yeke1{-QBVhv}1Gx#IO9o#|z;e{tE_`{wxK;`~t0IJ2m(tdr%X=j6oVZfeJt(_k` zHg_zGa|U>yXeh52z)ihK_TD&Oa`^S-@BP{S4XF48JpIs_k$4$)z>iN^JbA7Iegou3 zr{_Q*I;8q%(F{B_QK9GnJ|r5;$BUJ{E7;c~@2?m9T#D_FtYH7e z75Ha>$9}zWej9j=8+G9ifnV=$6nq}A>KyWzG;*THJK`enn729lzT9~i1)P2kzYvVi zejO^Va)#_DDgXQ~&F_Indmhj1@;9@dzXQC+&MpkXgR*MJWgGC@ zU3TT_aNa6d#gUQluvq%E-?TF3Fn-)$fDii7^>OX z*JXC?kD0KpK&3G(Wf1%9{^-8m&Pt85lmSq%VuaacPzy%vpfG#-4s=BO%mdxs4|ffi z1JRDYE^O6V0AaXLbi#hmg${5z1-)Wbgk&Oa#mnn0ROsY-3l-F|#TGnTY)mer0AW?G zsbD4wIdd$YP2hS9y$8T5k;R2Dwax zCnEP+5fv&CE*#HT@gYDfFL8`(sVuAzF)qT{oRtiZW{csWVhR=kfyE~z747J4vf`t{ z(T&9mV~4;GURnT*q@)@9|k>k$^JYK!N~It)XcK{9RUSC z<7a<|a1#`;&Ja54`Lx$YHcmGe4e+Sv| zJP6}amp{&xc>SLS4#!`4jT63ZAmsTKYG&E^DS7-g@?-30M?z2Y;_Dv&aWY`!c)1yt z8K3j`^Z&byv$%7v!u>P#U8uPCpRY$4dA^A4@mRUb_d!7a^8dXWX$igdEHnND%+a5Z ze=YkF?ggE@upe{JL&fc{Yf{4)K&7j2-k8GcPP{g!({|}PIU+5*_AE307R>5h{(N0t zM%hex%YKZ11r3fp?w{{(80RQ{9-r*T$MGBBize*P>-;e81f9FEKjW*Qbo&dPtO?sl zWMDtWw?X0d=j%{Lj??SU@(rk9TO2=M?=f;eY)|Q6QQU$Wa&)-LJo|sR%*YD+yOGD9 z+jLx)(jO==oCk)xsAYdY@ciJ|rH9-aF^PLUjdQ 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 diff --git a/library/XCompose b/library/XCompose new file mode 100644 index 0000000..0964a42 --- /dev/null +++ b/library/XCompose @@ -0,0 +1,243 @@ +# 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. +# +# ... : # comment +# +# Be starting with a namespace character we reduce the problem of potential +# aliasing to that namespace. By ending each sequence with a , 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 + : "𝔸" U1D538 # double-struck capital A + : "𝔹" U1D539 # double-struck capital B + : "ℂ" U2102 # double-struck capital C + : "𝔻" U1D53B # double-struck capital D + : "𝔼" U1D53C # double-struck capital E + : "𝔽" U1D53D # double-struck capital F + : "𝔾" U1D53E # double-struck capital G + : "ℍ" U210D # double-struck capital H + : "𝕀" U1D540 # double-struck capital I + : "𝕁" U1D541 # double-struck capital J + : "𝕂" U1D542 # double-struck capital K + : "𝕃" U1D543 # double-struck capital L + : "𝕄" U1D544 # double-struck capital M + : "ℕ" U2115 # double-struck capital N + : "𝕆" U1D546 # double-struck capital O +

: "ℙ" U2119 # double-struck capital P + : "ℚ" U211A # double-struck capital Q + : "ℝ" U211D # double-struck capital R + : "𝕊" U1D54A # double-struck capital S + : "𝕋" U1D54B # double-struck capital T + : "𝕌" U1D54C # double-struck capital U + : "𝕍" U1D54D # double-struck capital V + : "𝕎" U1D54E # double-struck capital W + : "𝕏" U1D54F # double-struck capital X + : "𝕐" U1D550 # double-struck capital Y + : "ℤ" U2124 # double-struck capital Z + + : "𝕒" U1D552 # double-struck lowercase a + : "𝕓" U1D553 # double-struck lowercase b + : "𝕔" U1D554 # double-struck lowercase c + : "𝕕" U1D555 # double-struck lowercase d + : "𝕖" U1D556 # double-struck lowercase e + : "𝕗" U1D557 # double-struck lowercase f + : "𝕘" U1D558 # double-struck lowercase g + : "𝕙" U1D559 # double-struck lowercase h + : "𝕚" U1D55A # double-struck lowercase i + : "𝕛" U1D55B # double-struck lowercase j + : "𝕜" U1D55C # double-struck lowercase k + : "𝕝" U1D55D # double-struck lowercase l + : "𝕞" U1D55E # double-struck lowercase m + : "𝕟" U1D55F # double-struck lowercase n + : "𝕠" U1D560 # double-struck lowercase o +

: "𝕡" U1D561 # double-struck lowercase p + : "𝕢" U1D562 # double-struck lowercase q + : "𝕣" U1D563 # double-struck lowercase r + : "𝕤" U1D564 # double-struck lowercase s + : "𝕥" U1D565 # double-struck lowercase t + : "𝕦" U1D566 # double-struck lowercase u + : "𝕧" U1D567 # double-struck lowercase v + : "𝕨" U1D568 # double-struck lowercase w + : "𝕩" U1D569 # double-struck lowercase x + : "𝕪" U1D56A # double-struck lowercase y + : "𝕫" U1D56B # double-struck lowercase z + +# accented letters + : "á" U00E1 # lowercase a with acute accent + : "à" U00E0 # lowercase a with grave accent + : "ä" U00E4 # lowercase a with umlaut + : "â" U00E2 # lowercase a with circumflex + : "ã" U00E3 # lowercase a with tilde + : "æ" U00E6 # lowercase ae diphthong + : "ç" U00E7 # lowercase c with cedilla + : "é" U00E9 # lowercase e with acute accent + : "è" U00E8 # lowercase e with grave accent + : "ë" U00EB # lowercase e with umlaut + : "ê" U00EA # lowercase e with circumflex + : "í" U00ED # lowercase i with acute accent + : "ì" U00EC # lowercase i with grave accent + : "ï" U00EF # lowercase i with umlaut + : "î" U00EE # lowercase i with circumflex + : "ñ" U00F1 # lowercase n with tilde + : "ó" U00F3 # lowercase o with acute accent + : "ò" U00F2 # lowercase o with grave accent + : "ö" U00F6 # lowercase o with umlaut + : "ô" U00F4 # lowercase o with circumflex + : "õ" U00F5 # lowercase o with tilde + : "œ" U0153 # lowercase oe diphthong + + +# #-------------------------------------------------------------------------------- +# Greek + + : "Α" U0391 # greek capital letter alpha + : "Β" U0392 # greek capital letter beta + : "Γ" U0393 # greek capital letter gamma + : "Δ" U0394 # greek capital letter delta + : "Ε" U0395 # greek capital letter epsilon + : "Ζ" U0396 # greek capital letter zeta + : "Η" U0397 # greek capital letter eta + : "Θ" U0398 # greek capital letter theta + : "Ι" U0399 # greek capital letter iota + : "Κ" U039A # greek capital letter kappa + : "Λ" U039B # greek capital letter lamda + : "Μ" U039C # greek capital letter mu + : "Ν" U039D # greek capital letter nu + : "Ξ" U039E # greek capital letter xi + : "Ο" U039F # greek capital letter omicron +

: "Π" U03A0 # greek capital letter pi + : "Ρ" U03A1 # greek capital letter rho + : "Σ" U03A3 # greek capital letter sigma + : "Τ" U03A4 # greek capital letter tau + : "Υ" U03A5 # greek capital letter upsilon + : "Φ" U03A6 # greek capital letter phi + : "Χ" U03A7 # greek capital letter chi + : "Ψ" U03A8 # greek capital letter psi + : "Ω" U03A9 # greek capital letter omega + + : "α" u03b1 # greek small letter alpha + : "β" u03b2 # greek small letter beta + : "γ" u03b3 # greek small letter gamma + : "δ" u03b4 # greek small letter delta + : "ε" u03b5 # greek small letter epsilon + : "ζ" u03b6 # greek small letter zeta + : "η" u03b7 # greek small letter eta + : "θ" u03b8 # greek small letter theta + : "ι" u03b9 # greek small letter iota + : "κ" u03ba # greek small letter kappa + : "λ" u03bb # greek small letter lamda + : "μ" u03bc # greek small letter mu + : "ν" u03bd # greek small letter nu + : "ξ" u03be # greek small letter xi + : "ο" u03bf # greek small letter omicron +

: "π" u03c0 # greek small letter pi + : "ρ" u03c1 # greek small letter rho + : "σ" u03c3 # greek small letter sigma + : "τ" u03c4 # greek small letter tau + : "υ" u03c5 # greek small letter upsilon + : "φ" u03c6 # greek small letter phi + : "χ" u03c7 # greek small letter chi + : "ψ" u03c8 # greek small letter psi + : "ω" u03c9 # greek small letter omega + +# -------------------------------------------------------------------------------- +# math + + : "×" U00D7 # multiplication sign + : "·" U00B7 # middle dot + : "⊡" U22A1 # squared dot operator + + : "≠" U2260 # not equal to + + : "≤" U2264 # less-than or equal to + : "≥" U2265 # greater-than or equal to + <0> : "∅" U2205 # empty set + + + : "∈" U2208 # element of + : "∉" U2209 # not an element of + + : "∪" U222A # union + : "⋂" U22C2 # n-ary interesection + : "⊂" U2282 # subset of + : "⊆" U2286 # subset of or equal to + : "⊃" U2283 # superset of + : "⊇" U2287 # superset of or equal to + + : "∩" U2229 # intersection + : "∁" U2201 # complement + + : "∃" U2203 # there exists + : "∄" U2204 # there does not exist + : "∀" U2200 # for all + + : "¬" U00AC # not sign + + : "⋁" U2228 # big vee, n-ary logical or + : "⋀" U22C0 # big wedge n-ary LOGICAL AND + + : "∨" U2228 # little vee logical or + : "∧" U2227 # little weddge logical and + : "⊼" U22BC # NAND + : "➜" U27A0 # implies + <=> : "⇒" U21D2 # implies + <=> : "⇔" U21D4 # if and only if + + : "⟳" U27F3 # clockwise gapped circle arrow, 'do' or 'for' operator + : "◨" U25E8 # square with right inked 'rightmost' 'maximum' operator + : "◧" U25E7 # square with left inked 'leftmost' 'minimum' operator + : "☥" U2625 # ankh diff --git a/library/archive/emacs_2024-04-11 b/library/archive/emacs_2024-04-11 new file mode 100644 index 0000000..39e3a8a --- /dev/null +++ b/library/archive/emacs_2024-04-11 @@ -0,0 +1,321 @@ +;;-------------------------------------------------------------------------------- +;; 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)) + diff --git a/library/archive/emacs_cp b/library/archive/emacs_cp new file mode 100644 index 0000000..4ed366b --- /dev/null +++ b/library/archive/emacs_cp @@ -0,0 +1,186 @@ +;;-------------------------------------------------------------------------------- +;; 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)) + + diff --git a/library/archive/emacs_orig b/library/archive/emacs_orig new file mode 100644 index 0000000..822c9e0 --- /dev/null +++ b/library/archive/emacs_orig @@ -0,0 +1,322 @@ +;;-------------------------------------------------------------------------------- +;; 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)) + + diff --git a/library/archive/emacs_with_indent_stuff b/library/archive/emacs_with_indent_stuff new file mode 100644 index 0000000..54eb19d --- /dev/null +++ b/library/archive/emacs_with_indent_stuff @@ -0,0 +1,421 @@ + +;;-------------------------------------------------------------------------------- +;; 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 " 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) diff --git a/library/bash_profile b/library/bash_profile new file mode 100644 index 0000000..b279bef --- /dev/null +++ b/library/bash_profile @@ -0,0 +1,7 @@ +#!/bin/bash +export PATH="/home/Thomas/subu_data/incommon/executable:$PATH" +systemctl --user import-environment PATH +if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" +fi + diff --git a/library/bashrc b/library/bashrc new file mode 100644 index 0000000..35eefde --- /dev/null +++ b/library/bashrc @@ -0,0 +1,51 @@ +# .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 + diff --git a/library/bashrc_root b/library/bashrc_root new file mode 100644 index 0000000..7f35e9a --- /dev/null +++ b/library/bashrc_root @@ -0,0 +1,27 @@ +# .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 \$\$" + + diff --git a/library/el/key-matrix.el b/library/el/key-matrix.el new file mode 100644 index 0000000..622687a --- /dev/null +++ b/library/el/key-matrix.el @@ -0,0 +1,434 @@ +;; 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 "") + (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" "") ; 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 "")) + + (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 diff --git a/library/el/key.el b/library/el/key.el new file mode 100644 index 0000000..3e9f584 --- /dev/null +++ b/library/el/key.el @@ -0,0 +1,87 @@ +;; 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 + + +) diff --git a/library/el/key_key-chord.el b/library/el/key_key-chord.el new file mode 100644 index 0000000..236f6d4 --- /dev/null +++ b/library/el/key_key-chord.el @@ -0,0 +1,63 @@ +;;================================================================================ +;; ;;---------------------------------------- +;; ;; 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") + +;; ) + + diff --git a/library/el/lisp.el b/library/el/lisp.el new file mode 100644 index 0000000..bb2dc76 --- /dev/null +++ b/library/el/lisp.el @@ -0,0 +1,66 @@ +;;-------------------------------------------------------------------------------- +;; 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) + ;; ) + diff --git a/library/el/main.el b/library/el/main.el new file mode 100644 index 0000000..c00f8d0 --- /dev/null +++ b/library/el/main.el @@ -0,0 +1,148 @@ +;; ;; 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))) + + ) + diff --git a/library/el/package.el b/library/el/package.el new file mode 100644 index 0000000..a79f3b1 --- /dev/null +++ b/library/el/package.el @@ -0,0 +1,86 @@ +;; 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) + )) +) diff --git a/library/el/programming.el b/library/el/programming.el new file mode 100644 index 0000000..4e2b3d8 --- /dev/null +++ b/library/el/programming.el @@ -0,0 +1,94 @@ +;;-------------------------------------------------------------------------------- +;; 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)) diff --git a/library/el/tramp.el b/library/el/tramp.el new file mode 100644 index 0000000..3d81aea --- /dev/null +++ b/library/el/tramp.el @@ -0,0 +1,116 @@ +;;-------------------------------------------------------------------------------- +;; 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:") + ) + +) diff --git a/library/emacs b/library/emacs new file mode 100644 index 0000000..40ef484 --- /dev/null +++ b/library/emacs @@ -0,0 +1,14 @@ + +(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")) + ) +) diff --git a/library/emacs_local b/library/emacs_local new file mode 100644 index 0000000..2576441 --- /dev/null +++ b/library/emacs_local @@ -0,0 +1,6 @@ + +;; Load the common configuration file +(load "/home/Thomas-mastu/incommon/library/emacs") + +;; User-specific configurations go below this line + diff --git a/library/sound_headphone b/library/sound_headphone new file mode 100644 index 0000000..9740c8e --- /dev/null +++ b/library/sound_headphone @@ -0,0 +1,113 @@ + +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 +pactl set-default-source + +---- +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 +# pactl move-source-output + + +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 +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 +Move currently active streams to the new default sink/source: For sink: + +bash +Copy code +pactl move-sink-input +For source: + +bash +Copy code +pactl move-source-output +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 +set-default-source +Restart PulseAudio: +bash +Copy code +systemctl --user restart pulseaudio + -- 2.20.1

: "ℙ" U2119 # double-struck capital P + : "ℚ" U211A # double-struck capital Q + : "ℝ" U211D # double-struck capital R + : "𝕊" U1D54A # double-struck capital S + : "𝕋" U1D54B # double-struck capital T + : "𝕌" U1D54C # double-struck capital U + : "𝕍" U1D54D # double-struck capital V + : "𝕎" U1D54E # double-struck capital W + : "𝕏" U1D54F # double-struck capital X + : "𝕐" U1D550 # double-struck capital Y + : "ℤ" U2124 # double-struck capital Z + + : "𝕒" U1D552 # double-struck lowercase a + : "𝕓" U1D553 # double-struck lowercase b + : "𝕔" U1D554 # double-struck lowercase c + : "𝕕" U1D555 # double-struck lowercase d + : "𝕖" U1D556 # double-struck lowercase e + : "𝕗" U1D557 # double-struck lowercase f + : "𝕘" U1D558 # double-struck lowercase g + : "𝕙" U1D559 # double-struck lowercase h + : "𝕚" U1D55A # double-struck lowercase i + : "𝕛" U1D55B # double-struck lowercase j + : "𝕜" U1D55C # double-struck lowercase k + : "𝕝" U1D55D # double-struck lowercase l + : "𝕞" U1D55E # double-struck lowercase m + : "𝕟" U1D55F # double-struck lowercase n + : "𝕠" U1D560 # double-struck lowercase o +