summaryrefslogtreecommitdiff
path: root/config/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'config/emacs')
-rw-r--r--config/emacs/.emacs.desktop.lock1
l---------config/emacs/emacs1
-rw-r--r--config/emacs/eshell/alias6
-rw-r--r--config/emacs/eshell/profile1
-rw-r--r--config/emacs/history22
-rw-r--r--config/emacs/init.el1135
-rw-r--r--config/emacs/site-lisp/chinese.el18
-rw-r--r--config/emacs/site-lisp/fbterm.el13
-rw-r--r--config/emacs/site-lisp/maze.el64
-rw-r--r--config/emacs/site-lisp/my-eglot.el7
-rw-r--r--config/emacs/site-lisp/my-exwm.el184
-rw-r--r--config/emacs/site-lisp/my-mail.el52
-rw-r--r--config/emacs/site-lisp/my-modal.el212
-rwxr-xr-xconfig/emacs/site-lisp/single-header.el257
-rw-r--r--config/emacs/site-lisp/tex-conf.el47
-rwxr-xr-xconfig/emacs/site-lisp/tmu-custom-theme.el67
-rw-r--r--config/emacs/splashLaputa.pngbin0 -> 376185 bytes
-rw-r--r--config/emacs/templates/c.eld5
-rw-r--r--config/emacs/viper1
19 files changed, 2093 insertions, 0 deletions
diff --git a/config/emacs/.emacs.desktop.lock b/config/emacs/.emacs.desktop.lock
new file mode 100644
index 0000000..f1904f0
--- /dev/null
+++ b/config/emacs/.emacs.desktop.lock
@@ -0,0 +1 @@
+7862 \ No newline at end of file
diff --git a/config/emacs/emacs b/config/emacs/emacs
new file mode 120000
index 0000000..2514d29
--- /dev/null
+++ b/config/emacs/emacs
@@ -0,0 +1 @@
+/home/tmu/dotfiles/config/emacs \ No newline at end of file
diff --git a/config/emacs/eshell/alias b/config/emacs/eshell/alias
new file mode 100644
index 0000000..6dcd5cf
--- /dev/null
+++ b/config/emacs/eshell/alias
@@ -0,0 +1,6 @@
+alias ll ls -la $*
+alias gs git status $*
+alias gc git checkout $*
+alias gl git log --graph --all --oneline $*
+alias glt git log --graph --all --oneline --simplify-by-decoration $*
+alias ff find-file $1
diff --git a/config/emacs/eshell/profile b/config/emacs/eshell/profile
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/config/emacs/eshell/profile
@@ -0,0 +1 @@
+
diff --git a/config/emacs/history b/config/emacs/history
new file mode 100644
index 0000000..e7d5648
--- /dev/null
+++ b/config/emacs/history
@@ -0,0 +1,22 @@
+;; -*- mode: emacs-lisp; lexical-binding: t; coding: utf-8-emacs-unix -*-
+;; Minibuffer history file, automatically generated by ‘savehist’.
+
+(setq savehist-minibuffer-history-variables '(shell-command-history read-number-history regexp-history substitute--history viper-ex-history viper-search-history query-replace-history minibuffer-history bookmark-history Man-topic-history read-expression-history grep-regexp-history yes-or-no-p-history extended-command-history file-name-history buffer-name-history))
+(setq shell-command-history '("pwd"))
+(setq regexp-history '("advice"))
+(setq substitute--history '("VIPER"))
+(setq viper-ex-history '("25,43s/d/D" "25,36p" "pr" "rp" "1" ",$p" "2" "0," ",$p" "s/old/new" ",$s/viper/VIPER" ",$/s/viper/VIPER" ",$ p" "b" "!fortune" "s/viper/VIPER" "s/viper Viper" "s/viper/Viper" "<,>s/viper/VIPER"))
+(setq viper-search-history '(#("syntax-preference 'emacs)
+ (setq-default viper-ex-style-motion nil)
+ (setq-default viper-auto-indent t)
+ (setq-default viper-" 0 29 (fontified t) 29 41 (face font-lock-keyword-face fontified t) 41 72 (fontified t) 72 84 (face font-lock-keyword-face fontified t) 84 109 (fontified t) 109 121 (face font-lock-keyword-face fontified t) 121 128 (fontified t)) "viper" ""))
+(setq query-replace-history '("#define \\1 0" #("^ *\\([A-Z_]*\\b\\).*" 3 4 (syntax-table #1=(3)) 14 15 (syntax-table #1#))))
+(setq minibuffer-history '("viper" "call-interactively" "default-directory" "save-excursion" "elisp" "with-local-quit" "call-interactively" "add-function" "viper-ex" "add-function" "funcall-interactively" "add-function" "viper-ex" "add-function" "advice-add" "defadvice" "advice-add" "advice--called-interactively-skip" "call-interactively" "funcall-interactively" "viper-ex" "funcall" "call-interactively" "with-local-quit" "elisp" "condition-case" "ignore-errors" "ignore-error" "elisp" "catch" "advice-add" "display-line-numbers-mode" "display-line-numbers" "advice-add" "ex-substitute" "viper-ex" "viper-mode" "viper-always" "viper" "substitute-0.5.0" "viper-substitute" "tmu-custom"))
+(setq bookmark-history '("init.el"))
+(setq Man-topic-history '("exec" "dbus-launch"))
+(setq read-expression-history '("(project-root (project-current))" "(require 'substitute)" "(setq before-save-hook nil)"))
+(setq grep-regexp-history '("XDG_RUNTIME"))
+(setq yes-or-no-p-history '("yes" "no" "yes"))
+(setq extended-command-history '("my/shell-at-root" "free-keys" "toggle-debug-on-quit" "viper-ex" "toggle-viper-mode" "viper-mode" "display-line-numbers-mode" "package-delete" "substitute-target-to-beginning-of-buffer" "list-packages" "toggle-viper-mode" "emacs-lock-mode" "emacs-build-description" "my/start-erc" "load-file" "describe-char" "list-colors-display" "describe-theme" "package-upgrade-all" "package-refresh-contents" "c-mode" "man" "desktop-remove" "desktop-read" "desktop-save" "bash-ts-mode" "package-autoremove"))
+(setq file-name-history '("~/Desktop/musl/src/math/arm/fma.c" "~/.emacs.d/init.el" "~/.local/share/emacs/31.0.50/lisp/emacs-lisp/advice.el.gz" "~/.emacs.d/init.el" "~/.emacs.d/elpa/substitute-0.5.0/substitute-autoloads.el" "~/.local/share/emacs/31.0.50/lisp/emulation/viper-ex.el.gz" "~/.emacs.d/init.el" "/su:root@localhost:/opt/slskd/.local/share/slskd/slskd.yml" "~/.emacs.d/" "/su:root@localhost:/opt/slskd/.local/share/slskd/old.yml" "~/dotfiles/bash_profile" "~/.xinitrc"))
+(setq buffer-name-history '("*Completions*" "*vc-diff*" "*info*" " *viper-info*" "*Async Shell Command*" "init.el" "*Async Shell Command*" "fma.c" "*Async Shell Command*" "init.el" "simple.el.gz" "init.el" " *viper-info*" "init.el" "*info*" "*Help*" "viper.el.gz" "init.el" "*Help*" "init.el" "display-line-numbers.el.gz" "*Occur*" "init.el" "*Help*" "init.el" "*Help*" "substitute-0.5.0" "substitute-autoloads.el" "substitute.el" "init.el" "info" "*Packages*" "*Help*" "*Ibuffer*" "#haskell" "Libera.Chat" "#haskell" "old.yml" "Libera.Chat" "*Help*" "slskd.yml" "init.el" "tmu-custom-theme.el" "example" "*vc-dir*" "bash_profile" "*xref*" "*Messages*" "ValveSteamLicense"))
diff --git a/config/emacs/init.el b/config/emacs/init.el
new file mode 100644
index 0000000..27eef38
--- /dev/null
+++ b/config/emacs/init.el
@@ -0,0 +1,1135 @@
+;;; init.el --- tmu init file -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;;; This file is organized with
+;;;
+;;; Stuff that needs to be at the start (package init, some fast
+;;; startup stuff, etc)
+;;; then my custom functions and variables
+;;; then builtin customization
+;;; then external packages
+;;; then other files that contain config I don't need all the time
+;;; then things Emacs sets programtically.
+
+;;; Code:
+
+;;; Init header:
+
+(progn ; performance stuff:
+ ;; delay initial gc until after loading init if possible
+ (setq gc-cons-threshold most-positive-fixnum)
+ (add-hook 'emacs-startup-hook
+ (lambda ()
+ (setq gc-cons-threshold (expt 2 23)))))
+
+(require 'package)
+(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
+(push "~/.emacs.d/site-lisp/" load-path)
+(package-initialize)
+(require 'use-package-ensure)
+(setq use-package-always-ensure t)
+
+(use-package benchmark-init
+ :config
+ (add-hook 'after-init-hook 'benchmark-init/deactivate))
+
+;;; Custom definitions, with prefix "my/"
+
+(defvar surround-keys '("(" "{" "[" "$" "\"" "'"))
+(defun my/wrap-pair ()
+ "Ensure the region is active and then \"insert-pair\"."
+ (interactive)
+ (activate-mark)
+ (insert-pair))
+(eval
+ `(define-keymap
+ :full nil
+ :name "Surround"
+ :prefix 'surround-prefix
+ ,@(mapcan
+ (lambda (key) (list key ''my/wrap-pair))
+ surround-keys
+ )))
+
+(defun my/toggle-frame-transparency ()
+ "Toggle transparency."
+ (interactive)
+ (let ((alpha-transparency 90))
+ (if (eq alpha-transparency (frame-parameter nil 'alpha-background))
+ (set-frame-parameter nil 'alpha-background 100)
+ (set-frame-parameter nil 'alpha-background alpha-transparency))))
+
+(defvar my/prog-cleanup-excluded-modes
+ '(makefile-gmake-mode makefile-mode makefile-imake-mode
+ makefile-makepp-mode makefile-bsdmake-mode
+ makefile-automake-mode
+ python-mode
+ fundamental-mode)
+ "Major modes for which \"my/clean-prog-file\" should not be run before save.")
+
+(defvar my/prog-cleanup-want-tabs-modes
+ '(makefile-gmake-mode makefile-mode makefile-imake-mode
+ makefile-makepp-mode makefile-bsdmake-mode makefile-automake-mode)
+ "Major modes that need tabs instead of spaces.
+\"my/clean-prog-file\" should convert spaces to tabs instead of tabs to spaces.")
+
+(defvar my/prog-cleanup-indent-max-lines 500
+ "Skip reindenting the buffer if it is longer than this many lines.
+Nil for no limit.")
+
+(defun my/clean-prog-file (&optional buffer)
+ "Perform whitespace cleanup and some normalization on `buffer'.
+Defaults to the current BUFFER. Converts tabs to spaces unless the
+major mode is in `my/prog-cleanup-want-tabs-modes', otherwise do the
+reverse. Delete trailing whitespace."
+ (unless buffer (setq buffer (current-buffer)))
+ (with-current-buffer buffer
+ (cond
+ ((and (functionp 'clang-format-buffer)
+ ; safety valve for undef'd
+ (derived-mode-p '(c-mode c++-mode)))
+ (clang-format-buffer))
+ (t
+ (when (and my/prog-cleanup-indent-max-lines
+ (< (car (buffer-line-statistics buffer))
+ my/prog-cleanup-indent-max-lines))
+ (indent-region (point-min) (point-max)))))
+ (if (member major-mode my/prog-cleanup-want-tabs-modes)
+ (tabify (point-min) (point-max))
+ (untabify (point-min) (point-max)))
+ (delete-trailing-whitespace)))
+
+(defun my/prog-buffer-setup ()
+ "Do setup in for code buffers."
+ (superword-mode 1)
+ (modify-syntax-entry ?_ "w")
+ (hs-minor-mode 1)
+ (display-fill-column-indicator-mode 1)
+ (smerge-mode 1)
+ ;; (when (derived-mode-p '(c-mode c++-mode))
+ ;; (c-guess))
+ (add-hook 'before-save-hook
+ (lambda ()
+ (unless (member major-mode my/prog-cleanup-excluded-modes)
+ (my/clean-prog-file)))))
+(add-hook 'prog-mode-hook 'my/prog-buffer-setup)
+
+(defun my/wrap-region-paren ()
+ "Wraps the region in parens. Similar to pressing ( with the region active."
+ (interactive)
+ (let ((beg (region-beginning))
+ (end (region-end)))
+ (save-excursion
+ (goto-char beg)
+ (insert "(")
+ (goto-char (+ end 1))
+ (insert ")"))))
+
+(defun my/zap-whitespace ()
+ "Zaps (deletes) the whitespace around the point in both directions."
+ (interactive)
+ (push-mark)
+ (skip-chars-backward " \t\n")
+ (push-mark)
+ (skip-chars-forward " \t\n")
+ (delete-region (mark) (point))
+ (pop-mark)
+ (goto-char (mark))
+ (pop-mark))
+
+(defun my/wrap-sexp (&optional arg)
+ "Wraps the following sexp in a pair of parens.
+Places point inside the new pair, pushing the mark before the new pair.
+With prefix ARG do ARG number sexps if given, including backwards."
+ (interactive "p")
+ (message "%s" arg)
+ (if arg
+ (progn
+ (push-mark)
+ (insert-pair arg ?\( ?\)))
+ (insert-pair 1 ?\( ?\))))
+
+(defun my/toggle-window-other-reachability ()
+ "Toggle whether this window can be selected by `other-window'."
+ (interactive)
+ (let* ((win (get-buffer-window (current-buffer)))
+ (current (window-parameter win 'no-other-window)))
+ (set-window-parameter win 'no-other-window (not current))
+ (force-mode-line-update)))
+;; small hack to make other window reachability visible like window dedication
+(advice-add 'mode-line-window-control :around
+ (lambda (f) (concat (funcall f)
+ (if (window-parameter nil 'no-other-window) "o" "")))
+ '(:name "other-window-indicator"))
+
+;; TODO find a bind for this
+(defun my/open-window-by-buffer (buffer)
+ "Move focus to an extant window by the buffer it contains.
+If no such window exists, switch to BUFFER in the current window."
+ (interactive "bBuffer: ")
+ (let ((win (get-buffer-window buffer t)))
+ (if win
+ (select-window win)
+ (switch-to-buffer buffer))))
+
+(defun my/shorten-path (path)
+ "Shorten string PATH. Initialize all but the last path component."
+ (let* ((components (split-string path "/"))
+ (last-component (-last (lambda (s) (not (string-empty-p s))) components))
+ (shortened-components
+ (mapcar (lambda (comp)
+ (if (or (string-equal comp last-component) (string-empty-p comp))
+ comp
+ (substring comp 0 1)))
+ components)))
+ (mapconcat 'identity shortened-components "/")))
+
+(defun my/swap-other-window-buffer ()
+ "Exchange buffer contents with the next window.
+Tries to switch the buffer contents of the current window and the next
+in the cyclic ordering. Doesn't consider windows that are dedicated."
+ (interactive)
+ (let* ((cw (get-mru-window nil nil nil t))
+ (cb (window-buffer cw))
+ (ow (next-window))
+ (ob (window-buffer ow)))
+ (unless (window-dedicated-p cw)
+ (while (window-dedicated-p ow)
+ (setq ow (next-window ow)
+ ob (window-buffer ow)))
+ (unless (eq cw ow)
+ (progn
+ (with-selected-window ow
+ (switch-to-buffer cb))
+ (with-selected-window cw
+ (switch-to-buffer ob)))))))
+
+(defun my/activate-mark ()
+ "Activate the region a la `C-SPC C-SPC', but don't move the point.
+Useful in combination with `query-replace' for acting on the region."
+ (interactive)
+ (if (region-active-p)
+ (deactivate-mark)
+ (activate-mark)))
+
+(defun my/c-x-n-to-m-n (&optional keymap)
+ "Copy bindings from C-x [n] to M-[n] in KEYMAP, defaulting to the global
+keymap."
+ (unless keymap (setq keymap global-map))
+ (mapc (lambda (n)
+ (let* ((from (concat "C-x " (format "%d" n)))
+ (to (concat "M-" (format "%d" n)))
+ (bind (keymap-lookup keymap from)))
+ (keymap-set keymap to bind)))
+ '(0 1 2 3 4 5 6 7 8 9)))
+(my/c-x-n-to-m-n)
+
+(defun my/keymap-keys (map)
+ "Return a list of all key sequences in a keymap MAP recursively."
+ (mapcan (lambda (c)
+ (let ((ks (car c))
+ (km (cdr c))
+ (acc nil))
+ (map-keymap (lambda (key bind)
+ (let ((kss (vconcat ks (vector key))))
+ (when (commandp bind)
+ (push kss acc))))
+ km)
+ acc))
+ (accessible-keymaps map)))
+
+(defun my/eshell (&optional arg)
+ "Create a new eshell or switch to an existing one.
+With ARG, make a new shell. If the current buffer is an eshell, switch
+back to the previous selected buffer."
+ (interactive "P")
+ (if (eq major-mode 'eshell-mode)
+ (switch-to-prev-buffer)
+ (eshell arg)))
+
+(defun my/eshell-clear-or-center (&optional clear)
+ "Either clear the screen or recenter display depending on point location."
+ (interactive "P")
+ (cond
+ (clear (eshell/clear clear))
+ ((>= (point) eshell-last-output-end) ;; at the input line
+ (eshell/clear clear))
+ (t ;; in scroll back somewhere
+ (recenter-top-bottom))))
+
+(defun my/vc-on-root (&optional arg)
+ "Open a vc dir buffer at the project root.
+With ARG, open a Dired buffer instead."
+ (interactive "P")
+ (let ((dir (project-root (project-current t))))
+ (if arg
+ (dired dir)
+ (vc-dir dir))))
+
+(defun my/shell-at-root ()
+ "Execute an async shell commmand at the root of the current project."
+ (interactive)
+ (let ((prior-cwd default-directory)
+ (want-quit inhibit-quit))
+ (setq inhibit-quit t)
+ (with-local-quit
+ (setq default-directory (project-root (project-current)))
+ (call-interactively 'async-shell-command))
+ (setq default-directory prior-cwd
+ inhibit-quit want-quit)))
+
+(defun my/kill-buffer (&optional arg)
+ "Kill the current buffer. With ARG kill the window as well."
+ (interactive "P")
+ (if arg
+ (kill-buffer-and-window)
+ (kill-buffer)))
+
+(defvar my/layout-pair (cons nil nil)
+ "Cons pair of window configurations.")
+(add-hook 'after-init-hook
+ (lambda ()
+ (setq my/layout-pair (cons (current-window-configuration)
+ (current-window-configuration)))))
+(defun my/layout-swap (&optional arg)
+ "Swap between the two saved window configurations.
+With ARG, don't save the current layout."
+ (interactive "p")
+ (let ((left (car my/layout-pair))
+ (right (cdr my/layout-pair))
+ (cwc (current-window-configuration)))
+ (cond
+ ((>= arg 16) (setq my/layout-pair (cons cwc cwc)))
+ ((eq (selected-frame) (window-configuration-frame right))
+ (unless (>= arg 4) (setq left cwc))
+ (set-window-configuration right t t)
+ (setq my/layout-pair (cons right left)))
+ (t (message "Quick layout swap only works with same frame!")))))
+
+(defun my/display-lines-advice (func &rest r)
+ "Around advice that temporarily shows line numbers."
+ (let ((want-quit inhibit-quit))
+ (setq inhibit-quit t)
+ (display-line-numbers-mode 1)
+ (force-window-update)
+ (with-local-quit
+ (call-interactively func))
+ (display-line-numbers-mode -1)
+ (force-window-update)
+ (setq inhibit-quit want-quit)))
+
+(progn ; my global keybinds
+ (define-minor-mode my/keys-mode
+ "Minor mode collecting global keybinds"
+ :global t
+ :keymap (make-sparse-keymap))
+
+ ;; The keymaps in `emulation-mode-map-alists' take precedence over
+ ;; `minor-mode-map-alist'
+ (add-to-list 'emulation-mode-map-alists
+ '((my/keys-mode . my/keys-keymap)))
+
+ (keymap-set my/keys-mode-map "C-x -" 'my/swap-other-window-buffer)
+ (keymap-set my/keys-mode-map "C-x w o" 'my/toggle-window-other-reachability)
+ (keymap-set my/keys-mode-map "M-w" 'copy-region-as-kill) ; make copying not flash cursor
+ (keymap-set my/keys-mode-map "M-(" 'my/wrap-region-paren)
+ (keymap-set my/keys-mode-map "M-z" 'my/zap-whitespace)
+ (keymap-set my/keys-mode-map "C-M-z" 'my/wrap-sexp)
+ (keymap-set my/keys-mode-map "M-o" 'other-window)
+ (keymap-set my/keys-mode-map "M-RET" 'my/eshell)
+ (keymap-set my/keys-mode-map "M-C" 'calc)
+ (keymap-set my/keys-mode-map "M-K" 'my/kill-buffer)
+ (keymap-set my/keys-mode-map "M-D" 'my/vc-on-root)
+ (keymap-set my/keys-mode-map "M-J" 'scroll-lock-mode)
+ (keymap-set my/keys-mode-map "M-Q" 'auto-fill-mode)
+ (keymap-set my/keys-mode-map "M-A" 'beginning-of-line-text)
+ (keymap-set my/keys-mode-map "M-R" 'my/layout-swap)
+ (keymap-set my/keys-mode-map "M-W" 'switch-to-buffer)
+ (keymap-set my/keys-mode-map "M-N" 'man)
+ (keymap-set my/keys-mode-map "M-*" 'my/shell-at-root)
+ (keymap-set my/keys-mode-map "C-c R" 'raise-sexp)
+ (keymap-set my/keys-mode-map "C-c r" 'delete-pair)
+ (keymap-set my/keys-mode-map "M-S" 'surround-prefix)
+ (keymap-set my/keys-mode-map "M-\"" 'my/activate-mark)
+
+ (my/keys-mode 1))
+
+(progn ; mode for log files
+ (define-derived-mode
+ generic-log-mode
+ fundamental-mode
+ "Log"
+ "Major mode for following log files."
+ (setq-local auto-revert-verbose nil)
+ (auto-revert-tail-mode 1))
+ (add-to-list 'auto-mode-alist
+ '("\\.log\\'" . generic-log-mode)))
+
+;;; Builtin config:
+
+(use-package server ; allow emacsclient
+ :demand t
+ :config
+ (unless (server-running-p) (server-start)))
+
+(use-package proced ; process editor
+ :commands (proced)
+ :config
+ (setq-default proced-auto-update-flag t)
+ (setq-default proced-auto-update-interval 1))
+
+(use-package dabbrev ; dynamic abbreviations
+ :demand t
+ :config
+ (add-to-list 'dabbrev-ignored-buffer-modes 'exwm-mode)
+ (add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode)
+ (add-to-list 'dabbrev-ignored-buffer-modes 'tags-table-mode)
+ (add-to-list 'dabbrev-ignored-buffer-modes 'doc-view-mode))
+
+(progn ; dired directory editor
+ (require 'dired)
+ (defun dired-do-find-marked-files ()
+ (interactive)
+ (seq-do 'find-file (dired-get-marked-files)))
+ (define-key dired-mode-map (kbd "C-o") 'dired-display-file)
+ (define-key dired-mode-map (kbd "F") 'dired-do-find-marked-files))
+
+(use-package ibuffer ; give a nice list of buffers with extra info
+ :commands (ibuffer)
+ :custom
+ (ibuffer-formats
+ '((mark modified read-only " "
+ (name 50 50 :left :elide) ; was originally 18
+ " "
+ (size 9 -1 :right)
+ " "
+ (mode 16 16 :left :elide)
+ " " filename-and-process)
+ (mark " "
+ (name 16 -1)
+ " " filename)))
+ :bind
+ ("C-x C-b" . ibuffer))
+
+(progn ; isearch search in buffer
+ ;; swap basic and regex binds
+ (keymap-set global-map "C-s" 'isearch-forward-regexp)
+ (keymap-set global-map "C-r" 'isearch-backward-regexp)
+ (keymap-set global-map "C-M-s" 'isearch-forward)
+ (keymap-set global-map "C-M-r" 'isearch-backward))
+
+(use-package eshell ; emacs shell
+ :demand t
+ :config
+ (use-package esh-help)
+ (require 'em-hist)
+ (require 'em-term)
+ (setup-esh-help-eldoc)
+ :bind (:map eshell-mode-map
+ ("C-l" . my/eshell-clear-or-center)) ; todo make smarter with centering
+ :hook (eshell-mode . eldoc-mode))
+
+(use-package ediff ; emacs interactive diff
+ :custom
+ (ediff-window-setup-function 'ediff-setup-windows-plain))
+
+(progn ; comint, doesn't play with use-package
+ (require 'comint)
+ (setq-default comint-scroll-to-bottom-on-input t)
+ (setq-default comint-scroll-to-bottom-on-output t)
+ (add-to-list 'comint-output-filter-functions #'comint-truncate-buffer)
+ (add-to-list 'comint-output-filter-functions #'ansi-color-process-output))
+
+(use-package tramp ; remote access for files
+ :demand t
+ :custom
+ (tramp-allow-unsafe-temporary-files t))
+
+(use-package asm-mode ; asm comments and tags generation
+ :demand t
+ :custom
+ (asm-comment-char ?#) ; prefer # over ; for asm comments
+ :init
+ (defun add-asm-label-tag-generation-hook ()
+ (add-hook 'after-save-hook
+ (lambda ()
+ (shell-command
+ "find . -iregex '.*\\.[sS]' -exec etags -l none -r '/\\([a-zA-Z0-9\\-_]+\\):/\1/' {} +"))
+ 0 t))
+ :hook
+ (asm-mode . 'add-asm-label-tag-generation-hook))
+
+(use-package compile ; compliation buffers and easy bind
+ :custom
+ (compilation-always-kill t)
+ (compilation-scroll-output t)
+ :bind (:map my/keys-mode-map ("M-M" . 'recompile))
+ :config
+ ;; Allow compilation buffer to be dedicated across frames
+ (add-to-list 'display-buffer-alist '("\\*compilation\\*" nil (reusable-frames . t)))
+ (add-hook 'compilation-filter-hook #'ansi-color-compilation-filter))
+
+(use-package man ; view manuals in emacs
+ :custom
+ (Man-switches "-a"))
+
+(use-package imenu ; jump to items in the current buffer
+ :bind
+ ("M-i" . imenu)
+ :custom
+ (imenu-auto-rescan t)
+ (imenu-flatten t))
+
+(use-package xref ; jump to syntactic elements in project
+ ;; (add-hook 'xref-backend-functions 'gxref-xref-backend)
+ :bind ("M-I" . xref-find-definitions))
+
+(use-package time ; time if I want it in the modeline etc
+ :custom
+ (display-time-day-and-date t)
+ (display-time-24hr-format t))
+
+(use-package battery ; battery in modeline etc
+ )
+
+(progn ; indent code when pasting
+ (require 'dash)
+ (defvar yank-indent-modes '(prog-mode LaTeX-mode TeX-mode)
+ "Modes in which to indent regions that are yanked (or yank-popped).")
+
+ (defun yank-indent-func (&optional arg)
+ (let* ((parents (derived-mode-all-parents major-mode))
+ (helper (lambda (acc v) (or acc (member v yank-indent-modes))))
+ (included (-reduce helper parents)))
+ (when (and (not arg) included)
+ (indent-region (region-beginning) (region-end)))))
+
+ (advice-add 'yank :after 'yank-indent-func)
+ (advice-add 'yank-pop :after 'yank-indent-func))
+
+(progn ; better commenting binds
+ (global-set-key (kbd "C-x C-;") 'comment-or-uncomment-region)
+ (global-set-key (kbd "C-x ;") 'comment-line)
+ (global-set-key (kbd "C-x :") 'comment-or-uncomment-region)
+ ;; ^ duped for terminal w/o C-;
+ )
+
+(progn ; default modeline config additions
+ (let ((dir '("" (:eval (let ((str (concat (format " [%s] " (my/shorten-path default-directory)))))
+ (add-face-text-property
+ 0 (length str)
+ '(:weight bold :foreground "green2")
+ t str)
+ str)))))
+ (add-to-list 'mode-line-misc-info dir)))
+
+(progn ; comfy scratch buffer
+ (require 'iimage)
+ (setq inhibit-startup-screen t)
+ (setq initial-scratch-message
+ (concat (propertize ";; " 'invisible t)
+ "</home/tmu/.emacs.d/splashLaputa.png>
+;; scratch for lisp evaluation and unsaved text
+
+"))
+ (add-hook 'emacs-startup-hook
+ (lambda ()
+ (with-current-buffer "*scratch*"
+ (emacs-lock-mode 'kill)
+ (iimage-mode 1)))))
+
+(progn ; confirm fewer things
+ (setq kill-buffer-query-functions
+ (delq 'process-kill-buffer-query-function kill-buffer-query-functions))
+ (setq confirm-kill-processes nil)
+ (setq async-shell-command-buffer 'new-buffer)
+ (setq vc-follow-symlinks t))
+
+;; misc vars
+(setq delete-pair-blink-delay 0
+ enable-recursive-minibuffers t
+ frame-resize-pixelwise t)
+(electric-pair-mode 1)
+(vc-auto-revert-mode 1)
+
+;;; External packages:
+
+(use-package orderless ; ordering (minibuffer) completions
+ :demand t
+ :custom
+ (orderless-skip-highlighting t)
+ (completion-styles '(orderless basic partial-completion emacs22))
+ (completion-category-defaults nil)
+ (completion-category-overrides nil)
+ (completion-ignore-case t)
+ (read-file-name-completion-ignore-case t)
+ (read-buffer-completion-ignore-case t)
+ (orderless-smart-case nil)
+ (orderless-matching-styles
+ '(orderless-prefixes orderless-literal orderless-regexp)))
+
+(use-package vertico ; better minibuffer complete
+ :demand t
+ :custom
+ (vertico-cycle t)
+ :config
+ (vertico-mode 1)
+ (vertico-flat-mode)
+ :bind (:map minibuffer-local-map
+ ("M-v" . 'vertico-flat-mode)))
+
+;; (use-package posframe ; child frames inside normal frames
+;; )
+;; (use-package vertico-posframe ; use posframes to display minibuffer
+;; :after vertico
+;; :demand t
+;; :custom
+;; (vertico-posframe-poshandler
+;; #'posframe-poshandler-frame-bottom-center)
+;; (vertico-posframe-size-function
+;; (lambda (buffer)
+;; (let ((w (frame-width)))
+;; (list
+;; :height (buffer-local-value 'vertico-posframe-height buffer)
+;; :min-height (or (buffer-local-value 'vertico-posframe-min-height buffer)
+;; (let ((height (+ vertico-count 1)))
+;; (min height (or (buffer-local-value 'vertico-posframe-height buffer) height))))
+;; :width w
+;; :min-width w))))
+;; :config
+;; (vertico-posframe-mode 1))
+
+(use-package marginalia ; more info in minibuffer menus
+ :demand t
+ :custom
+ (marginalia-max-relative-age 0)
+ (marginalia-align 'right)
+ :bind (:map minibuffer-local-map
+ ("M-A" . 'marginalia-cycle))
+ :config
+ (marginalia-mode))
+
+(use-package embark ; more actions from minibuffer
+ :demand t
+ :bind
+ (("C-." . embark-act)
+ ("C-," . embark-dwim)
+ ("C-h B" . embark-bindings))
+ :config
+ ;; Hide the mode line of the Embark live/completions buffers
+ (add-to-list 'display-buffer-alist
+ '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
+ nil
+ (window-parameters (mode-line-format . none)))))
+
+(use-package corfu ; in buffer completion
+ :demand t
+ :custom
+ (corfu-cycle t)
+ (corfu-quit-no-match t)
+ :bind (("M-/" . completion-at-point))
+ :init
+ (defun my/corfu-commit-single ()
+ "Complete without asking if there is only one candidate."
+ (when (and (corfu--popup-visible-p)
+ (= (length corfu--candidates) 1))
+ (corfu-accept)))
+ :hook (corfu-post-command . my/corfu-commit-single)
+ :config
+ (global-corfu-mode 1))
+
+(use-package tempel ; templates
+ :demand t
+ :custom
+ (tempel-path "~/.emacs.d/templates/*.eld")
+ :bind (("M-+" . tempel-complete))
+ :config
+ (keymap-set tempel-map "<remap> <forward-word>" #'tempel-next)
+ (keymap-set tempel-map "<remap> <backward-word>" #'tempel-previous))
+
+(use-package tempel-collection ; other people's templates
+ :after tempel
+ :demand t)
+
+(use-package cape ; extend completion frameworks
+ :demand t
+ :bind ("C-c p" . cape-prefix-map)
+ :config
+ (advice-add 'pcomplete-completions-at-point :around 'cape-wrap-silent)
+ ;; (advice-add 'pcomplete-completions-at-point :around 'cape-wrap-purify)
+ (defvar my/completion-at-point-functions-always-include
+ (list 'tags-completion-at-point-function 'cape-dabbrev 'cape-dict 'tempel-complete))
+ ;; local settings should include t to also include global settings
+ (setq completion-at-point-functions my/completion-at-point-functions-always-include))
+
+(use-package ibuffer-vc ; group buffers by vcs directory
+ :after ibuffer
+ :demand t
+ :hook
+ (ibuffer .
+ (lambda ()
+ (ibuffer-vc-set-filter-groups-by-vc-root)
+ (unless (eq ibuffer-sorting-mode 'alphabetic)
+ (ibuffer-do-sort-by-alphabetic)))))
+
+(use-package free-keys ; display a list of unbound keys
+ )
+
+(use-package which-key ; show list of next keys after prefix & delay
+ :demand t
+ :config
+ (which-key-mode 1))
+
+(use-package winum ; binds for switching to windows by number
+ :demand t
+ :config
+ (winum-mode 1))
+
+;; (use-package savehist ; preserve minibuffer history across sessions
+;; :demand t
+;; :init
+;; (savehist-mode))
+
+;; (use-package consult ; more encompassing buffer switch and searching
+;; :demand t
+;; :custom
+;; (consult-preview-excluded-buffers t)
+;; (consult-narrow-key ",")
+;; :bind
+;; ("C-x b" . consult-buffer)
+;; ("M-W" . consult-buffer)
+;; ("C-S-y" . consult-yank-from-kill-ring)
+;; ("M-g M-g" . consult-goto-line)
+;; ("C-S-s" . consult-line-multi)
+;; ("M-s g" . consult-grep)
+;; ("M-s G" . grep)
+;; ("M-s f" . consult-find)
+;; ;; move some standard binds
+;; ("M-s s" . consult-line))
+;; (use-package embark-consult
+;; :after embark consult)
+
+(use-package hl-todo ; highlight certain keywords
+ :hook
+ (prog-mode . hl-todo-mode))
+
+(use-package visible-mark ; make the mark visible
+ :demand t
+ :custom-face
+ (visible-mark-active
+ ((t . (:foreground "black"
+ :background "deep pink"
+ :box (:line-width (-1 . -1)
+ :color "deep pink"
+ :style nil)))))
+ :custom
+ (visible-mark-max 1)
+ :config
+ (global-visible-mark-mode 1))
+
+(use-package avy ; goto location by char pair and jump list
+ :bind (("C-'" . avy-goto-char-2)
+ ("M-G" . avy-goto-char-2))
+ :custom
+ (avy-all-windows nil)
+ (avy-all-windows-alt 'all-frames))
+
+(use-package balanced-windows ; auto rebalance windows
+ :bind ("C-x w b" . balanced-windows-mode))
+
+(use-package eat ; terminal emu + make eshell behave better
+ :demand t
+ :custom
+ (eat-enable-auto-line-mode t)
+ :config
+ (eat-eshell-mode)
+ (eat-eshell-visual-command-mode)
+ (let* ((desired-global-binds (my/keymap-keys my/keys-mode-map))
+ (desired-prefixes (mapcar (lambda (ks)
+ (let ((k1 (elt ks 0))
+ (meta-mask ?\M-\0))
+ (if (numberp k1)
+ (if (equal ?\e k1)
+ (vector k1 (elt ks 1))
+ (let ((k-no-m (logand k1 (lognot meta-mask)))
+ (k-has-m (not (zerop (logand k1 meta-mask)))))
+ (if k-has-m
+ (vector ?\e k-no-m)
+ (vector k1))))
+ (vector k1))))
+ desired-global-binds)))
+ (mapc (lambda (ks)
+ (add-to-list 'eat-semi-char-non-bound-keys ks)
+ (add-to-list 'eat-eshell-semi-char-non-bound-keys ks))
+ desired-prefixes)
+ (eat-update-semi-char-mode-map)
+ (eat-eshell-update-semi-char-mode-map)))
+
+(use-package bash-completion ; allow bash completion in eshell mostly
+ :demand t
+ :config
+ (add-hook 'shell-dynamic-complete-functions
+ 'bash-completion-dynamic-complete)
+ :hook
+ (eshell-mode . (lambda ()
+ (add-hook 'completion-at-point-functions
+ 'bash-completion-capf-nonexclusive nil t))))
+
+(use-package pinentry ; allow some passwords to be entered with emacs
+ )
+
+(use-package password-store ; gnu pass integration
+ :demand t)
+(use-package auth-source-pass ; allow pass to act as auth within emacs
+ :init (auth-source-pass-enable))
+(use-package pass ; nice interface for gnu pass
+ :demand t
+ :after password-store auth-source-pass
+ :custom
+ (pass-suppress-confirmations t)
+ (epg-pinentry-mode 'loopback)
+ :config
+ (add-to-list 'display-buffer-alist
+ '("\\*Password-Store\\*"
+ display-buffer-in-side-window
+ (side . right))))
+
+(use-package pyvenv ; respect python environments
+ )
+
+;; (use-package sideline ; put warnings on the side of the same line
+;; :init
+;; (use-package sideline-flycheck)
+;; (use-package sideline-flymake)
+;; :custom
+;; (sideline-backends-right '(sideline-flycheck sideline-flymake)))
+
+;; (use-package flycheck
+;; :config
+;; ;; flymake stuff to be less annoying
+;; ;; (face-spec-set 'flycheck-note '((t :underline nil)))
+;; ;; (face-spec-set 'flycheck-info '((t :underline nil)))
+;; ;; (face-spec-set 'flycheck-warning '((t :underline nil)))
+;; ;; (face-spec-set 'flycheck-error '((t :underline nil)))
+;; :hook
+;; (prog-mode . flycheck-mode))
+
+(progn ; collected folding binds, hs + fold this
+ (define-prefix-command 'my/fold-map)
+ (global-set-key (kbd "M-F") 'my/fold-map)
+ (define-keymap :full nil
+ :parent nil
+ :suppress nil
+ :keymap nil
+ :name "my/fold-map"
+ :prefix 'my/fold-map)
+ (progn ; hideshow folding
+ (keymap-set my/fold-map "t" 'hs-toggle-hiding)
+ (keymap-set my/fold-map "l" 'hs-hide-level)
+ (keymap-set my/fold-map "C-t" 'hs-hide-all)
+ (keymap-set my/fold-map "C-a" 'hs-show-all))
+
+ (use-package fold-this ; fold arbitrary region
+ :init
+ (defun my/fold-this-fold-forward (&optional arg)
+ "Fold forward ARG number of sexps, defaulting to one."
+ (interactive "p")
+ (push-mark)
+ (forward-sexp arg)
+ (fold-this (mark) (point))
+ (pop-mark))
+
+ (defun my/fold-this-fold-backward (&optional arg)
+ "Fold backward ARG number of sexps, defaulting to one."
+ (interactive "p")
+ (push-mark)
+ (backward-sexp arg)
+ (fold-this (point) (mark))
+ (pop-mark))
+
+ :bind (:map my/fold-map
+ ("c" . fold-this)
+ ("e" . fold-this-unfold-at-point)
+ ("f" . my/fold-this-fold-forward)
+ ("b" . my/fold-this-fold-backward))))
+
+(use-package clang-format ; let clang do c formatting
+ )
+
+(use-package rust-mode ; rust lang syntax
+ )
+
+(use-package haskell-mode ; haskell + cabal integrations
+ :custom
+ (haskell-tags-on-save t)
+ (haskell-process-type 'cabal-repl)
+ (haskell-process-auto-import-loaded-modules t)
+ :hook (haskell-mode . interactive-haskell-mode))
+
+(use-package opam-switch-mode ; make emacs mode respect switch
+ :config
+ (when (and (file-exists-p "~/.opam") (executable-find "opam"))
+ (opam-switch-set-switch "default")))
+(use-package tuareg ; ocaml mode
+ :after opam-switch-mode)
+(use-package ocp-indent ; indentation for ocaml
+ :after tuareg
+ :hook (tuareg-mode . ocp-setup-indent))
+(use-package merlin ; ocaml completion
+ :after tuareg
+ :hook (tuareg-mode . merlin-mode)
+ :custom (merlin-command 'opam))
+
+(use-package racket-mode ; basic racket integration
+ )
+
+(use-package sdcv ; dictionary, requires sdcv install
+ :demand t
+ :config
+ (define-prefix-command 'dict-map)
+ (define-keymap :full nil
+ :parent nil
+ :suppress nil
+ :keymap nil
+ :name "dict-map"
+ :prefix 'dict-map
+ (kbd "w") 'sdcv-search-input
+ (kbd "c") (lambda () (interactive)
+ (activate-input-method 'pyim)
+ (sdcv-search-input (read-from-minibuffer "Chinese Word: "
+ nil nil nil
+ nil nil t))
+ (activate-input-method nil)))
+ :bind (:map text-mode-map
+ ("M-l" . 'dict-map)))
+
+(use-package erc ; irc client
+ :init
+ (defun my/start-erc ()
+ "Start erc and autojoin various channels"
+ (interactive)
+ (erc :server "irc.libera.chat" :port 6667))
+ :custom
+ (erc-modules '(services autojoin button completion fill imenu irccontrols list match menu
+ move-to-prompt netsplit networks readonly ring stamp track))
+ (erc-nick "tccq")
+ (erc-use-auth-source-for-nickserv-password t)
+ (erc-autojoin-channels-alist '(("libera.chat"
+ "#emacs" "#haskell" "#duskos" "#ocaml")))
+
+ (erc-hide-list '("JOIN" "PART" "QUIT"))
+ (erc-current-nick-highlight-type 'nick)
+ (erc-keywords nil)
+ (erc-track-exclude-types '("JOIN" "PART" "QUIT" "NICK" "MODE"))
+ (erc-track-use-faces t)
+ (erc-track-faces-priority-list '(erc-current-nick-face erc-keyword-face))
+ (erc-track-priority-faces-only 'all))
+
+(use-package minions ; show less on the modeline
+ :demand t
+ :config
+ (minions-mode 1)
+ :custom
+ (minions-prominent-modes '(my/temp-nonmodal-mode persp-mode auto-fill-mode eldoc-mode eglot-mode lsp-mode)))
+
+(use-package ispell ; spellchecker
+ :demand t
+ :custom
+ (ispell-personal-dictionary "/home/tmu/.aspell.en.pws")
+ :config
+ (defun ispell-mode (&optional arg)
+ "Make some old packages work with modern ispell."
+ (interactive)
+ (ispell-minor-mode arg))
+ (advice-add 'ispell-mode :before 'debug)
+ (setq-default text-mode-hook (cons 'ispell-minor-mode (remove 'ispell-mode text-mode-hook))))
+
+(load-file "/home/tmu/.emacs.d/site-lisp/my-modal.el")
+
+;;; Optional files for occasional loading:
+
+;; if you want exwm, include from ~/.emacs.d/site-lisp/my-exwm.el
+;; if you want mail, include from ~/.emacs.d/site-lisp/my-mail.el
+;; if you want eglot, include from ~/.emacs.d/site-lisp/my-eglot.el
+
+;;; Theming:
+
+(require 'tmu-custom-theme)
+(push "~/.emacs.d/site-lisp/" custom-theme-load-path)
+(load-theme 'tmu-custom t)
+
+;;; Things emacs sets programatically:
+;; ----------------------------------------------------------------------
+
+(put 'dired-find-alternate-file 'disabled nil)
+(put 'upcase-region 'disabled nil)
+(put 'downcase-region 'disabled nil)
+(put 'list-timers 'disabled nil)
+(put 'narrow-to-region 'disabled nil)
+(put 'set-goal-column 'disabled nil)
+
+(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.
+ '(comment-style 'extra-line)
+ '(connection-local-criteria-alist
+ '(((:application eshell :protocol "ssh" :user "tmu" :machine
+ "cnoserver")
+ autogenerated-connection-local-profile/\(:application\ eshell\ :protocol\ \"ssh\"\ :user\ \"tmu\"\ :machine\ \"cnoserver\"\))
+ ((:application vc-git :protocol "ssh" :user "tmu" :machine
+ "cnoserver")
+ autogenerated-connection-local-profile/\(:application\ vc-git\ :protocol\ \"ssh\"\ :user\ \"tmu\"\ :machine\ \"cnoserver\"\))
+ ((:application vc-git) vc-git-connection-default-profile)
+ ((:application tramp :protocol "kubernetes")
+ tramp-kubernetes-connection-local-default-profile)
+ ((:application tramp :protocol "flatpak")
+ tramp-container-connection-local-default-flatpak-profile
+ tramp-flatpak-connection-local-default-profile)
+ ((:application tramp)
+ tramp-connection-local-default-system-profile
+ tramp-connection-local-default-shell-profile)
+ ((:application eshell) eshell-connection-default-profile)))
+ '(connection-local-profile-alist
+ '((autogenerated-connection-local-profile/\(:application\ eshell\ :protocol\ \"ssh\"\ :user\ \"tmu\"\ :machine\ \"cnoserver\"\)
+ (eshell-path-env-list "/bin" "/usr/bin" "/sbin" "/usr/sbin"
+ "/usr/local/bin" "/usr/local/sbin"))
+ (autogenerated-connection-local-profile/\(:application\ vc-git\ :protocol\ \"ssh\"\ :user\ \"tmu\"\ :machine\ \"cnoserver\"\)
+ (vc-git--program-version . "2.48.1"))
+ (vc-git-connection-default-profile (vc-git--program-version))
+ (tramp-flatpak-connection-local-default-profile
+ (tramp-remote-path "/app/bin" tramp-default-remote-path "/bin"
+ "/usr/bin" "/sbin" "/usr/sbin"
+ "/usr/local/bin" "/usr/local/sbin"
+ "/local/bin" "/local/freeware/bin"
+ "/local/gnu/bin" "/usr/freeware/bin"
+ "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin"
+ "/opt/sbin" "/opt/local/bin"))
+ (tramp-kubernetes-connection-local-default-profile
+ (tramp-config-check . tramp-kubernetes--current-context-data)
+ (tramp-extra-expand-args 97
+ (tramp-kubernetes--container
+ (car tramp-current-connection))
+ 104
+ (tramp-kubernetes--pod
+ (car tramp-current-connection))
+ 120
+ (tramp-kubernetes--context-namespace
+ (car tramp-current-connection))))
+ (tramp-container-connection-local-default-flatpak-profile
+ (tramp-remote-path "/app/bin" tramp-default-remote-path "/bin"
+ "/usr/bin" "/sbin" "/usr/sbin"
+ "/usr/local/bin" "/usr/local/sbin"
+ "/local/bin" "/local/freeware/bin"
+ "/local/gnu/bin" "/usr/freeware/bin"
+ "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin"
+ "/opt/sbin" "/opt/local/bin"))
+ (tramp-connection-local-darwin-ps-profile
+ (tramp-process-attributes-ps-args "-acxww" "-o"
+ "pid,uid,user,gid,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "-o" "state=abcde" "-o"
+ "ppid,pgid,sess,tty,tpgid,minflt,majflt,time,pri,nice,vsz,rss,etime,pcpu,pmem,args")
+ (tramp-process-attributes-ps-format (pid . number)
+ (euid . number)
+ (user . string)
+ (egid . number) (comm . 52)
+ (state . 5) (ppid . number)
+ (pgrp . number)
+ (sess . number)
+ (ttname . string)
+ (tpgid . number)
+ (minflt . number)
+ (majflt . number)
+ (time . tramp-ps-time)
+ (pri . number)
+ (nice . number)
+ (vsize . number)
+ (rss . number)
+ (etime . tramp-ps-time)
+ (pcpu . number)
+ (pmem . number) (args)))
+ (tramp-connection-local-busybox-ps-profile
+ (tramp-process-attributes-ps-args "-o"
+ "pid,user,group,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "-o" "stat=abcde" "-o"
+ "ppid,pgid,tty,time,nice,etime,args")
+ (tramp-process-attributes-ps-format (pid . number)
+ (user . string)
+ (group . string) (comm . 52)
+ (state . 5) (ppid . number)
+ (pgrp . number)
+ (ttname . string)
+ (time . tramp-ps-time)
+ (nice . number)
+ (etime . tramp-ps-time)
+ (args)))
+ (tramp-connection-local-bsd-ps-profile
+ (tramp-process-attributes-ps-args "-acxww" "-o"
+ "pid,euid,user,egid,egroup,comm=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "-o"
+ "state,ppid,pgid,sid,tty,tpgid,minflt,majflt,time,pri,nice,vsz,rss,etimes,pcpu,pmem,args")
+ (tramp-process-attributes-ps-format (pid . number)
+ (euid . number)
+ (user . string)
+ (egid . number)
+ (group . string) (comm . 52)
+ (state . string)
+ (ppid . number)
+ (pgrp . number)
+ (sess . number)
+ (ttname . string)
+ (tpgid . number)
+ (minflt . number)
+ (majflt . number)
+ (time . tramp-ps-time)
+ (pri . number)
+ (nice . number)
+ (vsize . number)
+ (rss . number)
+ (etime . number)
+ (pcpu . number)
+ (pmem . number) (args)))
+ (tramp-connection-local-default-shell-profile
+ (shell-file-name . "/bin/sh") (shell-command-switch . "-c"))
+ (tramp-connection-local-default-system-profile
+ (path-separator . ":") (null-device . "/dev/null"))
+ (eshell-connection-default-profile (eshell-path-env-list))))
+ '(custom-safe-themes
+ '("aee99e2118e960b53016623dc2345d88227d1236d28c6c34858e1d55575cf7c3"
+ "6f5e3fd2b4245ffe660da69ea5c13ab392337e94776dfb23cc1d8d0f80e3baa2"
+ "1b8c2fd98bf6777d8b95f8cf98fdaede88feee3419ec3e5008f94b56618ac6ca"
+ "0cc5046b7981609166c28b64f6185fa5f73bcb00d21e037f304794c6aaa1f340"
+ "9f2e4e8b2ddbfdd392eedbc123649d94654278dee5a53b899557224416413d35"
+ "6dafb31ade9ff07229faaf05c41c2ae475c44731362b792f65f3930b1a2c9cfd"
+ "dc77e008092a5a4aa6b6ed8e4826bebf8f2fb930a8de073bf7f458efd884cca8"
+ "d1ff3e66028f9c527298580d2a64f9e3280f07f9e94d4dada72b67ef15069441"
+ "3d4e3644e237a95683daa73e397c4c0d1ae06bbaaf8040104232591a28bc1315"
+ "12a07bc38295e4b06a8965db261f51ea7ea61fbf91b3ef41298bbb549d1d9403"
+ default))
+ '(ede-project-directories
+ '("/home/tmu/Desktop/eway/sway" "/home/tmu/Desktop/eway/cage"
+ "/home/tmu/Desktop/eway/wlroots" "/home/tmu/Desktop/eway/comp"
+ "/home/tmu/Desktop/eway"))
+ '(eglot-events-buffer-config '(:size 0 :format full))
+ '(fortune-dir "/usr/share/fortune/")
+ '(gdb-non-stop-setting nil)
+ '(helm-minibuffer-history-key "M-p")
+ '(menu-bar-mode nil)
+ '(package-selected-packages nil)
+ '(pyim-assistant-scheme 'cangjie)
+ '(safe-local-variable-values '((LEXICAL-binding . t)))
+ '(scroll-bar-mode nil)
+ '(tags-revert-without-query t)
+ '(tool-bar-mode nil)
+ '(transient-mark-mode nil)
+ '(whitespace-style
+ '(face trailing tabs lines-tail missing-newline-at-eof indentation
+ space-after-tab space-before-tab tab-mark) t))
+
+(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.
+ )
diff --git a/config/emacs/site-lisp/chinese.el b/config/emacs/site-lisp/chinese.el
new file mode 100644
index 0000000..4b01594
--- /dev/null
+++ b/config/emacs/site-lisp/chinese.el
@@ -0,0 +1,18 @@
+;; chinese input stuff
+;; (require 'unicode-fonts)
+;; (unicode-fonts-setup)
+(require 'pyim)
+(require 'pyim-basedict)
+(pyim-basedict-enable)
+;; (require 'pyim-wbdict)
+(setq default-input-method "pyim")
+(setq pyim-default-scheme 'quanpin)
+;; (pyim-wbdict-v98-morphe-enable)
+;; (dolist (charset '(kana han symbol cjk-misc bopomofo))
+;; (set-fontset-font (frame-parameter nil 'font)
+;; charset
+;; (font-spec :family "FangSong" :size 15)))
+;; (setq rime-translate-keybindings
+;; '("C-f" "C-b" "C-n" "C-p" "C-g" "<left>" "<right>" "<up>" "<down>" "<prior>" "<next>" "<delete>"))
+;; (setq rime-share-data-dir "~/.local/share/fcitx5/rime")
+;; (setq rime-show-candidate 'popup)
diff --git a/config/emacs/site-lisp/fbterm.el b/config/emacs/site-lisp/fbterm.el
new file mode 100644
index 0000000..b8b3ba4
--- /dev/null
+++ b/config/emacs/site-lisp/fbterm.el
@@ -0,0 +1,13 @@
+;; config specifically for running emacs as the base process of fbterm
+
+
+(require 'ednc)
+(require 'single-header)
+
+;;; Code:
+
+(unless ednc-mode (ednc-mode 1))
+(unless single-header-mode (single-header-mode 1))
+
+(provide 'fbterm)
+;;; fbterm.el ends here
diff --git a/config/emacs/site-lisp/maze.el b/config/emacs/site-lisp/maze.el
new file mode 100644
index 0000000..784049f
--- /dev/null
+++ b/config/emacs/site-lisp/maze.el
@@ -0,0 +1,64 @@
+;; [adj] movement and editing for lisp
+
+(provide 'maze-lisp)
+
+(defun maze--cur-end ()
+ (push-mark)
+ (thing-at-point--end-of-sexp)
+ (let ((cur (point)))
+ (goto-char (mark))
+ (pop-mark)
+ cur))
+
+(defun maze--hl (beg end &optional buffer)
+ (let ((overlay (make-overlay beg end (or buffer (current-buffer)))))
+ (overlay-put overlay 'face 'highlight)
+ (setq maze-overlay overlay)
+ overlay))
+
+(defun maze--unhl ()
+ (if maze-overlay
+ (delete-overlay maze-overlay)))
+
+(defun maze--update-hl (beg end)
+ (if maze-overlay
+ (move-overlay maze-overlay beg end)
+ (maze--hl beg end)))
+
+(defun maze-forward (n)
+ (interactive "p")
+ (goto-char (or (scan-sexps (point) 2) (buffer-end 1)))
+ (thing-at-point--beginning-of-sexp)
+ (maze--update-hl (point) (maze--cur-end)))
+
+(defun maze-backward (n)
+ (interactive "p")
+ (let ((n (or n 1)))
+ (backward-sexp n))
+ (maze--update-hl (point) (maze--cur-end)))
+
+(defun maze-inward (n)
+ (interactive "p")
+ (down-list n)
+ (maze--update-hl (point) (maze--cur-end)))
+
+(defun maze-outward (n)
+ (interactive "p")
+ (backward-up-list n)
+ (maze--update-hl (point) (maze--cur-end)))
+
+(defvar-keymap maze-mode-map
+ (kbd "j") 'maze-forward
+ (kbd "k") 'maze-backward
+ (kbd "l") 'maze-inward
+ (kbd "h") 'maze-outward)
+
+
+(define-minor-mode maze-mode
+ "doc"
+ :keymap maze-mode-map
+ :init-value nil
+ :after-hook (progn
+ (setq-local parse-sexp-ignore-comments t)
+ (setq-local maze-overlay nil)
+ (font-lock-mode 1)))
diff --git a/config/emacs/site-lisp/my-eglot.el b/config/emacs/site-lisp/my-eglot.el
new file mode 100644
index 0000000..f4a00a3
--- /dev/null
+++ b/config/emacs/site-lisp/my-eglot.el
@@ -0,0 +1,7 @@
+(use-package eglot
+ :demand t)
+(use-package eglot-tempel
+ :after eglot tempel
+ :config
+ (eglot-tempel-mode 1))
+
diff --git a/config/emacs/site-lisp/my-exwm.el b/config/emacs/site-lisp/my-exwm.el
new file mode 100644
index 0000000..be71f52
--- /dev/null
+++ b/config/emacs/site-lisp/my-exwm.el
@@ -0,0 +1,184 @@
+(use-package exwm ; emacs x window manager
+ :demand nil
+ :config
+ (require 'exwm-randr)
+ (require 'exwm-xim)
+ (require 'exwm-systemtray)
+ (require 'exwm-manage)
+ (add-to-list 'exwm-manage-configurations '((equal exwm-class-name "Slack") managed t))
+ (use-package exwm-modeline)
+ ;;(exwm-xim-mode 1)
+
+ (defun my/exwm-auto-workspace-montior ()
+ "Autopopulate exwm-randr-workspace-monitor-plist and attempt to
+have a workspace on each monitor. Try to keep up with xrandr
+changes."
+ (let ((buf (generate-new-buffer "*xrandr-output*"))
+ (out-plist nil))
+ (call-process-shell-command "xrandr --listmonitors -q" nil buf nil)
+ (with-current-buffer buf
+ (keep-lines "[^[:word:]]connected" (point-min) (point-max) nil)
+ ;; (goto-char (point-min))
+ ;; (while (re-search-forward "^\\([a-zA-Z\\-0-9]+\\) .*$" nil t nil)
+ ;; (replace-match "\\1"))
+ ;; (goto-char (point-min))
+ (let ((num-monitors (count-lines (point-min) (point-max)))
+ (i 0))
+ (setq exwm-workspace-number num-monitors)
+ (goto-char (point-min))
+ (while (< i num-monitors)
+ (move-beginning-of-line 1)
+ (push-mark)
+ (search-forward-regexp " ")
+ (backward-char)
+ (push (buffer-substring (mark) (point)) out-plist)
+ (if (> i 0)
+ (let ((prev (caddr out-plist))
+ (cur (car out-plist)))
+ (call-process-shell-command
+ (format "xrandr --output %s --auto --right-of %s" cur prev)
+ nil nil nil))
+ (call-process-shell-command
+ (format "xrandr --output %s --auto" (car out-plist)) nil nil nil))
+ (push i out-plist)
+ (setq i (+ i 1))
+ (pop-mark)
+ (forward-line))))
+ (kill-buffer buf)
+ (setq exwm-randr-workspace-monitor-plist out-plist))
+ (while (> exwm-workspace-number (length exwm-workspace--list))
+ (exwm-workspace-add)))
+ (add-hook 'exwm-randr-screen-change-hook #'my/exwm-auto-workspace-montior)
+
+ (defun my/exwm-set-buffer-name ()
+ (if exwm-title
+ (let* ((shortened-title (replace-regexp-in-string
+ " - Mozilla Firefox"
+ ""
+ exwm-title))
+ (class-and-title (concat
+ exwm-class-name
+ "<"
+ shortened-title
+ ">")))
+ (setq-local exwm-title class-and-title)
+ (exwm-workspace-rename-buffer exwm-title))))
+
+ (defun my/exwm-other-workspace (arg)
+ "Focus other monitor's workspace."
+ (interactive "p")
+ ;; based on other-frame
+ (let ((filter-f (function (lambda (f)
+ (and (exwm-workspace--active-p f)
+ (not (eq (selected-frame) f))))))
+ (sframe (selected-frame))
+ (frame (selected-frame)))
+ (while (> arg 0)
+ (setq frame (next-frame frame))
+ (while (and (not (eq frame sframe))
+ (not (eq (frame-visible-p frame) t))
+ (funcall filter-f frame))
+ (setq frame (next-frame frame)))
+ (setq arg (1- arg)))
+ (while (< arg 0)
+ (setq frame (previous-frame frame))
+ (while (and (not (eq frame sframe))
+ (not (eq (frame-visible-p frame) t))
+ (filter-f frame))
+ (setq frame (previous-frame frame)))
+ (setq arg (1+ arg)))
+ (exwm-workspace-switch frame)))
+
+ (defun my/dmenu (command)
+ (interactive (list (read-shell-command "$ ")))
+ (start-process-shell-command command nil command))
+
+ (defun my/browser ()
+ (interactive)
+ (start-process-shell-command "glide" nil "glide"))
+
+ (defun my/brightnessdown () (interactive) (start-process "" nil "brightnessdown"))
+ (defun my/brightnessup () (interactive) (start-process "" nil "brightnessup"))
+ (defun my/mute () (interactive) (start-process "" nil "pactl" "set-sink-mute" "@DEFAULT_SINK@" "toggle"))
+ (defun my/voldown () (interactive) (start-process "" nil "pactl" "set-sink-volume" "@DEFAULT_SINK@" "-5%"))
+ (defun my/volup () (interactive) (start-process "" nil "pactl" "set-sink-volume" "@DEFAULT_SINK@" "+5%"))
+
+ (push ?\C-\\ exwm-input-prefix-keys) ;;C-\ to switch input method
+ (push ?\C-u exwm-input-prefix-keys) ;; send C-u to all windows too
+ (push ?\M-L exwm-input-prefix-keys)
+ (progn
+ ;; (exwm-enable)
+ ;; (exwm-randr-mode)
+ ;; (ednc-mode 1)
+ ;; (exwm-systemtray-mode)
+ ;; (add-hook 'after-init-hook #'exwm-randr-refresh)
+ )
+ :hook
+ (exwm-update-class . my/exwm-set-buffer-name)
+ (exwm-update-title . my/exwm-set-buffer-name)
+ ;; (after-init . exwm-randr-refresh)
+ ;; (after-init . display-time-mode)
+ ;; (after-init . ednc-mode)
+ ;; (after-init . display-battery-mode)
+ :custom
+ (exwm-replace nil)
+ (exwm-title-length 50)
+ (exwm-workspace-show-all-buffers t)
+ (exwm-layout-show-all-buffers t)
+
+ (exwm-modeline-randr t)
+ (exwm-modeline-short nil)
+ (exwm-modeline-urgent t)
+
+ (exwm-manage-force-tiling t)
+
+ (exwm-input-global-keys
+ `(
+ ([?\M-r] . exwm-reset)
+ ;; Bind "s-w" to window switcher
+ ([?\M-W] . consult-buffer)
+ ([?\M-o] . other-window)
+ ([?\M-O] . my/exwm-other-workspace)
+
+ ([?\M-D] . my/dmenu)
+ ([?\M-E] . my/browser)
+ (,(kbd "M-C-m") . my/eshell)
+ ([?\M-K] . kill-current-buffer)
+
+ ,@(mapcar (lambda (n)
+ (let* ((from (concat "C-x " (format "%d" n)))
+ (to (concat "M-" (format "%d" n)))
+ (bind (keymap-lookup global-map from)))
+ (cons (kbd to) bind)))
+ (number-sequence 0 9))
+
+ ([XF86MonBrightnessDown] . my/brightnessdown)
+ ([XF86MonBrightnessUp] . my/brightnessup)
+ ([XF86AudioMute] . my/mute)
+ ([XF86AudioLowerVolume] . my/voldown)
+ ([XF86AudioRaiseVolume] . my/volup)))
+ (exwm-input-simulation-keys
+ '(;; movement
+ ([?\C-b] . [left])
+ ([?\M-b] . [C-left])
+ ([?\C-f] . [right])
+ ([?\M-f] . [C-right])
+ ([?\C-p] . [up])
+ ([?\C-n] . [down])
+ ([?\C-a] . [home])
+ ([?\C-e] . [end])
+ ([?\M-v] . [prior])
+ ([?\C-v] . [next])
+ ;; edit, copy, paste
+ ([?\C-d] . [delete])
+ ([?\C-k] . [S-end delete])
+ ([M-backspace] . [C-backspace])
+ ([?\M-w] . [?\C-c])
+ ([?\C-y] . [?\C-v])
+ ([?\C-s] . [?\C-f])))
+ (exwm-input-move-event 'M-down-mouse-1)
+ (exwm-input-resize-event 'M-down-mouse-3)
+ :bind (:map exwm-mode-map
+ ("C-q" . 'exwm-input-send-next-key)
+ ("M-!" . 'shell-command)))
+
diff --git a/config/emacs/site-lisp/my-mail.el b/config/emacs/site-lisp/my-mail.el
new file mode 100644
index 0000000..bcda232
--- /dev/null
+++ b/config/emacs/site-lisp/my-mail.el
@@ -0,0 +1,52 @@
+(use-package mu4e
+ :ensure nil
+ :demand nil
+ :init
+ ;; assumed Maildir layout
+ ;; ~/Maildir/Account0/{Inbox,Sent,Trash}
+ ;; ~/Maildir/Account1/{Inbox,Sent,Trash}
+ ;; where Account0 is context name
+ (defun my/make-mu4e-context (context-name full-name mail-address signature)
+ "Return a mu4e context named CONTEXT-NAME with :match-func matching
+ folder name CONTEXT-NAME in Maildir. The context's `user-mail-address',
+ `user-full-name' and `mu4e-compose-signature' is set to MAIL-ADDRESS
+ FULL-NAME and SIGNATURE respectively.
+ Special folders are set to context specific folders."
+ (let ((dir-name (concat "/" context-name)))
+ (make-mu4e-context
+ :name context-name
+ ;; we match based on the maildir of the message
+ ;; this matches maildir /Arkham and its sub-directories
+ :match-func
+ `(lambda (msg)
+ (when msg
+ (string-match-p
+ ,(concat "^" dir-name)
+ (mu4e-message-field msg :maildir))))
+ :vars
+ `((user-mail-address . ,mail-address)
+ (user-full-name . ,full-name)
+ (mu4e-sent-folder . ,(concat dir-name "/sent"))
+ (mu4e-drafts-folder . ,(concat dir-name "/drafts"))
+ (mu4e-trash-folder . ,(concat dir-name "/trash"))
+ (mu4e-refile-folder . ,(concat dir-name "/archive"))
+ (mu4e-compose-signature . ,signature)))))
+ :custom
+ (mu4e-change-filenames-when-moving t)
+ (mu4e-get-mail-command "mbsync --all")
+ :config
+ ;;Fixing duplicate UID errors when using mbsync and mu4e
+ (setq mu4e-contexts
+ `(,(my/make-mu4e-context
+ "thomasmulmer02" "Thomas Ulmer"
+ "thomasmulmer02@gmail.com" "Thanks,
+Thomas Ulmer")))
+
+ (require 'smtpmail)
+ (setq message-send-mail-function 'smtpmail-send-it)
+ (setq smtpmail-default-smtp-server "smtp.gmail.com"
+ smtpmail-smtp-server "smtp.gmail.com"
+ smtpmail-smtp-service 587
+ starttls-use-gnutls t
+ smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
+ smtp-auth-credentials (expand-file-name "~/.authinfo.gpg")))
diff --git a/config/emacs/site-lisp/my-modal.el b/config/emacs/site-lisp/my-modal.el
new file mode 100644
index 0000000..1803609
--- /dev/null
+++ b/config/emacs/site-lisp/my-modal.el
@@ -0,0 +1,212 @@
+;;; bespoke vish modal -*- lexical-binding: t; -*-
+
+(require 's)
+
+
+(defun do-nothing () (interactive))
+
+(defun yank-looks-like-lines ()
+ (s-contains? "
+" (current-kill 0 t)))
+
+(defun paste-after-maybe-lines ()
+ (interactive)
+ (if (yank-looks-like-lines)
+ (progn
+ (move-end-of-line nil)
+ (newline)
+ (yank))
+ (forward-char-unless-eol)
+ (yank)))
+
+(defun paste-before-maybe-lines ()
+ (interactive)
+ (if (yank-looks-like-lines)
+ (progn
+ (move-beginning-of-line nil)
+ (yank))
+ (yank)))
+
+(defun forward-char-unless-eol (&optional arg)
+ (interactive "P")
+ (when (< (point) (point-at-eol)) (forward-char arg)))
+
+(defun mark-end-of-line (&optional arg)
+ (interactive "P")
+ (push-mark)
+ (move-end-of-line arg)
+ (exchange-point-and-mark))
+
+(defun mark-beginning-of-line (&optional arg)
+ (interactive "P")
+ (push-mark)
+ (move-beginning-of-line arg)
+ (exchange-point-and-mark))
+
+;; what I really want is a meta operator to invert the arg count,
+;; but between how ryo calls functions and expects symbols in binds,
+;; this is the best I can do.
+(defun mark-word-backward (&optional arg allow-extend)
+ (interactive "P\np")
+ (cond
+ ((null arg)
+ (setq arg -1))
+ ((numberp arg)
+ (setq arg (* -1 arg))))
+ (mark-word arg allow-extend))
+
+(defun mark-sexp-backward (&optional arg allow-extend)
+ (interactive "P\np")
+ (cond
+ ((null arg)
+ (setq arg -1))
+ ((numberp arg)
+ (setq arg (* -1 arg))))
+ (mark-sexp arg allow-extend))
+
+(defun mark-defun-backward (&optional arg interactive)
+ (interactive "p\nd")
+ (cond
+ ((null arg)
+ (setq arg -1))
+ ((numberp arg)
+ (setq arg (* -1 arg))))
+ (mark-defun arg interactive))
+
+(defun mark-paragraph-backward (&optional arg allow-extend)
+ (interactive "P\np")
+ (cond
+ ((null arg)
+ (setq arg -1))
+ ((numberp arg)
+ (setq arg (* -1 arg))))
+ (mark-paragraph arg allow-extend))
+
+(defconst my/ryo-digits '(("1" "C-1" :norepeat t)
+ ("2" "C-2" :norepeat t)
+ ("3" "C-3" :norepeat t)
+ ("4" "C-4" :norepeat t)
+ ("5" "C-5" :norepeat t)
+ ("6" "C-6" :norepeat t)
+ ("7" "C-7" :norepeat t)
+ ("8" "C-8" :norepeat t)
+ ("9" "C-9" :norepeat t)))
+
+(defconst my/ryo-moves '(("h" backward-char)
+ ("j" next-line)
+ ("k" previous-line)
+ ("l" forward-char)
+
+ ("e" forward-word)
+ ("b" backward-word)
+ ("E" forward-sexp)
+ ("B" backward-sexp)
+
+ ("0" "C-a")
+ ("$" "C-e")
+
+ ("[" beginning-of-defun)
+ ("]" end-of-defun)
+ ("{" backward-paragraph)
+ ("}" forward-paragraph)
+ ))
+
+(defconst my/ryo-marking-moves '(("h" backward-char :first (push-mark-command))
+ ("j" next-line :first (push-mark-command))
+ ("k" previous-line :first (push-mark-command))
+ ("l" forward-char :first (push-mark-command))
+
+ ("b" mark-word-backward)
+ ("e" mark-word)
+ ("B" mark-sexp-backward)
+ ("E" mark-sexp)
+
+ ("[" mark-defun-backward)
+ ("]" mark-defun)
+
+ ("0" mark-beginning-of-line)
+ ("$" mark-end-of-line)
+
+ ("{" mark-paragraph-backward)
+ ("}" mark-paragraph)
+ ))
+
+(defconst my/ryo-no-ops '(
+ "<escape>"
+ "`" "-" "+"
+ "q" "w" "r" "t" "\\"
+ "s" "f" ";" "'"
+ "z" "n" "m" "," "."
+
+ "~" "!" "@" "#" "%" "^" "&" "*" "(" ")" "_" "+"
+ "Q" "W" "R" "T" "Y" "U" "|"
+ "S" "D" "F" "H" "J" "K" "L" ":" "\""
+ "Z" "X" "C" "V" "N" "M" "<" ">"
+ ))
+
+
+
+(use-package ryo-modal
+ :demand t
+ :bind (:map my/keys-mode-map
+ ("C-c C-<space>" . ryo-modal-mode))
+ :config
+ (define-minor-mode my/temp-nonmodal-mode
+ "Minor mode for a temporary exit that should return to ryo-modal-mode."
+ :keymap (define-keymap
+ "<escape>"
+ 'my/temp-nonmodal-mode)
+ :lighter " <NM>"
+ (ryo-modal-mode (if my/temp-nonmodal-mode -1 1)))
+
+ (let* ()
+ (eval
+ `(ryo-modal-keys
+ ,@my/ryo-moves
+ ,@my/ryo-digits
+ ,@(mapcar (lambda (key) (list key 'do-nothing)) my/ryo-no-ops)
+ ("g" (("g" beginning-of-buffer)))
+ ("G" end-of-buffer)
+
+ ("i" my/temp-nonmodal-mode)
+ ("I" back-to-indentation :then '(my/temp-nonmodal-mode))
+ ("a" forward-char-unless-eol :then '(my/temp-nonmodal-mode))
+ ("A" move-end-of-line :then '(my/temp-nonmodal-mode))
+ ("o" move-end-of-line :then '(newline-and-indent my/temp-nonmodal-mode))
+ ("O" move-beginning-of-line
+ :then '(open-line indent-according-to-mode my/temp-nonmodal-mode))
+
+ ("x" delete-char)
+ ("d" (("d" kill-whole-line)
+ ("m" kill-region)))
+ ("d" ,my/ryo-marking-moves :then '(kill-region))
+
+ ("c" (("c" kill-whole-line))
+ :then '(open-line my/temp-nonmodal-mode))
+ ("c" (("m" kill-region))
+ :then '(my/temp-nonmodal-mode))
+ ("C" kill-line :then '(my/temp-nonmodal-mode))
+ ("c" ,my/ryo-marking-moves :then '(kill-region my/temp-nonmodal-mode))
+
+ ("y" (("m" copy-region-as-kill)))
+ ("y" (("y" copy-region-as-kill))
+ :first '(push-mark move-beginning-of-line push-mark move-end-of-line forward-char)
+ :then '(pop-mark pop-to-mark-command))
+
+ ("P" paste-before-maybe-lines)
+ ("p" paste-after-maybe-lines)
+
+ ("/" isearch-forward-regexp)
+ ("?" isearch-backward-regexp)
+
+ ("u" undo)
+
+ ("SPC" set-mark-command)
+ ("v" set-mark-command)
+ )))
+ (setq ryo-modal-cursor-color "aquamarine")
+ (defun ryo-modal-unless-minibuffer ()
+ (unless (minibufferp)
+ (ryo-modal-mode 1)))
+ ;; (add-hook 'after-change-major-mode-hook 'ryo-modal-unless-minibuffer)
+ )
diff --git a/config/emacs/site-lisp/single-header.el b/config/emacs/site-lisp/single-header.el
new file mode 100755
index 0000000..dc65335
--- /dev/null
+++ b/config/emacs/site-lisp/single-header.el
@@ -0,0 +1,257 @@
+;; single-header --- Display a topline inside each frame with global info -*- lexical-binding: t; -*-
+
+;; Author: Thomas Ulmer
+;; Package-Requires: ((ednc) (battery) (s) (dash))
+;; Package-Version 1.0
+
+(require 'battery)
+(require 's)
+(require 'dash)
+
+(use-package ednc ; make emacs a dbus notify reciever
+ )
+
+;;; Commentary:
+;;;
+
+;;; Code:
+
+;; testing
+;; (require 'notifications)
+;; (notifications-notify :title "2st test" :body "hello, world" :app-name "EDNC"
+;; :actions '("default" "default"))
+
+(defgroup single-header
+ '((single-header-face custom-face)
+ (single-header-update-increment custom-variable))
+ "Custom variables for the single header package."
+ :prefix "single-header"
+ :group 'emacs)
+(defface single-header-face
+ '((default . (:background "#000000" :family "Source Code Pro")))
+ "Base face for the header line."
+ :group 'single-header)
+(defcustom single-header-update-increment
+ 3
+ "Number of seconds before updating the header again."
+ :type 'natnum
+ :group 'single-header)
+(defvar single-header--active-notifs nil)
+(defvar single-header--timer nil)
+
+(defmacro single-header--time-lock (force frame name &rest body)
+ ""
+ (let* ((last-t-str (concat name "--last-time"))
+ (last-t (or (intern-soft last-t-str) (make-symbol last-t-str))))
+ ;; cache contains the symol of the cache variable
+ ;; last-t contains the symbol of the last time it was evaluated
+ `(if force
+ (progn
+ (set-frame-parameter ,frame (quote ,last-t) (time-convert (current-time) 'integer))
+ ,@body)
+ (let ((cur-time (time-convert (current-time) 'integer))
+ (next-time (time-add (or (frame-parameter ,frame (quote ,last-t)) 0)
+ single-header-update-increment)))
+ (when (time-less-p next-time cur-time)
+ (progn
+ (set-frame-parameter ,frame (quote ,last-t) cur-time)
+ ,@body))))))
+
+(defun single-header--with-face (str &rest face-plist)
+ "Convenience wrapper for `add-face-text-property'."
+ (add-face-text-property 0 (length str) face-plist t str)
+ str)
+
+(defun single-header--register-notif-change (old new)
+ "Function to hook `ednc-notification-presentation-functions'."
+ (when new
+ (push new single-header--active-notifs))
+ (when (and old
+ (member old single-header--active-notifs))
+ (setq single-header--active-notifs
+ (remove old single-header--active-notifs)))
+ (when (or new old)
+ (single-header-update t)))
+
+(defun single-header--make-notif-string ()
+ "Produce a string representation of the active notifications."
+ (mapconcat (lambda (e)
+ (format "[%s | %s | %s] "
+ (s-truncate 8 (ednc-notification-app-name e))
+ (s-truncate 8 (ednc-notification-summary e))
+ (s-truncate 20 (ednc-notification-body e)))
+ )
+ (ednc-notifications)
+ ""))
+
+(defun single-header-dismiss (num)
+ "Dismiss the most recent notification from the header line. With a prefix
+arg, dismiss all the notifications."
+ (interactive "p")
+ (cond ((and (natnump num) (>= num 4))
+ (mapc 'ednc-dismiss-notification (ednc-notifications)))
+ (t
+ (let ((notifs (ednc-notifications)))
+ (when notifs
+ (ednc-dismiss-notification (car notifs))))))
+ (single-header-update t))
+
+(defun single-header--make-header-info-string ()
+ "Generates the mode line string that contains all the info to the right."
+ (let ((str (concat
+ (single-header--with-face (battery-format "[%b%p%%] " (and battery-status-function (funcall battery-status-function)))
+ :weight 'bold)
+ (single-header--with-face (let* ((mi (memory-info))
+ (tm (float (car mi)))
+ (fm (float (cadr mi)))
+ (ts (float (caddr mi)))
+ (fs (float (cadddr mi))))
+ (format "{%.2f %.2f} " (- 1 (/ fm tm)) (- 1 (/ fs ts))))
+ :foreground "#00ced1")
+ (single-header--with-face (format "<%03.2f> " (car (load-average 1)))
+ :foreground "#da70d6")
+ (format-time-string "%a, %b %+4Y-%0m-%0d ")
+ (single-header--with-face (format-time-string "%R")
+ :weight 'bold)
+ )))
+ (single-header--with-face str 'single-header-face)))
+
+(defun single-header--init-buffer (buf)
+ (with-current-buffer buf
+ (insert "header test")
+ (jit-lock-mode nil)
+ (font-lock-mode -1)
+ (buffer-disable-undo)
+ (setq-local mode-line-format nil)
+ (setq-local header-line-format nil)
+ (setq-local cursor-type nil)
+ (setq-local cursor-in-non-selected-windows nil)
+ (setq-local overflow-newline-into-fringe nil)
+ (setq-local word-wrap nil)
+ (setq-local show-trailing-whitespace nil)))
+
+(defun single-header--init-window (win)
+ (with-selected-window win
+ (set-window-dedicated-p win t)
+ (set-window-parameter win 'no-other-window t)
+ (set-window-parameter win 'no-delete-other-windows t)
+ (set-window-margins win 0 0)
+ (set-window-fringes win 0 0)
+ (set-window-scroll-bars win 0 nil 0 nil)
+ (setq-local window-min-height 1)
+ (setq-local window-safe-min-height 1)
+ (let
+ (window-size-fixed)
+ (fit-window-to-buffer win 1))
+ (setq-local window-size-fixed t)
+ (when
+ (fboundp 'window-preserve-size)
+ (window-preserve-size win nil t))))
+
+(defun single-header--init-frame (&optional frame)
+ (setq frame (or frame (selected-frame)))
+ (with-selected-frame frame
+ (let* ((buf (generate-new-buffer "*header*"))
+ (win (display-buffer-in-side-window buf '((side . top)
+ (slot . -100)))))
+ (single-header--init-buffer buf)
+ (single-header--init-window win)
+ (set-frame-parameter frame 'single-header-buf buf)
+ (set-frame-parameter frame 'single-header-win win))))
+
+(defun single-header-update (&optional force)
+ ""
+ (mapc (lambda (f) (single-header-update-frame f force))
+ (visible-frame-list)))
+
+(defun single-header-format (frame win buf)
+ "Evaluated in the header buffer when empty to fill the buffer."
+ (let* ((win-width (window-max-chars-per-line win 'single-header-face))
+ (info (single-header--make-header-info-string))
+ (info-width (string-width info))
+ (notifs (s-truncate (- win-width info-width 2)
+ (single-header--make-notif-string)))
+ (notifs-width (string-width notifs))
+ (filled (min win-width (+ info-width notifs-width)))
+ (padding-width (- win-width filled))
+ (padding (make-string padding-width ? )))
+ (setq notifs (single-header--with-face notifs 'single-header-face))
+ (setq padding (single-header--with-face padding 'single-header-face))
+ (setq info (single-header--with-face info 'single-header-face))
+ (concat notifs padding info)))
+
+(defun single-header-update-frame (frame &optional force)
+ ""
+ (with-selected-frame frame
+ (let ((buf (frame-parameter frame 'single-header-buf))
+ (win (frame-parameter frame 'single-header-win)))
+ (when (and buf win)
+ (with-current-buffer buf
+ (single-header--time-lock
+ force frame "header-lock"
+ (let ((str (single-header-format frame win buf)))
+ (erase-buffer)
+ (insert str))))))))
+
+(defun single-header-make ()
+ "Create the header and show it."
+ (let ((registered
+ (or (equal 'single-header--register-notif-change
+ ednc-notification-presentation-functions)
+ (and (listp ednc-notification-presentation-functions)
+ (-contains? ednc-notification-presentation-functions
+ 'single-header--register-notif-change)))))
+ (unless registered
+ (if (listp ednc-notification-presentation-functions)
+ (push 'single-header--register-notif-change
+ ednc-notification-presentation-functions)
+ (list 'single-header--register-notif-change
+ ednc-notification-presentation-functions))))
+ (mapc (lambda (f)
+ (when (frame-live-p f)
+ (single-header--init-frame f)))
+ (frame-list))
+ ;; TODO frame creation hook
+ (add-hook 'after-make-frame-functions #'single-header--init-frame)
+ (when single-header--timer
+ (cancel-timer single-header--timer))
+ (setq single-header--timer
+ (run-with-timer 0 single-header-update-increment 'single-header-update)))
+
+(defun single-header-delete ()
+ "Remove an existing header buffer."
+ (let ((reg-list (and (listp ednc-notification-presentation-functions)
+ (-contains? ednc-notification-presentation-functions
+ 'single-header--register-notif-change)))
+ (reg-equal (or (equal 'single-header--register-notif-change
+ ednc-notification-presentation-functions))))
+ (when reg-list
+ (delete 'single-header--register-notif-change
+ ednc-notification-presentation-functions))
+ (when reg-equal
+ (setq ednc-notification-presentation-functions
+ 'ednc--update-log-buffer)))
+ (cancel-timer single-header--timer)
+ (setq single-header--timer nil)
+ (remove-hook 'after-make-frame-functions 'single-header--init-frame)
+ (mapc (lambda (f)
+ (delete-window (frame-parameter f 'single-header-win))
+ (kill-buffer (frame-parameter f 'single-header-buf))
+ (set-frame-parameter f 'single-header-buf nil)
+ (set-frame-parameter f 'single-header-win nil))
+ (frame-list)))
+
+(define-minor-mode single-header-mode
+ "Global minor mode to enable a single info line at the top of each frame."
+ :group 'single-header
+ :global t
+ :init-value nil
+ :keymap `((,(kbd "M-L d") . single-header-dismiss)
+ (,(kbd "M-L t") . single-header-mode))
+ :interactive t
+ (if (not single-header-mode)
+ (single-header-delete)
+ (single-header-make)))
+
+(provide 'single-header)
+;;; single-header.el ends here
diff --git a/config/emacs/site-lisp/tex-conf.el b/config/emacs/site-lisp/tex-conf.el
new file mode 100644
index 0000000..4592ce5
--- /dev/null
+++ b/config/emacs/site-lisp/tex-conf.el
@@ -0,0 +1,47 @@
+;; latex stuff
+(require 'tex-mode)
+(define-key latex-mode-map (kbd "C-c m") (lambda () (interactive)
+ (push-mark)
+ (insert "\\[\n\n\\]")
+ (indent-region (mark) (point))
+ (pop-mark)
+ (previous-line)
+ (indent-for-tab-command)
+ ))
+
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; ;;;;;;;;;;;;;;;; LaTeX ;;;;;;;;;;;;;;;;;
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; ##### Don't forget to configure
+;; ##### Okular to use emacs in
+;; ##### "Configuration/Configure Okular/Editor"
+;; ##### => Editor => Emacsclient. (you should see
+;; ##### emacsclient -a emacs --no-wait +%l %f
+;; ##### in the field "Command".
+
+(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
+(setq reftex-plug-into-AUCTeX t)
+
+;; ##### Always ask for the master file
+;; ##### when creating a new TeX file.
+(setq-default TeX-master nil)
+
+;; ##### Enable synctex correlation. From Okular just press
+;; ##### Shift + Left click to go to the good line.
+(setq TeX-source-correlate-mode t
+ TeX-source-correlate-start-server t)
+
+;; ### Set Okular as the default PDF viewer.
+(eval-after-load "tex"
+ '(setcar (cdr (assoc 'output-pdf TeX-view-program-selection)) "Okular"))
+
+(add-hook 'tex-mode-hook (lambda ()
+ (setq spell-fu-faces-exclude
+ '(tex-math
+ font-lock-builtin-face
+ font-lock-keyword-face
+ font-lock-function-name-face
+ font-lock-variable-name-face
+ font-latex-sedate-face))
+ (outline-minor-mode 1)))
diff --git a/config/emacs/site-lisp/tmu-custom-theme.el b/config/emacs/site-lisp/tmu-custom-theme.el
new file mode 100755
index 0000000..965d7c8
--- /dev/null
+++ b/config/emacs/site-lisp/tmu-custom-theme.el
@@ -0,0 +1,67 @@
+;; -*- lexical-binding: t; -*-
+(provide 'tmu-custom-theme)
+
+(deftheme tmu-custom
+ "Created 2023-01-06.")
+
+(custom-theme-set-faces
+ 'tmu-custom
+ '(cursor ((((background light)) (:background "black")) (((background dark)) (:background "white"))))
+ '(fixed-pitch ((t (:family "Monospace"))))
+ '(variable-pitch ((((type w32)) (:foundry "outline" :family "Arial")) (t (:family "Sans Serif"))))
+ '(escape-glyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown"))))
+ '(homoglyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown"))))
+ '(minibuffer-prompt ((t (:weight bold :box (:line-width (1 . -1) :color "red" :style released-button) :foreground "white smoke" :background "royal blue"))))
+ '(highlight ((t (:background "gray30"))))
+ '(region ((t (:extend t :background "SeaGreen4"))))
+ '(shadow ((((class color grayscale) (min-colors 88) (background light)) (:foreground "grey50")) (((class color grayscale) (min-colors 88) (background dark)) (:foreground "grey70")) (((class color) (min-colors 8) (background light)) (:foreground "green")) (((class color) (min-colors 8) (background dark)) (:foreground "yellow"))))
+ '(secondary-selection ((t (:extend t :foreground "#f6f3e8" :background "#333366"))))
+ '(trailing-whitespace ((((class color) (background light)) (:background "red1")) (((class color) (background dark)) (:background "red1")) (t (:inverse-video t))))
+ '(font-lock-bracket-face ((t (:inherit (font-lock-punctuation-face)))))
+ '(font-lock-builtin-face ((t (:foreground "chartreuse2"))))
+ '(font-lock-comment-delimiter-face ((default (:inherit (font-lock-comment-face)))))
+ '(font-lock-comment-face ((t (:foreground "orchid2"))))
+ '(font-lock-constant-face ((t (:foreground "maroon1"))))
+ '(font-lock-delimiter-face ((t (:inherit (font-lock-punctuation-face)))))
+ '(font-lock-doc-face ((t (:foreground "indian red"))))
+ '(font-lock-doc-markup-face ((t (:inherit (font-lock-constant-face)))))
+ '(font-lock-escape-face ((t (:inherit (font-lock-regexp-grouping-backslash)))))
+ '(font-lock-function-name-face ((t (:foreground "spring green"))))
+ '(font-lock-keyword-face ((t (:weight bold :foreground "light sea green"))))
+ '(font-lock-negation-char-face ((t nil)))
+ '(font-lock-number-face ((t nil)))
+ '(font-lock-misc-punctuation-face ((t (:inherit (font-lock-punctuation-face)))))
+ '(font-lock-operator-face ((t nil)))
+ '(font-lock-preprocessor-face ((t (:foreground "cornflower blue"))))
+ '(font-lock-property-face ((t (:inherit (font-lock-variable-name-face)))))
+ '(font-lock-punctuation-face ((t nil)))
+ '(font-lock-regexp-grouping-backslash ((t (:inherit (bold)))))
+ '(font-lock-regexp-grouping-construct ((t (:inherit (bold)))))
+ '(font-lock-string-face ((t (:foreground "Skyblue1"))))
+ '(font-lock-type-face ((t (:foreground "medium purple"))))
+ '(font-lock-variable-name-face ((t (:foreground "PaleGreen2"))))
+ '(font-lock-warning-face ((t (:weight bold :foreground "hot pink"))))
+ '(button ((t (:inherit (link)))))
+ '(link ((((class color) (min-colors 88) (background light)) (:underline t)) (((class color) (background light)) (:underline t)) (((class color) (min-colors 88) (background dark)) (:underline t)) (((class color) (background dark)) (:underline t))))
+ '(link-visited ((default (:inherit (link))) (((class color) (background light)) (:foreground "magenta4")) (((class color) (background dark)) (:foreground "violet"))))
+ '(fringe ((((class color) (background light)) (:background "grey95")) (((class color) (background dark)) (:background "grey10")) (t (:background "gray"))))
+ '(header-line ((t (:inherit mode-line))))
+ '(tooltip ((((class color)) (:inherit (variable-pitch) :foreground "black" :background "lightyellow")) (t (:inherit (variable-pitch)))))
+ '(mode-line ((t (:background "black" :family "DejaVu Sans"))))
+ '(mode-line-buffer-id ((t (:weight bold))))
+ '(mode-line-emphasis ((t (:weight bold))))
+ '(mode-line-highlight ((((supports :box t) (class color) (min-colors 88)) (:box (:line-width (2 . 2) :color "grey40" :style released-button))) (t (:inherit (highlight)))))
+ '(mode-line-inactive ((t (:inherit mode-line :foreground "dark gray"))))
+ '(isearch ((((class color) (min-colors 88) (background light)) (:foreground "lightskyblue1" :background "magenta3")) (((class color) (min-colors 88) (background dark)) (:foreground "brown4" :background "palevioletred2")) (((class color) (min-colors 16)) (:foreground "cyan1" :background "magenta4")) (((class color) (min-colors 8)) (:foreground "cyan1" :background "magenta4")) (t (:inverse-video t))))
+ '(isearch-fail ((((class color) (min-colors 88) (background light)) (:background "RosyBrown1")) (((class color) (min-colors 88) (background dark)) (:background "red4")) (((class color) (min-colors 16)) (:background "red")) (((class color) (min-colors 8)) (:background "red")) (((class color grayscale)) (:foreground "grey")) (t (:inverse-video t))))
+ '(lazy-highlight ((((class color) (min-colors 88) (background light)) (:distant-foreground "black" :background "paleturquoise")) (((class color) (min-colors 88) (background dark)) (:distant-foreground "white" :background "paleturquoise4")) (((class color) (min-colors 16)) (:distant-foreground "white" :background "turquoise3")) (((class color) (min-colors 8)) (:distant-foreground "white" :background "turquoise3")) (t (:underline t))))
+ '(match ((((class color) (min-colors 88) (background light)) (:background "khaki1")) (((class color) (min-colors 88) (background dark)) (:background "RoyalBlue3")) (((class color) (min-colors 8) (background light)) (:foreground "black" :background "yellow")) (((class color) (min-colors 8) (background dark)) (:foreground "white" :background "blue")) (((type tty) (class mono)) (:inverse-video t)) (t (:background "gray"))))
+ '(next-error ((t (:inherit (region)))))
+ '(query-replace ((t (:inherit (isearch)))))
+ '(default ((t (:family "Source Code Pro" :foundry "ADBO" :width normal :height 98 :weight regular :slant normal :underline nil :overline nil :extend nil :strike-through nil :box nil :inverse-video nil :foreground "white smoke" :background "gray10" :stipple nil :inherit nil))))
+ '(frog-menu-posframe-background-face ((t (:background "RoyalBlue4"))))
+ '(minibuffer-prompt ((t (:background "gray10" :foreground "cyan" :box nil :weight bold))))
+ '(pyim-page ((t (:inherit default :background "#333333" :foreground "#dcdccc"))))
+ '(vterm-color-blue ((t (:inherit ansi-color-bright-green)))))
+
+(provide-theme 'tmu-custom)
diff --git a/config/emacs/splashLaputa.png b/config/emacs/splashLaputa.png
new file mode 100644
index 0000000..4b5de18
--- /dev/null
+++ b/config/emacs/splashLaputa.png
Binary files differ
diff --git a/config/emacs/templates/c.eld b/config/emacs/templates/c.eld
new file mode 100644
index 0000000..fdb899f
--- /dev/null
+++ b/config/emacs/templates/c.eld
@@ -0,0 +1,5 @@
+
+c-mode
+
+(for > "for (" p "; " p "; " p ") {" n> (p "body;") n> "}")
+(fori > "for (int i = 0; i < " p "; ++i) {" n> (p "body;") n> "}")
diff --git a/config/emacs/viper b/config/emacs/viper
new file mode 100644
index 0000000..feadc7d
--- /dev/null
+++ b/config/emacs/viper
@@ -0,0 +1 @@
+(setq viper-inhibit-startup-message 't)