summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emacs/init.el1356
-rwxr-xr-xemacs/site-lisp/coding-config.el130
-rw-r--r--emacs/site-lisp/evil-config.el80
-rw-r--r--emacs/site-lisp/exwm-pref.el318
-rw-r--r--emacs/site-lisp/general-text.el32
-rw-r--r--emacs/site-lisp/irc-config.el24
-rw-r--r--emacs/site-lisp/modeline-config.el39
-rw-r--r--emacs/site-lisp/my-binds.el24
-rw-r--r--emacs/site-lisp/my-funcs.el164
-rwxr-xr-xemacs/site-lisp/single-header.el171
10 files changed, 1134 insertions, 1204 deletions
diff --git a/emacs/init.el b/emacs/init.el
index de8b776..3024828 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -1,228 +1,174 @@
-;;; -*- LEXICAL-binding: t -*-
+;; -*- lexical-binding: t; -*-
-(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 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\ 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
- '("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))
- '(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))
-
-;; ---------------------------------------------------------------------
-;; non-package specific config
+(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)))))
-;; performance stuff
-(setq gc-cons-threshold most-positive-fixnum)
-(add-hook 'emacs-startup-hook
- (lambda ()
- (setq gc-cons-threshold (expt 2 23))))
-
-;; allow using emacsclient
-(require 'server)
-(unless (server-running-p) (server-start))
-
-;; buffer preferences
-(with-current-buffer "*scratch*" (emacs-lock-mode 'kill))
-(setq kill-buffer-query-functions
- (delq 'process-kill-buffer-query-function kill-buffer-query-functions))
-;; don't ask about killing buffers
-(setq confirm-kill-processes nil)
-;; don't ask about kill processes
-
-
-(setq async-shell-command-buffer 'new-buffer)
-;; start additional async shell commands in new buffers without asking
-(setq-default proced-auto-update-flag t)
-(setq-default proced-auto-update-interval 1)
-;; always auto update proced
-
-;; this is to avoid loading evil entirely, and ease some of the
-;; internconnection complexity of the config
-(setq want-evil nil)
-
-;; --------------------------------------------------------------------
-;; external packages
-
-;; enable external packages
(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)
-;; (setq use-package-always-demand t)
(use-package benchmark-init
:config
;; To disable collection of benchmark data after init is done.
(add-hook 'after-init-hook 'benchmark-init/deactivate))
-(use-package vertico
- ;; better minibuffer complete
- :init
- (vertico-mode)
+(defun 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))))
+
+(defun 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 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 wrap-sexp (&optional arg)
+ "Wraps the following sexp in a pair of parens.
+Places inside the new pair, with prefix arg do the same backwards, pushing the
+mark. Does the same of ARG number sexps if given"
+ (interactive "p")
+ (message "%s" arg)
+ (if arg
+ (progn
+ (push-mark)
+ (insert-pair arg ?\( ?\)))
+ (insert-pair 1 ?\( ?\))))
+
+(defun close-or-kill ()
+ "If this is the sole frame, kill emacs. Otherwise close the frame."
+ (interactive)
+ (if (eq 1 (length (frame-list)))
+ ;; sole frame, exit
+ (save-buffers-kill-terminal)
+ (delete-frame)))
+
+(defun my/toggle-window-other-reachability ()
+ (interactive)
+ (let* ((win (get-buffer-window (current-buffer)))
+ (current (window-parameter win 'no-other-window)))
+ (set-window-parameter win 'no-other-window (not current))))
+
+(defun my/clean-prog-file (buffer)
+ "Fixes whitespace in buffer"
+ (save-excursion
+ (with-current-buffer buffer
+ (untabify (point-min) (point-max))
+ (goto-char (point-min))
+ (while (re-search-forward " +$" nil t)
+ (replace-match "" nil nil)))))
+
+(defun open-window-by-buffer (buffer)
+ "Move focus to an extant window by the buffer it contains."
+ (interactive "bBuffer: ")
+ (let ((win (get-buffer-window buffer t)))
+ (if win
+ (select-window win)
+ (switch-to-buffer buffer))))
+
+(defun shorten-path (path)
+ "Shortens each directory in PATH except for the last directory to its
+first character."
+ (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 swap-other-window-buffer ()
+ "Try to switch the buffer contents of the current window and the next in
+the cyclic ordering. Don't involve 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)))))))
+
+(use-package server ; allow emacsclient
+ :demand t
+ :config
+ (unless (server-running-p) (server-start)))
+
+(use-package proced ; process editor
+ :commands (proced)
+ :config
+ ;; always auto update proced
+ (setq-default proced-auto-update-flag t)
+ (setq-default proced-auto-update-interval 1))
+
+(use-package orderless ; ordering (minibuffer) completions
+ :demand t
+ :custom
+ ;; (orderless-skip-highlighting t)
+ (completion-styles '(orderless basic))
+ (orderless-matching-styles
+ '(orderless-prefixes orderless-initialism orderless-literal orderless-regexp)))
+
+(use-package vertico ; better minibuffer complete
+ :demand t
+ :custom
+ (vertico-cycle t)
+ :config
;; (vertico-flat-mode)
- (setq vertico-cycle t))
+ (vertico-mode 1))
-(use-package marginalia
- :init
- (marginalia-mode)
- (keymap-set minibuffer-local-map "M-A" 'marginalia-cycle)
+(use-package marginalia ; more info in minibuffer menus
+ :demand t
:custom
(marginalia-max-relative-age 0)
- (marginalia-align 'right))
+ (marginalia-align 'right)
+ :bind (:map minibuffer-local-map
+ ("M-A" . 'marginalia-cycle))
+ :config
+ (marginalia-mode))
-(use-package embark
+(use-package embark ; more actions from minibuffer
+ :demand t
:bind
- (("C-." . embark-act) ;; pick some comfortable binding
- ("C-," . embark-dwim) ;; good alternative: M-.
- ("C-h B" . embark-bindings) ;; alternative for `describe-bindings'
- )
- :init
- ;; (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
+ (("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
@@ -230,100 +176,96 @@
nil
(window-parameters (mode-line-format . none)))))
-(use-package orderless
- ;; ordering (minibuffer) completions
+(use-package corfu ; in buffer completion
+ :demand t
:custom
- (completion-styles '(orderless basic))
- (orderless-matching-styles '(orderless-prefixes orderless-initialism orderless-literal orderless-regexp))
- ;; (orderless-skip-highlighting t)
- )
-
-(use-package corfu
- ;; in buffer completion
+ (corfu-cycle t)
+ (corfu-quit-no-match t)
+ :bind (("M-/" . completion-at-point))
:init
- (global-corfu-mode 1)
(defun corfu-commit-single ()
"Complete without asking if there is only one candidate."
(when (and (corfu--popup-visible-p)
(= (length corfu--candidates) 1))
(corfu-accept)))
- (add-hook 'corfu-post-command-hook 'corfu-commit-single)
- :custom
- (corfu-cycle t)
- (corfu-quit-no-match t)
- :bind (("M-/" . completion-at-point)))
+ :hook (corfu-post-command . corfu-commit-single)
+ :config
+ (global-corfu-mode 1))
-(use-package corfu-terminal
- :init
- (corfu-terminal-mode 1)
+(use-package corfu-terminal ; make corfu work on terminals
+ :demand t
:custom
- (corfu-terminal-disable-on-gui nil))
+ (corfu-terminal-disable-on-gui nil)
+ :config
+ (corfu-terminal-mode 1))
-(use-package cape
- ;; extend completion frameworks
+(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)
- :init
- (setq completion-at-point-functions '(tags-completion-at-point-function
- cape-keyword
- cape-dabbrev
- cape-symbol
- cape-dict)))
-
-(use-package dabbrev
- :bind (("C-M-/" . dabbrev-expand))
+ (setq-default completion-at-point-functions
+ (apply 'cape-wrap-super
+ (append
+ '(tags-completion-at-point-function cape-dabbrev cape-dict)
+ completion-at-point-functions))))
+
+(use-package dabbrev ; dynamic abbreviations
+ :demand t
:config
(add-to-list 'dabbrev-ignored-buffer-regexps "\\` ")
- ;; Since 29.1, use `dabbrev-ignored-buffer-regexps' on older.
(add-to-list 'dabbrev-ignored-buffer-modes 'doc-view-mode)
(add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode)
(add-to-list 'dabbrev-ignored-buffer-modes 'tags-table-mode))
-(use-package tempel
- :after (cape)
- :custom
- (tempel-path "~/.emacs.d/templates/*.eld")
- ;; (tempel-trigger-prefix "<")
+;; TODO debug / test
+;; (use-package tempel
+;; :after (cape)
+;; :custom
+;; (tempel-path "~/.emacs.d/templates/*.eld")
+;; ;; (tempel-trigger-prefix "<")
- :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand
- ("M-*" . tempel-insert))
+;; :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand
+;; ("M-*" . tempel-insert))
- :config
- ;; Setup completion at point
- (defun tempel-setup-capf ()
- ;; Add the Tempel Capf to `completion-at-point-functions'.
- ;; `tempel-expand' only triggers on exact matches. Alternatively use
- ;; `tempel-complete' if you want to see all matches, but then you
- ;; should also configure `tempel-trigger-prefix', such that Tempel
- ;; does not trigger too often when you don't expect it. NOTE: We add
- ;; `tempel-expand' *before* the main programming mode Capf, such
- ;; that it will be tried first.
- (setq-local completion-at-point-functions
- (cons #'tempel-expand
- completion-at-point-functions)))
-
- (add-hook 'conf-mode-hook 'tempel-setup-capf)
- (add-hook 'prog-mode-hook 'tempel-setup-capf)
- (add-hook 'text-mode-hook 'tempel-setup-capf)
-
- ;; Optionally make the Tempel templates available to Abbrev,
- ;; either locally or globally. `expand-abbrev' is bound to C-x '.
- ;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode)
- ;; (global-tempel-abbrev-mode)
- )
+;; :config
+;; ;; Setup completion at point
+;; (defun tempel-setup-capf ()
+;; ;; Add the Tempel Capf to `completion-at-point-functions'.
+;; ;; `tempel-expand' only triggers on exact matches. Alternatively use
+;; ;; `tempel-complete' if you want to see all matches, but then you
+;; ;; should also configure `tempel-trigger-prefix', such that Tempel
+;; ;; does not trigger too often when you don't expect it. NOTE: We add
+;; ;; `tempel-expand' *before* the main programming mode Capf, such
+;; ;; that it will be tried first.
+;; (setq-local completion-at-point-functions
+;; (cons #'tempel-expand
+;; completion-at-point-functions)))
+
+;; (add-hook 'conf-mode-hook 'tempel-setup-capf)
+;; (add-hook 'prog-mode-hook 'tempel-setup-capf)
+;; (add-hook 'text-mode-hook 'tempel-setup-capf)
+
+;; ;; Optionally make the Tempel templates available to Abbrev,
+;; ;; either locally or globally. `expand-abbrev' is bound to C-x '.
+;; ;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode)
+;; ;; (global-tempel-abbrev-mode)
+;; )
;; (use-package tempel-collection
;; :after tempel)
-(use-package magit)
+(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 which-key
- :init
- (which-key-mode))
-
-(use-package ibuffer
+(use-package ibuffer ; give a nice list of buffers with extra info
+ :commands (ibuffer)
:custom
(ibuffer-formats
'((mark modified read-only " "
@@ -337,100 +279,657 @@
(name 16 -1)
" " filename)))
:bind
- ("C-x C-b" . ibuffer)
+ ("C-x C-b" . ibuffer))
+
+(use-package ibuffer-vc ; group buffers by vcs directory
+ :after ibuffer
+ :demand t
:hook
- (ibuffer . (lambda ()
- (unless (eq ibuffer-sorting-mode 'alphabetic)
- (ibuffer-do-sort-by-alphabetic)))))
+ (ibuffer .
+ (lambda ()
+ (ibuffer-vc-set-filter-groups-by-vc-root)
+ (unless (eq ibuffer-sorting-mode 'alphabetic)
+ (ibuffer-do-sort-by-alphabetic)))))
-(use-package buffer-move
- :bind ("C-x -" . buf-move-right))
+(use-package magit)
-(use-package winum
- :init
+(use-package free-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 consult
- :custom (consult-preview-excluded-buffers t)
- :bind (("C-x b" . consult-buffer)))
+(use-package recentf
+ :config
+ (recentf-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-S-w" . consult-buffer)
+ ("C-S-y" . consult-yank-from-kill-ring)
+ ("M-g M-g" . consult-goto-line)
+ ("M-i" . consult-imenu-multi)
+ ("C-s" . consult-line)
+ ("C-S-s" . consult-line-multi)
+ ("M-s g" . consult-grep)
+ ("M-s G" . grep)
+ ("M-s f" . consult-find))
+(use-package embark-consult
+ :after embark consult)
+
+(use-package hl-todo ; highlight certain keywords
+ :hook
+ (prog-mode . hl-todo-mode))
-;; (use-package beacon
-;; :init
-;; (beacon-mode 1)
-;; (push 'vterm-mode beacon-dont-blink-major-modes))
+(use-package hl-line ; make it easier to find your point
+ ;; TODO this doesn't work with buffers created after enabled
+ :bind ("M-s h SPC" . global-hl-line-mode))
-(use-package visible-mark
- :init
- (global-visible-mark-mode 1)
- (set-face-attribute 'visible-mark-active nil
- :foreground 'unspecified
- :background 'unspecified
- :box '(:line-width (-1 . -1)
- :color "deep pink"
- :style nil))
+(use-package visible-mark ; make the mark visible
+ ;; TODO make the attr list display dependent
+ :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
- :bind (("C-'" . avy-goto-char-2)))
+(use-package avy ; goto location by char pair and jump list
+ :bind (("C-'" . avy-goto-char-2)
+ ("M-G" . avy-goto-char-2)))
-(use-package balanced-windows
+(use-package balanced-windows ; auto rebalance windows
:bind ("C-x w b" . balanced-windows-mode))
-;; eshell stuff
-(use-package eshell
- :init
+(use-package eshell ; emacs shell
+ :demand t
+ :config
(use-package esh-help)
- (setup-esh-help-eldoc)
(require 'em-hist)
(require 'em-term)
- (keymap-set eshell-hist-mode-map "C-p" 'eshell-previous-input)
- (keymap-set eshell-hist-mode-map "C-n" 'eshell-next-input)
- (keymap-set eshell-hist-mode-map "C-c C-n" 'next-line)
- (keymap-set eshell-hist-mode-map "C-c C-p" 'previous-line)
- (keymap-set eshell-mode-map "C-l" 'eshell/clear)
- (add-hook 'eshell-mode-hook 'eldoc-mode)
- (if want-evil
- (add-hook 'eshell-mode-hook (lambda () (evil-local-mode -1)))))
+ (setup-esh-help-eldoc)
+ ;; (keymap-set eshell-hist-mode-map "C-p" 'eshell-previous-input)
+ ;; (keymap-set eshell-hist-mode-map "C-n" 'eshell-next-input)
+ ;; (keymap-set eshell-hist-mode-map "C-c C-n" 'next-line)
+ ;; (keymap-set eshell-hist-mode-map "C-c C-p" 'previous-line)
+ :bind (:map eshell-mode-map
+ ("C-l" . eshell/clear))
+ :hook (eshell-mode . eldoc-mode))
(use-package vterm)
-(use-package eat
- :init
+(use-package shelldon
+ :demand t
+ :config
+ ;; (setf shell-command-switch "-ic")
+ (setf enable-recursive-minibuffers t)
+
+ ;; command codes -> ansi colors in emacs
+ (add-hook 'shelldon-mode-hook 'ansi-color-for-comint-mode-on)
+ (add-to-list 'comint-output-filter-functions 'ansi-color-process-output)
+ (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
+
+ (add-to-list 'display-buffer-alist
+ '("*shelldon:"
+ (display-buffer-reuse-window display-buffer-in-previous-window display-buffer-in-side-window display-buffer-pop-up-window)
+ (side . right)
+ (slot . 0)
+ (window-width . 80)))
+ :bind
+ ("M-&" . 'shelldon)
+ ("M-*" . 'shelldon-loop))
+
+(use-package eat ; terminal override to make eshell behave better
+ :demand t
+ :config
(eat-eshell-mode)
(eat-eshell-visual-command-mode))
-(use-package hl-todo)
+(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))
-;; file browser
-(use-package treemacs
+(use-package bash-completion
+ :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 treemacs ; file explorer
:bind (("C-c t" . treemacs)))
-;; password integration
-(use-package password-store)
-(use-package auth-source-pass
- :init (auth-source-pass-enable))
-(use-package pass
+(use-package pass ; password integration
+ :demand t
+ :init
+ (use-package password-store)
+ (use-package auth-source-pass :init (auth-source-pass-enable))
:custom
- (pass-supress-confirmations t))
-(setq epg-pinentry-mode 'loopback)
+ (pass-suppress-confirmations t)
+ (epg-pinentry-mode 'loopback)
+ :config
+ (push '("\\*Password-Store\\*"
+ display-buffer-in-side-window
+ (side . right))
+ display-buffer-alist))
-;; make tramp not prompt for autosaving root owned files
-(setq tramp-allow-unsafe-temporary-files t)
+(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 . generate-asm-label-tags))
+
+(use-package lsp-mode
+ :commands (lsp)
+ :init
+ (use-package lsp-haskell))
+
+(use-package pyvenv)
+
+(use-package sideline ; put warnings on the side of the same line
+ :init
+ (use-package sideline-flycheck)
+ (use-package sideline-flymake)
+ (use-package sideline-lsp)
+ :custom
+ (sideline-backends-right '(sideline-flycheck sideline-flymake sideline-lsp)))
+
+(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 ; 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-set-column)
+ ;; ^ never gonna use but whatever
+ )
+
+(use-package imenu ; jump to items in the current buffer
+ :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 ediff
+ :custom
+ (ediff-window-setup-function 'ediff-setup-windows-plain))
+
+(use-package fold-this ; fold arbitrary region
+ :init
+ (define-prefix-command 'fold-map)
+ (global-set-key (kbd "M-F") 'fold-map)
+ (define-keymap :full nil
+ :parent nil
+ :suppress nil
+ :keymap nil
+ :name "fold-map"
+ :prefix 'fold-map
+ (kbd "c") 'fold-this
+ (kbd "e") 'fold-this-unfold-at-point
+ (kbd "t") 'hs-toggle-hiding
+ (kbd "f") 'fold-this-fold-forward
+ (kbd "b") 'fold-this-fold-backward
+ (kbd "l") 'hs-hide-level)
+ :config
+ (defun 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 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)))
+
+(progn ; hide-show: fold regions based on mode/programming language
+ (require 'hideshow)
+ (add-hook 'prog-mode-hook 'hs-minor-mode))
+
+(add-hook 'prog-mode-hook (lambda ()
+ (superword-mode 1)
+ (modify-syntax-entry ?_ "w")
+
+ (display-fill-column-indicator-mode 1)
+ (add-hook 'before-save-hook
+ (lambda ()
+ (if (not (eq major-mode 'makefile-gmake-mode))
+ (my/clean-prog-file (current-buffer)))))))
+
+(use-package haskell-mode
+ :custom
+ (haskell-tags-on-save t)
+ (haskell-process-type 'cabal-repl)
+ :hook
+ (haskell-mode . interactive-haskell-mode))
+(use-package ocp-indent)
+(let ((opam-share (ignore-errors (car (process-lines "opam" "var" "share")))))
+ (when (and opam-share (file-directory-p opam-share))
+ ;; Register Merlin
+ (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
+ (autoload 'merlin-mode "merlin" nil t nil)
+ ;; Automatically start it in OCaml buffers
+ (add-hook 'tuareg-mode-hook 'merlin-mode t)
+ (add-hook 'caml-mode-hook 'merlin-mode t)
+ ;; Use opam switch to lookup ocamlmerlin binary
+ (setq merlin-command 'opam)
+ ;; To easily change opam switches within a given Emacs session, you can
+ ;; install the minor mode https://github.com/ProofGeneral/opam-switch-mode
+ ;; and use one of its "OPSW" menus.
+ ))
+(use-package racket-mode)
+(use-package rustic)
+(progn ; elisp
+ (keymap-set emacs-lisp-mode-map "C-c r" 'raise-sexp))
+
+(use-package compile
+ :custom
+ (compilation-always-kill t)
+ (compilation-scroll-output t)
+ :bind
+ ("M-M" . 'recompile)
+ :config
+ ;; Allow compilation buffer to be dedicated across frames
+ (push '("\\*compilation\\*" . (nil (reusable-frames . t))) display-buffer-alist))
+
+;; (use-package evil
+;; :demand nil
+;; :custom
+;; (evil-want-keybinding nil)
+;; (evil-want-integration t)
+;; :config
+;; (use-package evil-collection
+;; :config (evil-collection-init))
+;; (use-package evil-easymotion
+;; :config (evilem-default-keybindings "SPC"))
+;; (use-package evil-surround
+;; :config (global-evil-surround-mode 1))
+;; (use-package evil-snipe
+;; :custom (evil-snipe-scope 'buffer)
+;; :config
+;; (evil-snipe-mode 1)
+;; (evil-snipe-override-mode 1)
+;; :bind
+;; (:map evil-snipe-local-mode-map
+;; ("z" . 'evil-snipe-s)
+;; ("Z" . 'evil-snipe-S)))
+;; (use-package treemacs-evil)
+;; :hook
+;; (eshell-mode-hook . (lambda () (evil-local-mode -1)))
+;; (vterm-mode-hook . (lambda () (evil-local-mode -1)))
+;; :bind
+;; (:map evil-insert-state-map
+;; ("C-d" . 'delete-char)
+;; ("C-e" . 'move-end-of-line)
+;; ("C-a" . 'move-beginning-of-line)
+;; ("C-t" . 'transpose-chars))
+;; (:map evil-normal-state-map
+;; ("M-." . 'xref-find-definitions)
+;; ("M-Z" . 'suspend-frame)
+;; ("C-t" . 'transpose-chars))
+;; (:map evil-motion-state-map
+;; ("TAB" . 'indent-for-tab-command)))
+
+(use-package exwm ; emacs x window manager
+ :demand t
+ :config
+ (require 'exwm-randr)
+ (require 'exwm-xim)
+ (require 'exwm-systemtray)
+ (require 'exwm-manage)
+ (use-package exwm-modeline)
+ ;;(exwm-xim-mode 1)
+
+ ;; auto-populate workspace-monitor-plist
+ (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)
+ ;; (message (buffer-substring (point-min) (point-max)))
+ (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)
+ (message "iter")
+ (move-beginning-of-line 1)
+ (push-mark)
+ (search-forward-regexp " ")
+ (backward-char)
+ (message (buffer-substring (mark) (point)))
+ (push (buffer-substring (mark) (point)) out-plist)
+ (push i out-plist)
+ (setq i (+ i 1))
+ (pop-mark)
+ (next-line))))
+ (kill-buffer buf)
+ (setq exwm-randr-workspace-monitor-plist out-plist))
+
+ (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-assign-workspace (index)
+ "switch to workspace without changing monitor"
+ (interactive "p")
+ (let* ((current-index exwm-workspace-current-index)
+ (current-monitor (plist-get exwm-randr-workspace-monitor-plist current-index))
+ (displaced-monitor (plist-get exwm-randr-workspace-monitor-plist index)))
+ ;; if not associated, copy current association
+ (unless displaced-monitor (setq displaced-monitor current-monitor))
+ ;; swapping prevents a monitor losing all of its associations
+ (plist-put exwm-randr-workspace-monitor-plist current-index displaced-monitor)
+ (plist-put exwm-randr-workspace-monitor-plist index current-monitor)
+ (exwm-workspace-switch-create index)
+ (exwm-randr-refresh)))
+
+ (defun my/exwm-other-assigned-workspace ()
+ "focus other monitor's workspace. Assumes 2 monitors"
+ (interactive)
+ ;; super hacky, assumes that there are only two active workspaces
+ (exwm-workspace-switch-create (exwm-workspace--workspace-from-frame-or-index
+ (let* ((workspace-list (seq-filter 'exwm-workspace--active-p exwm-workspace--list))
+ (active-workspaces workspace-list))
+ (while (not (eq (car active-workspaces) (selected-frame)))
+ (setq active-workspaces (cdr active-workspaces)))
+ (setq active-workspaces (cdr active-workspaces))
+ (if (eq active-workspaces nil)
+ (car workspace-list)
+ (car active-workspaces))))))
+
+ (defun my/dmenu (command)
+ (interactive (list (read-shell-command "$ ")))
+ (start-process-shell-command command nil command))
+
+ (defun my/browser ()
+ (interactive)
+ (start-process-shell-command "firefox" nil "firefox"))
+
+ (exwm-randr-mode)
+ (exwm-systemtray-mode)
+ (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
+ (setq exwm-marked-buffer "*scratch*") ;; store the buffer we were at before a jump
+ (when (equal window-system 'x)
+ (exwm-enable))
+ :hook
+ (exwm-update-class . my/exwm-set-buffer-name)
+ (exwm-update-title . my/exwm-set-buffer-name)
+ :custom
+ (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)
+
+ ;;fast workspace switch
+ ([?\M-O] . exwm-other-assigned-workspace)
+
+ ([?\M-D] . my/dmenu)
+ ([?\M-E] . my/browser)
+ ([M-return] . eshell)
+ ))
+ (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])
+ ([?\C-d] . [delete])
+ ([?\C-k] . [S-end delete])
+ ;; cut/paste.
+ ;; ([?\C-w] . [?\C-x])
+ ([?\M-w] . [?\C-c])
+ ([?\C-y] . [?\C-v])
+ ([?\C-s] . [?\C-f])))
+ :bind (:map exwm-mode-map
+ ("C-q" . 'exwm-input-send-next-key)
+ ("M-!" . 'shell-command)))
+
+(progn ; media/function keys
+ ;; requires some custom shell scripts not included in my emacs config
+ (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%"))
+
+ (global-set-key (kbd "<XF86MonBrightnessDown>") 'my/brightnessdown)
+ (global-set-key (kbd "<XF86MonBrightnessUp>") 'my/brightnessup)
+ (global-set-key (kbd "<XF86AudioMute>") 'my/mute)
+ (global-set-key (kbd "<XF86AudioLowerVolume>") 'my/voldown)
+ (global-set-key (kbd "<XF86AudioRaiseVolume>") 'my/volup)
+
+ (define-key exwm-mode-map (kbd "<XF86MonBrightnessDown>") 'my/brightnessdown)
+ (define-key exwm-mode-map (kbd "<XF86MonBrightnessUp>") 'my/brightnessup)
+ (define-key exwm-mode-map (kbd "<XF86AudioMute>") 'my/mute)
+ (define-key exwm-mode-map (kbd "<XF86AudioLowerVolume>") 'my/voldown)
+ (define-key exwm-mode-map (kbd "<XF86AudioRaiseVolume>") 'my/volup))
+
+(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" "#emacs-social" "#linux" "#archlinux" "#haskell" "#invidious" "#duskos")))
+
+ (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))
+
+(progn ; indent code when pasting, from
+ ;; https://trey-jackson.blogspot.com/2008/03/emacs-tip-15-indent-yanked-code.html
+ ;; automatically indenting yanked text if in programming-modes
+ (defvar yank-indent-modes '(emacs-lisp-mode
+ c-mode c++-mode
+ tcl-mode sql-mode
+ perl-mode cperl-mode
+ java-mode jde-mode
+ lisp-interaction-mode
+ LaTeX-mode TeX-mode
+ rust-mode
+ rustic-mode)
+ "Modes in which to indent regions that are yanked (or yank-popped).")
+
+ (defun yank-advised-indent-function (beg end)
+ "Do indentation, as long as the region isn't too large.
+BEG and END define the region."
+ (indent-region beg end nil))
+
+ (defadvice yank (after yank-indent activate)
+ "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)."
+ (if (and (not (ad-get-arg 0))
+ (member major-mode yank-indent-modes))
+ (let ((transient-mark-mode nil))
+ (yank-advised-indent-function (region-beginning) (region-end)))))
+
+ (defadvice yank-pop (after yank-pop-indent activate)
+ "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)."
+ (if (and (not (ad-get-arg 0))
+ (member major-mode yank-indent-modes))
+ (let ((transient-mark-mode nil))
+ (yank-advised-indent-function (region-beginning) (region-end))))))
+
+(use-package minions
+ :demand t
+ :config
+ (minions-mode 1)
+ :custom
+ (minions-prominent-modes '(persp-mode auto-fill-mode eldoc-mode eglot-mode lsp-mode)))
+
+(progn ; default modeline config additions
+ (setq-default global-mode-string
+ '("" (:eval (let ((str (concat (format " [%s] " (shorten-path default-directory)))))
+ (add-face-text-property
+ 0 (length str)
+ '(:weight bold :foreground "green2")
+ t str)
+ str)))))
+
+(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)
+ ;; start additional async shell commands in new buffers without asking
+ (setq async-shell-command-buffer 'new-buffer))
+
+(use-package ispell ; spellchecker
+ :custom
+ (ispell-personal-dictionary "/home/tmu/.aspell.en.pws")
+ :hook
+ (text-mode . 'ispell-minor-mode))
+
+(electric-pair-mode 1)
+
+;; (setq x-super-keysym 'meta)
+
+(global-set-key (kbd "C-x C-C") 'save-buffers-kill-terminal)
+(global-set-key (kbd "C-x C-c") 'close-or-kill)
+(global-set-key (kbd "M-w") 'copy-region-as-kill) ; make copying not flash cursor
+(global-set-key (kbd "C-x -") 'swap-other-window-buffer)
+(global-set-key (kbd "M-(") 'wrap-region-paren)
+(global-set-key (kbd "M-z") 'zap-whitespace)
+(global-set-key (kbd "C-M-z") 'wrap-sexp)
+(global-set-key (kbd "M-o") 'other-window)
+(global-set-key (kbd "M-c") 'calc)
+(global-set-key (kbd "M-U") 'scroll-lock-mode)
+(global-set-key (kbd "M-Q") 'auto-fill-mode)
+
+(global-set-key (kbd "C-x w o") 'my/toggle-window-other-reachability)
+
+(use-package ednc ; notifications, required for single-header
+ )
+
+(progn ; single header line per frame w/ info
+ ;; after exwm
+ (require 'single-header)
+ (single-header-mode 1)
+ (keymap-global-set "M-L d" 'single-header-dismiss)
+ (keymap-global-set "M-L h" 'single-header-delete)
+ (keymap-global-set "M-L m" 'single-header-make)
+ )
-;; ----------------------------------------------------------------------
-;; my custom stuff
-
-(if want-evil (require 'evil-config))
-(require 'my-funcs)
-(require 'my-binds)
-(require 'coding-config)
-(require 'modeline-config)
-(require 'general-text)
-(require 'single-header)
-(require 'exwm-pref)
-(require 'irc-config)
;; ----------------------------------------------------------------------
;; theme stuff
@@ -439,27 +938,182 @@
(push "~/.emacs.d/site-lisp/" custom-theme-load-path)
(load-theme 'tmu-custom t)
-;; 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*"
- (iimage-mode 1))))
-
;; ----------------------------------------------------------------------
;; 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)
-(load-theme 'tmu-custom t)
+(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
+ '("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
+ '(balanced-windows bash-completion benchmark-init cape consult
+ corfu-terminal counsel-embark eat ednc embark
+ embark-consult embark-counsel esh-help
+ evil-collection evil-easymotion evil-snipe
+ evil-surround exwm-modeline fold-this free-keys
+ haskell-mode hl-todo ibuffer-vc lsp-haskell
+ magit marginalia minions ocp-indent orderless
+ pass pyvenv racket-mode rustic sdcv shelldon
+ sideline-flycheck sideline-flymake sideline-lsp
+ treemacs-evil vertico visible-mark vterm winum))
+ '(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.
diff --git a/emacs/site-lisp/coding-config.el b/emacs/site-lisp/coding-config.el
deleted file mode 100755
index edf252f..0000000
--- a/emacs/site-lisp/coding-config.el
+++ /dev/null
@@ -1,130 +0,0 @@
-;;; The config specifically for editing code
-
-(provide 'coding-config)
-
-;; (add-hook 'xref-backend-functions 'gxref-xref-backend)
-
-;; 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-set-column) ;never gonna use but whatever
-
-(setq asm-comment-char ?#) ; prefer # over ; for asm comments
-
-;; generate tags for label names in asm files, based on asm files in the current directory
-(add-hook 'asm-mode-hook
- (lambda ()
- (add-hook 'after-save-hook
- (lambda ()
- (shell-command
- "find . -iregex '.*\\.[sS]' -exec etags -l none -r '/\\([a-zA-Z0-9\\-_]+\\):/\1/' {} +"))
- 0 t)))
-
-(use-package lsp-mode)
-
-(use-package lsp-haskell)
-
-(use-package pyvenv)
-
-(use-package sideline
- :init
- (setq sideline-backends-right '()))
-(use-package sideline-flycheck
- :init
- (push 'sideline-flycheck sideline-backends-right))
-(use-package sideline-flymake
- :init
- (push 'sideline-flymake sideline-backends-right))
-(use-package sideline-lsp
- :init
- (push 'sideline-lsp sideline-backends-right))
-
-(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)))
- (add-hook 'prog-mode-hook (lambda () flycheck-mode 1)))
-
-;; Find defs in various ways
-(global-set-key (kbd "M-i") 'imenu)
-(global-set-key (kbd "M-I") 'xref-find-definitions)
-
-(setq imenu-auto-rescan t)
-(setq imenu-flatten t)
-
-;; make shells and whatnot slightly better
-(require 'comint)
-(setq comint-scroll-to-bottom-on-input t)
-(setq comint-scroll-to-bottom-on-output t)
-
-;; ediff
-(setq ediff-window-setup-function 'ediff-setup-windows-plain)
-
-;; various folding types and binds
-;;(autoload 'hide-lines "hide-lines" "Hide lines based on a regexp" t)
-;;(global-set-key (kbd "C-c /") 'hide-lines)
-(use-package fold-this
- :init
- (define-prefix-command 'fold-map)
- (global-set-key (kbd "M-F") 'fold-map)
- (define-keymap :full nil
- :parent nil
- :suppress nil
- :keymap nil
- :name "fold-map"
- :prefix 'fold-map
- (kbd "c") 'fold-this
- (kbd "e") 'fold-this-unfold-at-point
- (kbd "t") 'hs-toggle-hiding
- (kbd "f") 'fold-this-fold-forward
- (kbd "b") 'fold-this-fold-backward
- (kbd "l") 'hs-hide-level))
-
-;; global prog stuff that differs from global/text
-(require 'my-funcs)
-(add-hook 'prog-mode-hook (lambda ()
- (hs-minor-mode 1)
- (hl-todo-mode 1)
- (superword-mode 1)
- (modify-syntax-entry ?_ "w")
-
- (display-fill-column-indicator-mode 1)
- (add-hook 'before-save-hook
- (lambda ()
- (if (not (eq major-mode 'makefile-gmake-mode))
- (clean-prog-file (current-buffer)))))))
-
-;; haskell flavor and tags
-(use-package haskell-mode
- :custom
- (haskell-tags-on-save t)
- (haskell-process-type 'cabal-repl)
- :hook
- (haskell-mode . (lambda ()
- ;; (hindent-mode 1)
- (interactive-haskell-mode 1))))
-
-(global-set-key (kbd "M-m") 'goto-next-locus)
-(global-set-key (kbd "M-M") 'recompile)
-(setq compilation-always-kill t
- compilation-scroll-output t)
-;; Allow compilation buffer to be dedicated across frames
-(push '("\\*compilation\\*" . (nil (reusable-frames . t))) display-buffer-alist)
-
-;; better searching
-(use-package swiper)
-(use-package counsel)
-(use-package ivy)
-(setq counsel-grep-base-command
- "rg -i -M 120 --no-heading --line-number --color never '%s' %s")
-(global-set-key (kbd "C-s") 'counsel-grep-or-swiper)
-(global-set-key (kbd "C-S-s") 'isearch-forward)
-
-;; racket
-(use-package racket-mode)
-
-;; rust
-(use-package rustic)
diff --git a/emacs/site-lisp/evil-config.el b/emacs/site-lisp/evil-config.el
deleted file mode 100644
index 38db735..0000000
--- a/emacs/site-lisp/evil-config.el
+++ /dev/null
@@ -1,80 +0,0 @@
-;;; evil config
-(provide 'evil-config)
-
-(use-package evil
- :custom
- (evil-want-keybinding nil)
- (evil-want-integration t)
- :init
- (evil-mode 1))
-(use-package evil-collection
- :init
- (evil-collection-init))
-(use-package evil-easymotion
- :init
- (evilem-default-keybindings "SPC"))
-(use-package evil-surround
- :config
- (global-evil-surround-mode 1))
-(use-package evil-snipe
- :config
- (evil-snipe-mode 1)
- (evil-snipe-override-mode 1)
- (evil-define-key 'visual evil-snipe-local-mode-map "z" 'evil-snipe-s)
- (evil-define-key 'visual evil-snipe-local-mode-map "Z" 'evil-snipe-S)
- :custom
- (evil-snipe-scope 'buffer))
-(define-key evil-insert-state-map (kbd "C-d") 'delete-char)
-(define-key evil-insert-state-map (kbd "C-e") 'move-end-of-line)
-(define-key evil-insert-state-map (kbd "C-a") 'move-beginning-of-line)
-(define-key evil-normal-state-map (kbd "M-.") 'xref-find-definitions)
-(define-key evil-normal-state-map (kbd "M-Z") 'suspend-frame)
-
-(use-package treemacs-evil)
-
-(define-key evil-motion-state-map (kbd "TAB") 'indent-for-tab-command)
-(evil-set-initial-state 'vterm-mode 'emacs)
-(evil-set-initial-state 'eshell-mode 'emacs)
-
-;;; sasha bindings
-(defun evil-window-split-and-switch ()
- "Split the window vertically and switch to the new buffer."
- (interactive)
- (evil-window-split)
- (other-window 1))
-
-(defun evil-window-vsplit-and-switch ()
- "Split the window horizontally and switch to the new buffer."
- (interactive)
- (evil-window-vsplit)
- (other-window 1))
-
-(define-key evil-insert-state-map (kbd "C-t") 'transpose-chars)
-(define-key evil-normal-state-map (kbd "C-t") 'transpose-chars)
-(evil-define-key 'normal global-map (kbd "SPC i") 'imenu)
-(evil-define-key 'normal global-map (kbd "SPC o") 'other-window)
-(evil-define-key 'normal global-map (kbd "SPC q") 'kill-current-buffer)
-(evil-define-key 'normal global-map (kbd "SPC RET") 'vterm)
-(evil-define-key 'normal global-map (kbd "SPC v") 'vterm)
-(evil-define-key 'normal global-map (kbd "SPC !") 'abort-recursive-edit)
-(evil-define-key 'normal global-map (kbd "SPC f f") 'find-file)
-
-(evil-define-key 'normal global-map (kbd "SPC SPC SPC j") 'evil-window-split-and-switch)
-(evil-define-key 'normal global-map (kbd "SPC SPC SPC k") 'evil-window-split-and-switch)
-(evil-define-key 'normal global-map (kbd "SPC SPC SPC h") 'evil-window-vsplit-and-switch)
-(evil-define-key 'normal global-map (kbd "SPC SPC SPC l") 'evil-window-vsplit-and-switch)
-(evil-define-key 'normal global-map (kbd "SPC SPC h") 'evil-window-left)
-(evil-define-key 'normal global-map (kbd "SPC SPC j") 'evil-window-down)
-(evil-define-key 'normal global-map (kbd "SPC SPC k") 'evil-window-up)
-(evil-define-key 'normal global-map (kbd "SPC SPC l") 'evil-window-right)
-(evil-define-key 'normal global-map (kbd "M-h") 'evil-window-left)
-(evil-define-key 'normal global-map (kbd "M-j") 'evil-window-down)
-(evil-define-key 'normal global-map (kbd "M-k") 'evil-window-up)
-(evil-define-key 'normal global-map (kbd "M-l") 'evil-window-right)
-(evil-define-key 'normal global-map (kbd "SPC SPC w") 'delete-window)
-(evil-define-key 'normal global-map (kbd "SPC SPC q") 'delete-window)
-(evil-define-key 'normal global-map (kbd "SPC SPC b") 'balance-windows)
-(evil-define-key 'normal global-map (kbd "SPC s s") 'save-buffer)
-(evil-define-key 'normal global-map (kbd "SPC s f") 'counsel-find-file)
-(evil-define-key 'normal global-map (kbd "SPC s r") 'counsel-rg)
-(evil-define-key 'normal global-map (kbd "SPC ;") 'frog-jump-buffer)
diff --git a/emacs/site-lisp/exwm-pref.el b/emacs/site-lisp/exwm-pref.el
deleted file mode 100644
index d955e50..0000000
--- a/emacs/site-lisp/exwm-pref.el
+++ /dev/null
@@ -1,318 +0,0 @@
-;;; My full EXWM config
-(provide 'exwm-pref)
-
-;; stuff for exwm
-(use-package exwm)
-(require 'exwm-randr)
-(require 'exwm-xim)
-(require 'exwm-systemtray)
-(require 'exwm-manage)
-
-(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)
- (message (buffer-substring (point-min) (point-max)))
- (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)
- (message "iter")
- (move-beginning-of-line 1)
- (push-mark)
- (search-forward-regexp " ")
- (backward-char)
- (message (buffer-substring (mark) (point)))
- (push (buffer-substring (mark) (point)) out-plist)
- (push i out-plist)
- (setq i (+ i 1))
- (pop-mark)
- (next-line))))
- (kill-buffer buf)
- (setq exwm-randr-workspace-monitor-plist out-plist))
-
-;; (setq exwm-workspace-number 2)
-;; (setq exwm-randr-workspace-monitor-plist '(0 "DP-0" 1 "HDMI-0"))
-(setq exwm-workspace-show-all-buffers t)
-(setq exwm-layout-show-all-buffers t)
-
-(use-package exwm-modeline)
-(setq exwm-modeline-randr t)
-(setq exwm-modeline-short nil)
-(setq exwm-modeline-urgent t)
-;; (add-hook 'exwm-init-hook (lambda () (exwm-modeline-mode 1)))
-
-;; (require exwm-firefox-evil)
-;; (require 'exwm-firefox)
-;; (exwm-firefox-mode)
-
-(setq exwm-title-length 50)
-
-(setq exwm-manage-force-tiling t)
-
-
-(defun b3n-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))))
-
-(add-hook 'exwm-update-class-hook 'b3n-exwm-set-buffer-name)
-(add-hook 'exwm-update-title-hook 'b3n-exwm-set-buffer-name)
-
-(defun exwm-assign-workspace (index)
- "switch to workspace without changing monitor"
- (interactive "p")
- (let* ((current-index exwm-workspace-current-index)
- (current-monitor (plist-get exwm-randr-workspace-monitor-plist current-index))
- (displaced-monitor (plist-get exwm-randr-workspace-monitor-plist index)))
- ;; if not associated, copy current association
- (unless displaced-monitor
- (setq displaced-monitor current-monitor))
- ;; (message "%s, %s" current-monitor displaced-monitor)
- ;; swapping prevents a monitor losing all of its associations
- (plist-put exwm-randr-workspace-monitor-plist current-index displaced-monitor)
- (plist-put exwm-randr-workspace-monitor-plist index current-monitor)
-
- (exwm-workspace-switch-create index)
-
- (exwm-randr-refresh)
- ;; (message "%s, %s, %s" exwm-randr-workspace-monitor-plist current-index index)
- ))
-
-(defun exwm-other-assigned-workspace ()
- "focus other monitor's workspace. Assumes 2 monitors"
- (interactive)
- ;; super hacky, assumes that there are only two active workspaces
- (exwm-workspace-switch-create (exwm-workspace--workspace-from-frame-or-index
- (let* ((workspace-list (seq-filter 'exwm-workspace--active-p exwm-workspace--list))
- (active-workspaces workspace-list))
- (while (not (eq (car active-workspaces) (selected-frame)))
- (setq active-workspaces (cdr active-workspaces)))
- (setq active-workspaces (cdr active-workspaces))
- (if (eq active-workspaces nil)
- (car workspace-list)
- (car active-workspaces))))))
-
-;; (add-hook 'exwm-randr-screen-change-hook
-;; (lambda ()
-;; (let ((connected (shell-command-to-string "xrandr")))
-;; (if (and (string-match "HDMI-0 connected" connected) (string-match "DP-0 connected" connected) (string-match "DVI-I-1 connected" connected))
-;; (start-process-shell-command
-;; "xrandr" nil "xrandr --output HDMI-0 --rotate right --pos 0x240 --output DP-0 --auto --pos 1080x0 --output DVI-I-1 --auto --pos 1080x1080")
-;; ;;else
-;; (start-process-shell-command
-;; "xrandr" nil "xrandr --output DP-0 --auto --primary --output HDMI-0 --auto")))
-;; (exwm-randr-refresh)))
-(exwm-randr-mode)
-
-;;(exwm-config-default)
-(exwm-systemtray-mode)
-(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
-
-;; All buffers created in EXWM mode are named "*EXWM*". You may want to
-;; change it in `exwm-update-class-hook' and `exwm-update-title-hook', which
-;; are run when a new X window class name or title is available. Here's
-;; some advice on this topic:
-;; + Always use `exwm-workspace-rename-buffer` to avoid naming conflict.
-;; + For applications with multiple windows (e.g. GIMP), the class names of
- ; all windows are probably the same. Using window titles for them makes
-;; more sense.
-;; In the following example, we use class names for all windows except for
-;; Java applications and GIMP.
-;; (add-hook 'exwm-update-class-hook
-;; (lambda ()
-;; (unless (or (string-prefix-p "sun-awt-X11-" exwm-instance-name)
-;; (string= "gimp" exwm-instance-name))
-;; (exwm-workspace-rename-buffer exwm-class-name))))
-;; (add-hook 'exwm-update-title-hook
-;; (lambda ()
-;; (when (or (not exwm-instance-name)
-;; (string-prefix-p "sun-awt-X11-" exwm-instance-name)
-;; (string= "gimp" exwm-instance-name))
-;; (exwm-workspace-rename-buffer exwm-title))))
-
-
-;; store the buffer we were at before a jump
-(setq exwm-marked-buffer "*scratch*")
-
-;; Global keybindings can be defined with `exwm-input-global-keys'.
-;; Here are a few examples:
-(setq exwm-input-global-keys
- `(
- ;; Bind "s-r" to exit char-mode and fullscreen mode.
- ([?\s-r] . exwm-reset)
- ([?\M-r] . exwm-reset)
- ;; Bind "s-w" to window switcher
- ([?\s-w] . consult-buffer)
- ;; ([?\M-w] . open-window-by-buffer)
- ([?\M-W] . consult-buffer)
-
- ;;quicker 2-split swtiching
- ([?\s-o] . (lambda ()
- (interactive)
- (other-window 1)))
- ([?\M-o] . (lambda ()
- (interactive)
- (other-window 1)))
-
- ;;fast workspace switch
- ([?\s-O] . exwm-other-assigned-workspace)
- ([?\M-O] . exwm-other-assigned-workspace)
-
- ;;quick calc switching
- ;; ([?\s-c] . switch-to-calc)
-
- ;;mark the buffer
- ;; ([?\s- ] . (lambda ()
- ;; (interactive)
- ;; (setq exwm-marked-buffer (current-buffer))
- ;; (message "Marked the current buffer, return (across workspaces) with s-x")))
-
- ;;return to marked buffer
- ;; ([?\s-x] . (lambda ()
- ;; (interactive)
- ;; (let ((hold exwm-marked-buffer))
- ;; (setq exwm-marked-buffer (current-buffer))
- ;; (exwm-workspace-switch-to-buffer hold))))
-
- ;; Bind "s-0" to "s-9" to switch to a layout.
- ;; ,@(mapcar
- ;; (lambda (digit)
- ;; ;; `(,(kbd (concat "s-" (int-to-string digit))) . (lambda () (interactive) (exwm-assign-workspace ,digit)))
- ;; `(,(kbd (concat "s-" (int-to-string digit))) . (lambda ()
- ;; (interactive)
- ;; (exwm-workspace-switch-create ,digit)))
- ;; )
- ;; (number-sequence 0 9))
-
- ([?\s-d] . (lambda (command)
- (interactive (list (read-shell-command "$ ")))
- (start-process-shell-command command nil command)))
- ;; ([?\M-d] . (lambda (command)
- ;; (interactive (list (read-shell-command "$ ")))
- ;; (start-process-shell-command command nil command)))
- ;; browser
- ([?\s-e] . (lambda ()
- (interactive)
- (start-process-shell-command "vimb" nil "vimb")))
- ([?\s-E] . (lambda ()
- (interactive)
- (start-process-shell-command "firefox" nil "firefox")))
- ;; ([?\M-e] . (lambda ()
- ;; (interactive)
- ;; (start-process-shell-command "vimb" nil "vimb")))
-
- ;;terminal
- ([s-return] . eshell)
- ;; ((kbd "M-<return>") . eshell)
- ;; ([?\M-return] . (lambda ()
- ;; (interactive)
- ;;if we are already there, switch back
- ;; (if (string= (buffer-name (current-buffer)) "*vterm*")
- ;; (exwm-workspace-switch-to-buffer exwm-last-buffer)
- ;; (progn
- ;; (setq exwm-last-buffer (current-buffer))
- ;; (vterm)))))
-
- ;; return to the last window
- ;; ([?\s-tab] . (lambda ()
- ;; (interactive)
- ;; (exwm-workspace-switch-to-buffer (other-buffer))))
-
- ;; kill the current window and close the buffer if possible
- ([?\s-Q] . kill-buffer-and-window)
- ([?\M-Q] . kill-buffer-and-window)
-
- ;; kill current buffer but leave window
- ([?\s-q] . (lambda () (interactive) (kill-buffer nil)))
-
- ;; suspend
- ;; ([?\s-`] . (lambda ()
- ;; (interactive)
- ;; (start-process "" nil "loginctl" "suspend")))
- ))
-
-;; requires some custom shell scripts not included in my emacs config
-(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%"))
-
-;; To add a key binding only available in line-mode, simply define it in
-;; `exwm-mode-map'. The following example shortens 'C-c q' to 'C-q'.
-(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
-(define-key exwm-mode-map [?\M-!] #'shell-command)
-(define-key exwm-mode-map [?\s-d] (lambda (command)
- (interactive (list (read-shell-command "$ ")))
- (start-process-shell-command command nil command)))
-(define-key exwm-mode-map [?\M-o] #'other-window)
-
-(global-set-key (kbd "<XF86MonBrightnessDown>") 'my/brightnessdown)
-(global-set-key (kbd "<XF86MonBrightnessUp>") 'my/brightnessup)
-(global-set-key (kbd "<XF86AudioMute>") 'my/mute)
-(global-set-key (kbd "<XF86AudioLowerVolume>") 'my/voldown)
-(global-set-key (kbd "<XF86AudioRaiseVolume>") 'my/volup)
-
-(define-key exwm-mode-map (kbd "<XF86MonBrightnessDown>") 'my/brightnessdown)
-(define-key exwm-mode-map (kbd "<XF86MonBrightnessUp>") 'my/brightnessup)
-(define-key exwm-mode-map (kbd "<XF86AudioMute>") 'my/mute)
-(define-key exwm-mode-map (kbd "<XF86AudioLowerVolume>") 'my/voldown)
-(define-key exwm-mode-map (kbd "<XF86AudioRaiseVolume>") 'my/volup)
-
-;; The following example demonstrates how to use simulation keys to mimic
-;; the behavior of Emacs. The value of `exwm-input-simulation-keys` is a
-;; list of cons cells (SRC . DEST), where SRC is the key sequence you press
-;; and DEST is what EXWM actually sends to application. Note that both SRC
-;; and DEST should be key sequences (vector or string).
-(setq 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])
- ([?\C-d] . [delete])
- ([?\C-k] . [S-end delete])
- ;; cut/paste.
- ;; ([?\C-w] . [?\C-x])
- ([?\M-w] . [?\C-c])
- ([?\C-y] . [?\C-v])
- ;; search
- ([?\C-s] . [?\C-f])))
-
-;; You can hide the minibuffer and echo area when they're not used, by
-;; uncommenting the following line.
-;; (setq exwm-workspace-minibuffer-position 'bottom)
-
-
-;; specifically disable S-return in the minibuffer so you don't hit it on accident
-;; This is here cause cause the other s-* bindings are here
-(if vertico-mode
- (define-key vertico-map (kbd "s-<return>") 'vertico-exit)
- (define-key minibuffer-mode-map (kbd "s-<return>") 'minibuffer-complete-and-exit))
-
-;; Do not forget to enable EXWM. It will start by itself when things are
-;; ready. You can put it _anywhere_ in your configuration.
-(exwm-enable)
-(call-process "dunst" nil 0)
-(call-process "bash" nil 0 nil "-c" "uname -a | grep -q gentoo && gentoo-pipewire-launcher")
-
diff --git a/emacs/site-lisp/general-text.el b/emacs/site-lisp/general-text.el
deleted file mode 100644
index e593487..0000000
--- a/emacs/site-lisp/general-text.el
+++ /dev/null
@@ -1,32 +0,0 @@
-;; General stuff for editing all text, but particularly prose
-
-(provide 'general-text)
-
-;; dictionaries
-(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)))
-
-(setq ispell-personal-dictionary "/home/tmu/.aspell.en.pws")
-(add-hook 'text-mode-hook (lambda ()
- (ispell-minor-mode 1)
- (local-set-key (kbd "M-l") 'dict-map)))
-
-(electric-pair-mode 1)
-
-(use-package dabbrev
- :config
- (add-to-list 'dabbrev-ignored-buffer-modes 'doc-view-mode)
- (add-to-list 'dabbrev-ignored-buffer-modes 'pdf-view-mode)
- (add-to-list 'dabbrev-ignored-buffer-modes 'tags-table-mode))
diff --git a/emacs/site-lisp/irc-config.el b/emacs/site-lisp/irc-config.el
deleted file mode 100644
index eba66a0..0000000
--- a/emacs/site-lisp/irc-config.el
+++ /dev/null
@@ -1,24 +0,0 @@
-
-;; erc stuff
-(require 'erc)
-(setq 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" "#emacs-social" "#linux" "#archlinux" "#haskell" "#invidious"))
-
- 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)
-
-(defun my/start-erc ()
- "Start erc and autojoin various channels"
- (interactive)
- (erc :server "irc.libera.chat" :port 6667))
-
-(provide 'irc-config)
diff --git a/emacs/site-lisp/modeline-config.el b/emacs/site-lisp/modeline-config.el
deleted file mode 100644
index 5b1f7e5..0000000
--- a/emacs/site-lisp/modeline-config.el
+++ /dev/null
@@ -1,39 +0,0 @@
-;;; Modeline config
-
-(provide 'modeline-config)
-
-(use-package doom-modeline
- :init
- (doom-modeline-mode 1))
-(use-package minions
- :init
- (minions-mode 1)
- :custom
- (minions-prominent-modes '(persp-mode auto-fill-mode eldoc-mode eglot-mode lsp-mode)))
-
-(setq-default global-mode-string '("" (:eval (concat (with-face (format " [%s] " (shorten-path default-directory))
- :weight 'bold
- :foreground "green2")))))
-
-;; -----------------------------------------------------------------------------
-;; telephone line stuff
-
-;; (setq telephone-line-primary-left-separator 'telephone-line-tan-left)
-;; (setq telephone-line-primary-right-separator 'telephone-line-tan-right)
-
-;; (telephone-line-defsegment* telephone-line-time-segment ()
-;; (telephone-line-raw display-time-string t))
-
-;; (setq telephone-line-lhs
-;; '((evil . (telephone-line-evil-tag-segment))
-;; (accent . (telephone-line-vc-segment
-;; telephone-line-erc-modified-channels-segment
-;; telephone-line-process-segment))
-;; (nil . (telephone-line-buffer-segment
-;; telephone-line-minions-mode-segment))))
-;; (setq telephone-line-rhs
-;; '((nil . (telephone-line-misc-info-segment))
-;; (accent . (telephone-line-time-segment))
-;; (evil . (telephone-line-airline-position-segment))))
-
-;; (telephone-line-mode 1)
diff --git a/emacs/site-lisp/my-binds.el b/emacs/site-lisp/my-binds.el
deleted file mode 100644
index 990dd46..0000000
--- a/emacs/site-lisp/my-binds.el
+++ /dev/null
@@ -1,24 +0,0 @@
-;;; Various custom binds that aren't part of an external package
-
-(provide 'my-binds)
-(require 'my-funcs)
-
-(global-set-key (kbd "C-x C-C") 'save-buffers-kill-terminal)
-(global-set-key (kbd "C-x C-c") 'close-or-kill)
-(global-set-key (kbd "M-w") 'copy-region-as-kill) ;;make copying not flash cursor
-(global-set-key (kbd "M-(") 'wrap-region-paren)
-(global-set-key (kbd "M-z") 'zap-whitespace)
-(global-set-key (kbd "C-M-z") 'wrap-sexp)
-(global-set-key (kbd "M-o") 'other-window)
-(global-set-key (kbd "M-c") 'calc)
-(global-set-key (kbd "M-U") 'scroll-lock-mode)
-(global-set-key (kbd "M-Q") 'auto-fill-mode)
-(require 'dired)
-(keymap-set dired-mode-map "C-o" 'dired-display-file)
-(keymap-set dired-mode-map "F" 'dired-do-find-marked-files)
-
-;; searching
-(global-set-key (kbd "M-s g") 'rgrep)
-(global-set-key (kbd "M-s r") 'counsel-rg)
-
-(global-set-key (kbd "C-x w o") 'toggle-window-other-reachability)
diff --git a/emacs/site-lisp/my-funcs.el b/emacs/site-lisp/my-funcs.el
deleted file mode 100644
index 37a8b7b..0000000
--- a/emacs/site-lisp/my-funcs.el
+++ /dev/null
@@ -1,164 +0,0 @@
-;;; Various functions functions that are not part of an external package
-
-(provide 'my-funcs)
-
-
-;; see transparancy in init.el
-(defun 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))))
-
-(defun 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 zap-whitespace ()
- "zaps 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 wrap-sexp (&optional arg)
- "Wraps the following sexp in a pair of parens.
-Places inside the new pair, with prefix arg do the same backwards, pushing the
-mark. Does the same of ARG number sexps if given"
- (interactive "p")
- (message "%s" arg)
- (if arg
- (progn
- (push-mark)
- (insert-pair arg ?\( ?\)))
- (insert-pair 1 ?\( ?\))))
-
-(defun close-or-kill ()
- "If this is the sole frame, kill emacs. Otherwise close the frame."
- (interactive)
- (if (eq 1 (length (frame-list)))
- ;; sole frame, exit
- (save-buffers-kill-terminal)
- (delete-frame)))
-
-(defun toggle-window-other-reachability ()
- (interactive)
- (let* ((win (get-buffer-window (current-buffer)))
- (current (window-parameter win 'no-other-window)))
- (set-window-parameter win 'no-other-window (not current))))
-
-;; indent code when pasting, from
-;; https://trey-jackson.blogspot.com/2008/03/emacs-tip-15-indent-yanked-code.html
-
-;; automatically indenting yanked text if in programming-modes
-(defvar yank-indent-modes '(emacs-lisp-mode
- c-mode c++-mode
- tcl-mode sql-mode
- perl-mode cperl-mode
- java-mode jde-mode
- lisp-interaction-mode
- LaTeX-mode TeX-mode
- rust-mode
- rustic-mode)
- "Modes in which to indent regions that are yanked (or yank-popped).")
-
-(defun yank-advised-indent-function (beg end)
- "Do indentation, as long as the region isn't too large.
-BEG and END define the region."
- (indent-region beg end nil))
-
-(defadvice yank (after yank-indent activate)
- "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)."
- (if (and (not (ad-get-arg 0))
- (member major-mode yank-indent-modes))
- (let ((transient-mark-mode nil))
- (yank-advised-indent-function (region-beginning) (region-end)))))
-
-(defadvice yank-pop (after yank-pop-indent activate)
- "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)."
- (if (and (not (ad-get-arg 0))
- (member major-mode yank-indent-modes))
- (let ((transient-mark-mode nil))
- (yank-advised-indent-function (region-beginning) (region-end)))))
-
-(if want-evil
- (progn
- (defadvice evil-paste-before (after yank-indent activate)
- "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)."
- (if (and (not (ad-get-arg 0))
- (member major-mode yank-indent-modes))
- (let ((transient-mark-mode nil))
- (yank-advised-indent-function (region-beginning) (region-end)))))
-
- (defadvice evil-paste-after (after yank-indent activate)
- "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)."
- (if (and (not (ad-get-arg 0))
- (member major-mode yank-indent-modes))
- (let ((transient-mark-mode nil))
- (yank-advised-indent-function (region-beginning) (region-end)))))))
-
-(defun 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 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))
-
-(defun clean-prog-file (buffer)
- "Fixes whitespace in buffer"
- (save-excursion
- (with-current-buffer buffer
- (untabify (point-min) (point-max))
- (goto-char (point-min))
- (while (re-search-forward " +$" nil t)
- (replace-match "" nil nil)))))
-
-(defun open-window-by-buffer (buffer)
- "Move focus to an extant window by the buffer it contains."
- (interactive "bBuffer: ")
- (let ((win (get-buffer-window buffer t)))
- (if win
- (select-window win)
- (switch-to-buffer buffer))))
-
-(defun dired-do-find-marked-files ()
- (interactive)
- (seq-do 'find-file (dired-get-marked-files)))
-
-(defun shorten-path (path)
- "Shortens each directory in PATH except for the last directory to its first character."
- (let* ((components (split-string path "/")) ; Split the path into components
- (last-component (-last (lambda (s) (not (string-empty-p s))) components)) ; Extract the last component
- (shortened-components ; Shorten all components except the last
- (mapcar (lambda (comp)
- (if (or (string-equal comp last-component) (string-empty-p comp))
- comp
- (substring comp 0 1)))
- components)))
- (mapconcat 'identity shortened-components "/"))) ; Recombine components into a path
-
diff --git a/emacs/site-lisp/single-header.el b/emacs/site-lisp/single-header.el
index 06faff5..2713c5b 100755
--- a/emacs/site-lisp/single-header.el
+++ b/emacs/site-lisp/single-header.el
@@ -1,40 +1,103 @@
-(provide 'single-header)
+(require 'ednc)
+(require 'battery)
+(require 's)
+(require 'dash)
-(defvar single-header--current-header-buffer nil "Read the name")
+;; not toggled with the mode to prevent user from having to restart
+;; applications producing notifs.
+(when (equal window-system 'x)
+ (ednc-mode 1))
-(defvar single-header-format '(make-header-info-string) "evaluated to fill the header")
+;; testing
+;; (require 'notifications)
+;; (notifications-notify :title "2st test" :body "hello, world" :app-name "EDNC"
+;; :actions '("default" "default"))
+
+(defvar single-header-update-increment 3 "Number of seconds before updating the header again.")
+
+(defvar single-header--current-header-buffer nil "Read the name")
(defface single-header '((default . (:background "#000000" :family "Source Code Pro"))) "Face for top line")
-(require 'battery)
-(defun with-face (str &rest face-plist)
+(setq single-header--active-notifs nil)
+(setq single-header--timer nil
+;; "Timer that triggers updates of the header contents. Use `single-header-update' for forcing updates."
+ )
+
+(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 make-header-info-string ()
- "generates the mode line string that contains all the info to the right"
+(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))))
+
+(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))
+
+(defun single-header-format ()
+ "Evaluated in the header buffer when empty to fill the buffer."
+ (let* ((win (get-buffer-window (current-buffer)))
+ (win-width (window-max-chars-per-line win 'single-header))
+ (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))
+ (setq padding (single-header--with-face padding 'single-header))
+ (setq info (single-header--with-face info 'single-header))
+ (insert notifs padding info)))
+
+
+
+(defun single-header--make-header-info-string ()
+ "Generates the mode line string that contains all the info to the right."
(let ((str (concat
- (with-face (battery-format "[%b%p%%] " (and battery-status-function (funcall battery-status-function)))
+ (single-header--with-face (battery-format "[%b%p%%] " (and battery-status-function (funcall battery-status-function)))
:weight 'bold)
- (with-face (let* ((mi (memory-info))
+ (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")
- (with-face (format "<%03.2f> " (car (load-average 1)))
+ (single-header--with-face (format "<%03.2f> " (car (load-average 1)))
:foreground "#da70d6")
(format-time-string "%a, %b %+4Y-%0m-%0d ")
- (with-face (format-time-string "%R")
+ (single-header--with-face (format-time-string "%R")
:weight 'bold)
)))
- (setq str (concat (make-string
- (- (window-max-chars-per-line (minibuffer-window) 'single-header)
- (length str))
- ? )
- str))
- (with-face str 'single-header)))
+ (single-header--with-face str 'single-header)))
(defun single-header-init-buffer (buf)
(with-current-buffer buf
@@ -69,7 +132,7 @@
(window-preserve-size win nil t))))
(defun single-header-show (buf)
- "show / make a header"
+ "Show the header, making it if necessary."
(if (buffer-live-p buf)
(let ((win (display-buffer-in-side-window buf '((side . top)
(slot . -100)))))
@@ -77,43 +140,67 @@
(single-header-make)))
(defun single-header-make ()
- "create the fake header line"
+ "Create the header and show it."
(interactive)
+
+ (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))))
(unless (buffer-live-p single-header--current-header-buffer)
(let ((buf (generate-new-buffer "*header*")))
(single-header-init-buffer buf)
(setq single-header--current-header-buffer buf)
- (single-header-show buf))))
+ (single-header-show buf)))
+ (unless (timerp 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"
+ "Remove an existing header buffer."
(interactive)
+ (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)))
+
+ (when (timerp single-header--timer)
+ (cancel-timer single-header--timer)
+ (setq single-header--timer nil))
(when (buffer-live-p single-header--current-header-buffer)
(kill-buffer single-header--current-header-buffer)))
(defun single-header-update ()
- "update the contents of the header line according to `single-header-format'"
+ "Update the contents of the header line by calling `single-header-format'
+with the header buffer current and empty."
(when (buffer-live-p single-header--current-header-buffer)
(with-current-buffer single-header--current-header-buffer
(erase-buffer)
- (insert (eval single-header-format)))
-
- ;; (when exwm-state
- ;; (exwm-input--set-active-window
- ;; (or (frame-parameter exwm-workspace--current 'exwm-outer-id)
- ;; xcb:Window:None)))
- ))
-
-(add-hook 'after-make-frame-functions (lambda (frame)
- (with-selected-frame frame
- (single-header-show single-header--current-header-buffer))))
-
-;; (use-package lv
- ;; :custom ((lv-use-separator . nil)))
-
-;; do init frame seperately
-(single-header-show single-header--current-header-buffer)
-(setq single-header--timer nil)
-(unless single-header--timer
- (setq single-header--timer (run-with-timer 0 3 'single-header-update)))
+ (single-header-format))))
+
+(define-minor-mode single-header-mode
+ "Global minor mode to enable a single info line at the top of each frame."
+ :global t
+ :init-value nil
+ ;; :keymap '(("s-l d" . 'single-header-dismiss)
+ ;; ("s-l t" . 'single-header-mode))
+ :interactive t
+ (if (not single-header-mode)
+ (single-header-delete)
+ (single-header-make)))
+
+(provide 'single-header)