summaryrefslogtreecommitdiff
path: root/.config/emacs
diff options
context:
space:
mode:
authorbd <bdunahu@colostate.edu>2024-01-10 19:44:21 -0700
committerbd <bdunahu@colostate.edu>2024-01-10 19:44:21 -0700
commit1ced565816120bfcc351daf9fc3a4e851162e3b7 (patch)
tree93e9c23660cd07f4dba861f334b23c03d322f48c /.config/emacs
parentda5922a476cebdbbf338f0192165dbbbcd3f7b6f (diff)
Initial commit of new repository structure
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/bd-default.el167
-rw-r--r--.config/emacs/bd-development.el85
-rw-r--r--.config/emacs/bd-mode-and-themes.el161
-rw-r--r--.config/emacs/bd-org.el97
-rw-r--r--.config/emacs/bd-shells.el47
-rw-r--r--.config/emacs/early-init.el28
-rw-r--r--.config/emacs/init.el72
-rw-r--r--.config/emacs/modules/bd--devel.el67
-rw-r--r--.config/emacs/modules/bd--dictionary.el9
-rw-r--r--.config/emacs/modules/bd--dired.el21
-rw-r--r--.config/emacs/modules/bd--emms.el (renamed from .config/emacs/bd-emms.el)9
-rw-r--r--.config/emacs/modules/bd--erc.el12
-rw-r--r--.config/emacs/modules/bd--essential-windowing.el30
-rw-r--r--.config/emacs/modules/bd--essentials.el62
-rw-r--r--.config/emacs/modules/bd--eww.el25
-rw-r--r--.config/emacs/modules/bd--exwm-windowing.el (renamed from .config/emacs/bd-wm.el)51
-rw-r--r--.config/emacs/modules/bd--image.el23
-rw-r--r--.config/emacs/modules/bd--minibuffer.el34
-rw-r--r--.config/emacs/modules/bd--modeline.el126
-rw-r--r--.config/emacs/modules/bd--org.el87
-rw-r--r--.config/emacs/modules/bd--roam.el38
-rw-r--r--.config/emacs/modules/bd--rss.el24
-rw-r--r--.config/emacs/modules/bd--shells.el57
-rw-r--r--.config/emacs/modules/bd--themes.el40
24 files changed, 774 insertions, 598 deletions
diff --git a/.config/emacs/bd-default.el b/.config/emacs/bd-default.el
deleted file mode 100644
index 39cd231..0000000
--- a/.config/emacs/bd-default.el
+++ /dev/null
@@ -1,167 +0,0 @@
-;; -*- lexical-binding: t; -*-
-
-
-;;;; packages
-(require 'package)
-(add-to-list 'load-path (expand-file-name "~/.guix-profile/share/emacs/site-lisp"))
-(guix-emacs-autoload-packages)
-
-(require 'use-package-ensure)
-(setopt use-package-always-ensure t)
-;; (setq use-package-verbose t) ; for debugging
-
-
-(setenv "PATH" (format "%s:%s" (expand-file-name "~/Personal/scripts/") (getenv "PATH")))
-
-
-;;;; functions
-(defun cleanup-buffer ()
- (interactive)
- (delete-trailing-whitespace)
- (untabify (point-min) (point-max))
- (indent-region (point-min) (point-max)))
-
-(defun clamp (lower-bound upper-bound value)
- (max lower-bound (min value upper-bound)))
-
-(defun request-sudo ()
- "Uses TRAMP to edit currently opened file as root."
- (interactive)
- (when buffer-file-name
- (find-alternate-file
- (concat "/sudo:root@localhost:"
- buffer-file-name))))
-
-(defun rip-video (url &rest _)
- "Given a url, rip and play the video
-with yt-dlp and mpv."
- (message "Ludu %s" url)
- (start-process-shell-command "rip-video" nil (concat "rip-video " url)))
-
-(defun parse-and-rip-video ()
- "If region, open SEARCH with mpv in --full-screen. Else,
- open URL at point."
- (interactive)
- (let ((URL-OR-SEARCH
- (if (use-region-p)
- (buffer-substring (mark) (point))
- (shr-url-at-point nil))))
- (rip-video URL)))
-
-
-;;;; defaults
-(global-unset-key (kbd "C-z"))
-(global-unset-key (kbd "C-x C-z")) ; terrible binding
-
-(global-set-key (kbd "C-z =") 'text-scale-increase)
-(global-set-key (kbd "C-z -") 'text-scale-decrease)
-
-(setopt inhibit-startup-message t)
-(menu-bar-mode -1)
-(tool-bar-mode -1)
-(scroll-bar-mode -1)
-
-(require 'display-line-numbers)
-(global-display-line-numbers-mode)
-(global-visual-line-mode t)
-(setopt display-line-numbers-type 'relative)
-(global-hl-line-mode 1)
-
-(global-auto-revert-mode 1)
-(winner-mode 1)
-
-;; messy editing + cleanup buffers on save
-(setopt next-line-add-newlines t)
-(add-hook 'before-save-hook 'cleanup-buffer)
-
-;; prompts
-(setopt use-short-answers t)
-(setopt vc-follow-symlinks t)
-
-(setopt kill-whole-line t)
-
-;; recursive minibuffers
-(setopt enable-recursive-minibuffers t)
-(minibuffer-depth-indicate-mode 1)
-
-;; allow one side window per side of frame
-(setopt window-sides-slots '(1 1 1 1))
-
-;; dictionary
-(keymap-global-set "C-c i" 'dictionary-lookup-definition)
-(setopt dictionary-server "localhost"
- dictionary-use-single-buffer t)
-
-;; do not show async command buffers by default
-(add-to-list 'display-buffer-alist
- (cons "\\*Async Shell Command\\*.*" (cons #'display-buffer-no-window nil)))
-
-(setopt scroll-up-aggressively '0.0
- scroll-down-aggressively '0.0)
-
-;; move backups to tmp folder
-(setopt backup-directory-alist `(("." . ,(expand-file-name "tmp/backups/" user-emacs-directory))))
-(make-directory (expand-file-name "tmp/auto_saves/" user-emacs-directory) t)
-;; move auto-saves to tmp folder
-(setopt auto-save-list-file-prefix (expand-file-name "tmp/auto_saves/sessions/" user-emacs-directory)
- auto-save-file-transforms `((".*" ,(expand-file-name "tmp/auto_saves/" user-emacs-directory) t)))
-
-
-;;;; built-in packages
-(use-package newsticker
- :demand t
- :bind (("C-z C-n" . newsticker-show-news)
- :map newsticker-treeview-item-mode-map
- ("C-j" . parse-and-rip-video))
- :custom
- (newsticker-url-list-defaults nil)
- (newsticker-automatically-mark-items-as-old nil)
- (newsticker-url-list '(("Ambrose and Elsewhere" "https://jamesenge.com/engeblog/feed" nil nil nil)
- ("James Enge Mastodon" "https://mastodon.sdf.org/@jamesenge.rss" nil nil nil)
- ("Tales From the Magician's Skull" "https://goodman-games.com/tftms/category/book-reviews/feed" nil nil nil)
- ("Parabola GNU/Linux-libre" "https://www.parabola.nu/feeds/news/" nil nil nil)
- ("suckless.org news" "https://suckless.org/atom.xml" nil nil nil)
- ("Mental Outlaw" "https://vid.puffyan.us/feed/channel/UC7YOGHUfC1Tb6E4pudI9STA" nil nil nil)
- ("Luke Smith" "https://vid.puffyan.us/feed/channel/UC2eYFnH61tmytImy1mTYvhA" nil nil nil)
- ("Brent Westbrook" "https://yewtu.be/feed/channel/UC0PBefyEK7qQ7HN325nUamQ" nil nil nil)
- ("Bugswriter" "https://yewtu.be/feed/channel/UCngn7SVujlvskHRvRKc1cTw" nil nil nil)
- ("Protesilaos Stravrou" "https://yewtu.be/feed/playlist/PL8Bwba5vnQK14z96Gil86pLMDO2GnOhQ6" nil nil nil)))
- ;; may require ./newsticker/groups to be cleared
- (newsticker-groups '("Feeds"
- ("READING" "James Enge Mastodon" "Tales From the Magician's Skull" "Ambrose and Elsewhere")
- ("TECH" "Parabola GNU/Linux-libre" "suckless.org news")
- ("VIDEO" "Mental Outlaw" "Luke Smith" "Brent Westbrook" "Bugswriter" "Protesilaos Stravrou"))))
-
-(use-package eww
- :demand t
- :custom
- ;; default to eww
- (browse-url-browser-function 'eww-browse-url)
- (shr-use-fonts nil)
- (shr-cookie-policy nil)
- (shr-max-width 85)
- (url-privacy-level '(email os emacs lastloc cookies))
- (eww-search-prefix "https://searx.be/search?q=")
- (eww-auto-rename-buffer 'title)
- (eww-use-browse-url (regexp-opt '("mailto:" "youtube.com" "youtu.be" "yewtu.be")))
- (browse-url-handlers
- `((,(regexp-opt '("youtube.com" "youtu.be" "yewtu.be")) . rip-video))))
-
-(use-package image-dired
- :bind (("C-c d" . dired-jump))
- :custom
- (dired-listing-switches "-alh")
- (dired-guess-shell-alist-user
- `((,(regexp-opt '(".mkv" ".mov" ".mp4" ".webm" ".m4v" ".wav" ".mp3" ".opus" ".ogv" ".flac")) "mpv &")
- (,(regexp-opt '(".pdf")) "zathura &")
- (,(regexp-opt '(".html")) "icecat &"))))
-
-(use-package erc
- :config
- (defalias 'erc 'erc-tls)
- :custom
- (erc-lurker-threshold-time 3600)
- (erc-server "irc.libera.chat")
- (erc-nick "Isaz")
- (erc-kill-buffer-on-part t)
- (erc-autojoin-channels-alist '(("irc.libera.chat" "#parabola" "#emacs" "#guix"))))
diff --git a/.config/emacs/bd-development.el b/.config/emacs/bd-development.el
deleted file mode 100644
index 3e47ad6..0000000
--- a/.config/emacs/bd-development.el
+++ /dev/null
@@ -1,85 +0,0 @@
-;; -*- lexical-binding: t; -*-
-
-(defun remote-shell ()
- (interactive)
- (let ((default-directory "/ssh:bdunahu@perch.cs.colostate.edu:"))
- (shell)))
-
-(defcustom display-line-numbers-exempt-modes
- '(vterm-mode eshell-mode shell-mode term-mode ansi-term-mode image-mode doc-view-mode newsticker-treeview-mode newsticker-treeview-item-mode dired-mode org-agenda-mode)
- "Major modes on which to disable line numbers."
- :group 'display-line-numbers
- :type 'list
- :version "green")
-
-(defun display-line-numbers--turn-on ()
- "Turn on line numbers except for certain major modes.
-Exempt major modes are defined in `display-line-numbers-exempt-modes'."
- (unless (or (minibufferp)
- (member major-mode display-line-numbers-exempt-modes))
- (display-line-numbers-mode)))
-
-;; (use-package tex
-;; :ensure auctex
-;; :hook
-;; ((latex-mode)
-;; (text-mode . (lambda() (setq ispell-parser 'tex)))) ; improves ispell in LaTeX
-;; :custom
-;; (TeX-auto-save t)
-;; ;; better support for latex packages
-;; (TeX-parse-self t)
-;; (TeX-view-program-selection '(((output-dvi has-no-display-manager)
-;; "dvi2tty")
-;; ((output-dvi style-pstricks)
-;; "dvips and gv")
-;; (output-dvi "xdvi")
-;; (output-pdf "Zathura")
-;; (output-html "xdg-open"))))
-
-(use-package vertico
- :init
- (vertico-mode)
- :custom
- (vertico-cycle t))
-
-(use-package orderless
- :init
- (setq completion-styles '(orderless basic)
- completion-category-defaults nil
- completion-category-overrides '((file (styles partial-completion)))))
-
-(use-package company
- :hook (prog-mode text-mode)
- :config
- (global-company-mode)
- :custom
- (company-global-modes '(bash-ts-mode emacs-lisp-mode
- slime-mode js-ts-mode
- json-ts-mode css-ts-mode
- python-ts-mode java-ts-mode))
- (company-set-idle-delay (lambda () (if (company-in-string-or-comment) nil 0.3)))
- (company-minimum-prefix-length 1)
- (company-tooltip-flip-when-above t)
- (company-show-numbers t)
- (company-tooltip-align-annotations t)
- (company-tooltip-limit 15)
- (company-selection-wrap-around t))
-
-(use-package slime
- :commands slime
- :config
- (add-hook 'slime-mode-hook
- (lambda ()
- (local-set-key (kdb "C-c C-k") 'slime-eval-buffer)))
- :custom
- ;; more memory for ml libraries
- (inferior-lisp-program "sbcl --dynamic-space-size 4096"))
-
-(use-package magit
- :commands magit-status
- :custom
- (magit-define-global-key-bindings 'recommended))
-
-
-;; compilation mode
-(setq compilation-always-kill t)
diff --git a/.config/emacs/bd-mode-and-themes.el b/.config/emacs/bd-mode-and-themes.el
deleted file mode 100644
index 528e920..0000000
--- a/.config/emacs/bd-mode-and-themes.el
+++ /dev/null
@@ -1,161 +0,0 @@
-;; -*- lexical-binding: t; -*-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; excellent resources : https://gitlab.com/mark.feller/emacs.d/-/blob/master/modules/module-solarized.el ;;
-;; https://protesilaos.com/codelog/2023-07-29-emacs-custom-modeline-tutorial/ ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;;;; icon components for filename and git status
-(use-package all-the-icons
- :demand t
- :init
- (defun modeline-buffer-name ()
- "Return 'buffer-name' with proper spacing and icon."
- (format " %s %s" (all-the-icons-icon-for-file (buffer-name)) (buffer-name)))
- (defvar-local bd/buffer-identification-mode-line
- '(:eval (format "%s" (modeline-buffer-name)))
- "Formats the modeline-buffer-name.")
-
- (defun git-vc-modeline ()
- (let ((branch (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-")))
- (concat
- (propertize (format " %s" (all-the-icons-octicon "git-branch"))
- 'face `(:height 1 :family ,(all-the-icons-octicon-family))
- 'display '(raise 0))
- (propertize (format " %s" branch))
- (propertize " "))))
- (defvar-local bd/vc-mode-line
- '(:eval (when (and vc-mode (not (eq major-mode 'magit-status-mode))) ; temp fix to avoid bug which occurs in magit buffer
- (format "%s"
- (propertize (git-vc-modeline) 'face 'shadow))))
- "Formats the checked out git repository.")
- (defvar-local bd/emms-mode-line
- '(:eval (when (and (mode-line-window-selected-p) emms-mode-line-string)
- (format "%s %s" emms-mode-line-string
- emms-playing-time-string)))
- "Formats the currently playing emms track.")
- :config
- (setq emms-mode-line-icon-before-format (format "%s" (all-the-icons-fileicon "owl"))
- emms-mode-line-icon-enabled-p t))
-
-(use-package ednc
- :init
- (defun get-num-notifications ()
- "Return number of active notifcations as a string."
- (format "%s" (length (ednc-notifications))))
- (defvar-local bd/notify-mode-line
- '(:eval (when (and (ednc-notifications) (mode-line-window-selected-p))
- (format " %s %s" (all-the-icons-material "notifications_active")
- (propertize (get-num-notifications) 'face 'error))))
- "Formats the notification number.")
- (ednc-mode))
-
-;;;; time and date
-(setq display-time-format "%m/%d/%y %H:%M (%a)"
- display-time-default-load-average nil)
-(display-time)
-
-(defvar-local bd/time-mode-line
- '(:eval
- (when (mode-line-window-selected-p)
- display-time-string))
- "displays current time and date in selected window.")
-
-(defun mode-line-fill (reserve)
- "Return empty space, leaving RESERVE space on the right."
- (unless reserve
- (setq reserve 20))
- (when (and window-system (eq 'right (get-scroll-bar-mode)))
- (setq reserve (- reserve 3)))
- (propertize " "
- 'display `((space :align-to (- (+ right right-fringe right-margin) ,reserve)))))
-
-(dolist (construct '(bd/buffer-identification-mode-line
- bd/vc-mode-line
- bd/misc-mode-line))
- (put construct 'risky-local-variable t))
-
-(setq-default mode-line-format
- (list
- mode-line-front-space
- ;; mode-line-mule-info
- ;; mode-line-frame-identification
- bd/buffer-identification-mode-line
- " "
- mode-line-modes
- " "
- ;; mode-line-position
- mode-line-modified
- bd/notify-mode-line
- bd/vc-mode-line
- " "
- bd/emms-mode-line
- (mode-line-fill 21)
- bd/time-mode-line))
-
-;;;; remove mode-line-clutter
-(define-minor-mode minor-mode-blackout-mode
- "Hides minor modes from the mode line."
- t)
-
-(catch 'done
- (mapc (lambda (x)
- (when (and (consp x)
- (equal (cadr x) '("" minor-mode-alist)))
- (let ((original (copy-sequence x)))
- (setcar x 'minor-mode-blackout-mode)
- (setcdr x (list "" original)))
- (throw 'done t)))
- mode-line-modes))
-
-(global-set-key (kbd "C-c m") 'minor-mode-blackout-mode)
-
-(defun disable_mode_line ()
- (setq mode-line-format nil))
-
-;; custom function to remove mode line from images
-(add-hook 'image-mode-hook 'disable_mode_line)
-
-;;;; true transparency
-;; (add-to-list 'default-frame-alist '(alpha-background . 60))
-(add-to-list 'default-frame-alist '(alpha . (80 . 80)))
-
-(defun set-frame-alpha (value)
- "Sets the transparency of the frame background. 0=transparent/100=opaque"
- (interactive "nTransparency Value 0 - 100 opaque:")
- (setq value (clamp 0 100 value))
- (set-frame-parameter (selected-frame) 'alpha-background value)
- (message "Alpha set to %d" value))
-
-;;;; modus themes
-(defun modus-themes-custom-faces ()
- (modus-themes-with-colors
- (custom-set-faces
- `(mode-line-inactive ((,class :background ,bg-main
- :foreground ,fg-active)))
- `(mode-line-active ((,class :background ,bg-main
- :foreground ,fg-active)))
-
- `(hl-line ((,class :background ,magenta-nuanced-bg)))
-
- `(emms-playlist-track-face ((,class :foreground ,blue-nuanced-fg)))
- `(emms-playlist-selected-face ((,class :foreground ,fg-special-cold)))
- `(emms-browser-track-face ((,class :foreground ,blue-nuanced-fg))))))
-
-(add-hook 'modus-themes-after-load-theme-hook #'modus-themes-custom-faces)
-
-(setopt modus-themes-italic-constructs t
- modus-themes-bold-constructs t
- modus-themes-hl-line '(accented)
- modus-themes-subtle-line-numbers t
- modus-themes-paren-match '(intense)
- modus-themes-region '(bg-only)
- modus-themes-syntax '(faint)
- modus-themes-mode-line '(borderless)
- modus-themes-org-blocks 'gray-background
- modus-themes-headings '(
- (1 . (rainbow overline))))
-
-(load-theme 'modus-vivendi t)
-
-(modus-themes-custom-faces)
diff --git a/.config/emacs/bd-org.el b/.config/emacs/bd-org.el
deleted file mode 100644
index 06a961c..0000000
--- a/.config/emacs/bd-org.el
+++ /dev/null
@@ -1,97 +0,0 @@
-;; -*- lexical-binding: t; -*-
-
-(defvar-local agenda-file "~/Personal/roam/agenda/agenda_tasks.org")
-
-(defun bd/org-mode-setup-hook ()
- "Sets up improved org-mode defaults upon
-each org file open."
- (org-indent-mode)
- (org-toggle-inline-images)
- (org-toggle-pretty-entities))
-
-(use-package org
- :hook
- (org-mode . bd/org-mode-setup-hook)
- :commands (org-capture org-agenda)
- :bind (("C-c n a" . 'org-agenda)
- ("C-c n c" . 'org-capture)
- ("C-c n s" . 'org-schedule)
- ("C-c n d" . 'org-deadline)
- ("C-c n r" . 'org-refile))
- :config
- (advice-add 'org-refile :after 'org-save-all-org-buffers) ; after refiling tasks, save all buffers
- (org-babel-do-load-languages
- 'org-babel-load-languages
- '((emacs-lisp . t)
- (python . t)
- (shell . t)
- (lisp . t)))
- :custom
- (org-startup-folded 'show2levels)
- (org-ellipsis " ▾")
- (org-agenda-files
- `(,agenda-file "~/Personal/roam/agenda/archived_tasks.org"))
- (org-deadline-warning-days 7)
- (org-log-done 'time)
- (org-log-into-drawer "history")
- (org-todo-keywords
- '((sequence "TODO(t)" "NEXT(n!)" "|" "DONE(d)" "CANC(c)")))
- (org-refile-targets ; refile into the headings of these files, not tags
- '(("archived_tasks.org" :maxlevel . 1)
- ("agenda_tasks.org" :maxlevel . 1)))
- (org-capture-templates
- `(("t" " Tasks")
- ("tt" "Task" entry (file+olp ,agenda-file "Unsorted")
- "* TODO %?\n %U\n %a" :empty-lines 1)))
- (org-agenda-custom-commands
- '(("S" "Standard Block Agenda"
- ((tags-todo "*"
- ((org-agenda-skip-function '(org-agenda-skip-if nil '(timestamp)))
- (org-agenda-block-separator nil)
- (org-agenda-overriding-header "Undated Tasks\n")))
- (agenda "" ((org-agenda-span 5)
- (org-deadline-warning-days 0)
- (org-agenda-block-separator nil)
- (org-scheduled-past-days 4)
- (org-agenda-overriding-header "\nUpcoming Tasks\n")))
- (agenda "" ((org-agenda-time-grid nil)
- (org-agenda-show-all-dates nil)
- (org-agenda-span 21)
- (org-deadline-warning-days 0)
- (org-agenda-block-separator nil)
- (org-agenda-entry-types '(:deadline))
- (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
- (org-agenda-overriding-header "\nFuture Deadlines (+21d)\n"))))))))
-
-(defun org-roam-node-insert-immediate (arg &rest args)
- "Insert a new org mode link, but do not open the
-file."
- (interactive "P")
- (let ((args (cons arg args))
- (org-roam-capture-templates (list (append (car org-roam-capture-templates)
- '(:immediate-finish t)))))
- (apply #'org-roam-node-insert args)))
-
-(use-package org-roam
- :after org
- :bind (("C-c n l" . 'org-roam-buffer-toggle)
- ("C-c n f" . 'org-roam-node-find)
- ("C-c n i" . 'org-roam-node-insert)
- ("C-c n g" . 'org-roam-graph)
- ("C-c n I" . 'org-roam-node-insert-immediate)
- ("C-c n j" . 'org-roam-dailies-capture-today)
- :map org-mode-map
- ("C-M-i" . 'completion-at-point))
- :config
- (org-roam-db-autosync-mode)
- :custom
- (org-roam-directory (expand-file-name "~/Personal/roam/"))
- (org-roam-dailies-directory "logs/")
- (org-roam-complete-everywhere t)
- (org-roam-capture-templates '(("e" "extend" plain
- "#+AUTHOR: bdunahu\n#+DESCRIPTION: %^{Description}\n#+STARTUP: show3levels\n" :target
- (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}")
- :unnarrowed t)
- ("d" "default" plain "%?" :target
- (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}")
- :unnarrowed t))))
diff --git a/.config/emacs/bd-shells.el b/.config/emacs/bd-shells.el
deleted file mode 100644
index 4054e5d..0000000
--- a/.config/emacs/bd-shells.el
+++ /dev/null
@@ -1,47 +0,0 @@
-;; -*- lexical-binding: t; -*-
-
-
-(defun eshell-open-buffer ()
- "Opens eshell in the bottom
-side window."
- (interactive)
- (let ((curr-buffer (current-buffer))
- (eshell (eshell)))
- (switch-to-buffer curr-buffer)
- (display-buffer-in-side-window (get-buffer eshell) '((side . top)))
- (switch-to-buffer-other-window eshell)))
-
-(defun bd/get-prompt-path ()
- (abbreviate-file-name (eshell/pwd)))
-
-(defun bd/eshell-prompt ()
- "Assemble a shell prompt including host, git
-status, and path."
- (let ((current-branch (magit-get-current-branch)))
- (concat
- "\n"
- (propertize (system-name) 'face `(:foreground "#edb54b"))
- ;; (when current-branch
- ;; (concat
- ;; (format " %s " (all-the-icons-octicon "git-branch"))
- ;; (propertize current-branch 'face `(:foreground "#98d1ce"))))
- (format " %s " (all-the-icons-fileicon "gn"))
- (propertize (bd/get-prompt-path) 'face `(:foreground "#33859d"))
- (propertize (format-time-string " %a, %R") 'face `(:foreground "#888ba5"))
- (propertize "\n> " 'face `(:foreground "#c33027")))))
-
-(use-package eshell
- :bind (("C-z C-e" . 'eshell-open-buffer)
- :map eshell-mode-map
- ("C-q" . 'delete-window) ; mostly for side window
- ("<tab>" . completion-at-point))
- :custom
- (eshell-prompt-function 'bd/eshell-prompt)
- (eshell-prompt-regexp "^> ")
- (eshell-scroll-to-bottom-on-input 'this)
- (eshell-banner-message (concat "\n" (propertize " " 'display (create-image (expand-file-name "~/.config/emacs/images/raven.png") 'png nil :scale 0.2 :align-to "center")) "\n")))
-
-
-(use-package term
- :config
- (defalias 'term 'ansi-term))
diff --git a/.config/emacs/early-init.el b/.config/emacs/early-init.el
index a80caf9..671a562 100644
--- a/.config/emacs/early-init.el
+++ b/.config/emacs/early-init.el
@@ -1,14 +1,7 @@
;; -*- lexical-binding: t; -*-
-; external package manager
-(setq package-archives nil)
-
-
-(push '(menu-bar-lines . 0) default-frame-alist)
-(push '(tool-bar-lines . 0) default-frame-alist)
-(push '(background-color . "#000000") default-frame-alist)
-
+;;;; display load information + speedups
(defun bd/display-startup-time ()
(message "Emacs loaded in %s with %d garbage collections."
(format "%.2f seconds"
@@ -19,3 +12,22 @@
(add-hook 'emacs-startup-hook #'bd/display-startup-time)
(setq frame-inhibit-implied-resize t)
+
+;; reduce the frequency of garbage collection during startup
+;; by making it happen as little as possible
+;; TODO: `most-positive-fixnum' will pressure system memory if used
+;; as a permanent value
+(setopt gc-cons-threshold most-positive-fixnum
+ gc-cons-percentage 0.5)
+
+(add-hook 'emacs-startup-hook
+ (lambda ()
+ (setopt gc-cons-threshold (* 1024 1024 20)
+ gc-cons-percentage 0.2)))
+
+
+;;;; avoid-blinding startup
+(push '(menu-bar-lines . 0) default-frame-alist)
+(push '(tool-bar-lines . 0) default-frame-alist)
+(push '(background-color . "#000000") default-frame-alist)
+(push '(foreground-color . "#ffffff") default-frame-alist)
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
index 9d9e674..c6744d5 100644
--- a/.config/emacs/init.el
+++ b/.config/emacs/init.el
@@ -1,21 +1,57 @@
;; -*- lexical-binding: t; -*-
-;; reduce the frequency of garbage collection by making it happen on
-;; each 50MB of allocated data (the default is on every 0.76MB)
-(setopt gc-cons-threshold 50000000)
-
-;;;; do not store customized setting (automatic) here
-(setopt custom-file (expand-file-name "~/.config/emacs/custom.el"))
-(load custom-file t)
-
-;;;; files are segregated but not self-contained
-(load (expand-file-name "~/.config/emacs/bd-default.el"))
-(load (expand-file-name "~/.config/emacs/bd-org.el"))
-(load (expand-file-name "~/.config/emacs/bd-emms.el"))
-(load (expand-file-name "~/.config/emacs/bd-development.el"))
-(load (expand-file-name "~/.config/emacs/bd-wm.el"))
-(load (expand-file-name "~/.config/emacs/bd-mode-and-themes.el"))
-(load (expand-file-name "~/.config/emacs/bd-shells.el"))
-
-(setopt gc-cons-threshold 800000)
+;;;; auto-generated files
+;; disable the custom file by making it temporary
+(setopt custom-file (make-temp-file "emacs-custom-")
+ ;; disable lockfiles
+ create-lockfiles nil
+ ;; move auto-saves to tmp folder
+ auto-save-list-file-prefix (expand-file-name "tmp/auto_saves/sessions/" user-emacs-directory)
+ auto-save-file-transforms `((".*" ,(expand-file-name "tmp/auto_saves/" user-emacs-directory) t))
+ ;; move backups to tmp folder
+ backup-directory-alist `(("." . ,(expand-file-name "tmp/backups/" user-emacs-directory))))
+(make-directory (expand-file-name "tmp/auto_saves/" user-emacs-directory) t)
+
+
+;;;; path
+(setenv "PATH" (format "%s:%s" (expand-file-name "~/Personal/scripts/") (getenv "PATH")))
+
+
+;;;; configure packages
+;; external package manager
+(setopt package-archives nil
+ package-enable-at-startup t)
+(add-to-list 'load-path (expand-file-name "~/.guix-profile/share/emacs/site-lisp"))
+(guix-emacs-autoload-packages)
+;; use-package
+(require 'use-package-ensure)
+(setopt use-package-always-ensure t)
+;; (setq use-package-verbose t)
+
+
+;;;; add my modules to load path
+(mapc
+ (lambda (path)
+ (add-to-list 'load-path (locate-user-emacs-file path)))
+ '("modules" "libraries"))
+
+
+;;;; load modules
+(require 'bd--themes)
+(require 'bd--essentials)
+(require 'bd--essential-windowing)
+(require 'bd--rss)
+(require 'bd--eww)
+(require 'bd--dired)
+(require 'bd--image)
+(require 'bd--dictionary)
+(require 'bd--erc)
+(require 'bd--shells)
+(require 'bd--minibuffer)
+(require 'bd--devel)
+(require 'bd--org)
+(require 'bd--roam)
+(require 'bd--emms)
+(require 'bd--modeline)
+(require 'bd--exwm-windowing)
diff --git a/.config/emacs/modules/bd--devel.el b/.config/emacs/modules/bd--devel.el
new file mode 100644
index 0000000..34d14fc
--- /dev/null
+++ b/.config/emacs/modules/bd--devel.el
@@ -0,0 +1,67 @@
+;; -*- lexical-binding: t; -*-
+
+
+;;;; general
+(defun remote-shell ()
+ (interactive)
+ (let ((default-directory "/ssh:bdunahu@perch"))
+ (shell)))
+
+(defun request-sudo ()
+ "Uses TRAMP to edit current opened file as root."
+ (interactive)
+ (when buffer-file-name
+ (find-alternate-file
+ (concat "/sudo:root@localhost:"
+ buffer-file-name))))
+
+
+(setq compilation-always-kill t)
+
+(add-hook 'prog-mode-hook (lambda ()
+ (font-lock-add-keywords
+ nil '(("\\<\\(FIX\\(ME\\)?\\|TODO\\)"
+ 1 font-lock-warning-face t)))))
+
+
+(use-package company
+ :hook (prog-mode)
+ :custom
+ (company-set-idle-delay (lambda () (if (company-in-string-or-comment) nil 0.3)))
+ (company-minimum-prefix-length 1)
+ (company-tooltip-flip-when-above t)
+ (company-show-numbers t)
+ (company-tooltip-align-annotations t)
+ (company-tooltip-limit 15)
+ (company-selection-wrap-around t))
+
+(use-package magit
+ :commands magit-status
+ :custom
+ (magit-define-global-key-bindings 'recommended))
+
+
+(use-package tex
+ :ensure auctex
+ :hook
+ ((latex-mode)
+ (text-mode . (lambda() (setq ispell-parser 'tex)))) ; improves ispell in LaTeX
+ :config
+ (push '(output-pdf "Zathura") TeX-view-program-selection)
+ :custom
+ (TeX-auto-save t)
+ ;; better support for latex packages
+ (TeX-parse-self t))
+
+(use-package slime
+ :commands slime
+ :config
+ (add-hook 'slime-mode-hook
+ (lambda ()
+ (local-set-key (kdb "C-c C-k") 'slime-eval-buffer)))
+ :custom
+ ;; more memory for ml libraries
+ (inferior-lisp-program "sbcl --dynamic-space-size 4096"))
+
+
+(provide 'bd--devel)
diff --git a/.config/emacs/modules/bd--dictionary.el b/.config/emacs/modules/bd--dictionary.el
new file mode 100644
index 0000000..35c93ca
--- /dev/null
+++ b/.config/emacs/modules/bd--dictionary.el
@@ -0,0 +1,9 @@
+;; -*- lexical-binding: t; -*-
+
+
+(keymap-global-set "C-c i" 'dictionary-lookup-definition)
+(setopt dictionary-server "localhost"
+ dictionary-use-single-buffer t)
+
+
+(provide 'bd--dictionary)
diff --git a/.config/emacs/modules/bd--dired.el b/.config/emacs/modules/bd--dired.el
new file mode 100644
index 0000000..0304435
--- /dev/null
+++ b/.config/emacs/modules/bd--dired.el
@@ -0,0 +1,21 @@
+;; -*- lexical-binding: t; -*-
+
+
+(keymap-global-set "C-c d" 'dired-jump)
+
+(setopt dired-listing-switches "-alhLG --time-style=long-iso --group-directories-first"
+
+ dired-recursive-copies 'always
+ dired-recursive-deletes 'always
+
+ ;; "dwim": guess where to move files
+ dired-dwim-target t
+
+ dired-guess-shell-alist-user
+ `((,(regexp-opt '(".mkv" ".mov" ".mp4" ".webm" ".m4v" ".wav" ".mp3" ".opus" ".ogv" ".flac")) "mpv &")
+ (,(regexp-opt '(".jpeg" ".jpg" ".png")) "feh &")
+ (,(regexp-opt '(".pdf")) "zathura &")
+ (,(regexp-opt '(".html")) "icecat &")))
+
+
+(provide 'bd--dired)
diff --git a/.config/emacs/bd-emms.el b/.config/emacs/modules/bd--emms.el
index 573f275..40acf36 100644
--- a/.config/emacs/bd-emms.el
+++ b/.config/emacs/modules/bd--emms.el
@@ -1,5 +1,6 @@
;; -*- lexical-binding: t; -*-
+
(defun emms-open-playlist-buffer ()
"Opens the current playlist in the right
side window."
@@ -37,4 +38,10 @@ playback."
(emms-volume-change-function 'emms-volume-mpd-change)
;; misc
(emms-mode-line-format "%s ")
- (emms-playlist-buffer-name "*Playlist*"))
+ (emms-playlist-buffer-name "*Playlist*")
+ (require 'all-the-icons)
+ (emms-mode-line-icon-before-format (format "%s" (all-the-icons-fileicon "owl")))
+ (emms-mode-line-icon-enabled-p t))
+
+
+(provide 'bd--emms)
diff --git a/.config/emacs/modules/bd--erc.el b/.config/emacs/modules/bd--erc.el
new file mode 100644
index 0000000..c001834
--- /dev/null
+++ b/.config/emacs/modules/bd--erc.el
@@ -0,0 +1,12 @@
+;; -*- lexical-binding: t; -*-
+
+
+(with-eval-after-load "erc" (defalias 'erc 'erc-tls))
+(setopt erc-lurker-threshold-time 3600
+ erc-server "irc.libera.chat"
+ erc-nick "Isaz"
+ erc-kill-buffer-on-part t
+ erc-autojoin-channels-alist '(("irc.libera.chat" "#parabola" "#emacs" "#guix")))
+
+
+(provide 'bd--erc)
diff --git a/.config/emacs/modules/bd--essential-windowing.el b/.config/emacs/modules/bd--essential-windowing.el
new file mode 100644
index 0000000..bba3dee
--- /dev/null
+++ b/.config/emacs/modules/bd--essential-windowing.el
@@ -0,0 +1,30 @@
+;; -*- lexical-binding: t; -*-
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; This file contains sane windowing settings for any ;;
+;; environment type. ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(menu-bar-mode -1)
+(tool-bar-mode -1)
+(scroll-bar-mode -1)
+
+;; allow one side window per side of frame
+(setopt window-sides-slots '(1 1 1 1))
+
+;; alpha
+(defun bd/clamp (lower-bound upper-bound value)
+ (max lower-bound (min value upper-bound)))
+
+(defun set-frame-alpha (value)
+ "Sets the transparency of the frame background. 0=transparent/100=opaque"
+ (interactive "nTransparency Value (30 - 100 opaque): ")
+ (setq value (bd/clamp 30 100 value))
+ (set-frame-parameter (selected-frame) 'alpha `(,value . ,value))
+ (message "Alpha set to %d" value))
+(add-to-list 'default-frame-alist '(alpha . (82 . 82)))
+
+
+(provide 'bd--essential-windowing)
diff --git a/.config/emacs/modules/bd--essentials.el b/.config/emacs/modules/bd--essentials.el
new file mode 100644
index 0000000..cc51202
--- /dev/null
+++ b/.config/emacs/modules/bd--essentials.el
@@ -0,0 +1,62 @@
+;; -*- lexical-binding: t; -*-
+
+
+;;;; standard bindings
+;; both of these are bad--especially in exwm
+(global-unset-key (kbd "C-z"))
+(global-unset-key (kbd "C-x C-z"))
+
+(global-set-key (kbd "C-z =") 'text-scale-increase)
+(global-set-key (kbd "C-z -") 'text-scale-decrease)
+
+
+;;;; UI
+(setopt inhibit-startup-message t)
+
+;; line numbers
+(require 'display-line-numbers)
+(global-display-line-numbers-mode)
+(global-visual-line-mode t)
+(setopt display-line-numbers-type 'relative)
+(global-hl-line-mode 1)
+
+(defcustom display-line-numbers-exempt-modes
+ '(vterm-mode eshell-mode shell-mode term-mode ansi-term-mode image-mode doc-view-mode newsticker-treeview-mode newsticker-treeview-item-mode dired-mode org-agenda-mode)
+ "Major modes on which to disable line numbers."
+ :group 'display-line-numbers
+ :type 'list
+ :version "green")
+
+(defun display-line-numbers--turn-on ()
+ "Turn on line numbers except for certain major modes.
+Exempt major modes are defined in `display-line-numbers-exempt-modes'."
+ (unless (or (minibufferp)
+ (member major-mode display-line-numbers-exempt-modes))
+ (display-line-numbers-mode)))
+
+
+;;;; defaults
+;; basic editing
+(setopt kill-whole-line t)
+
+(defun bd/cleanup-buffer ()
+ (interactive)
+ (delete-trailing-whitespace)
+ (untabify (point-min) (point-max))
+ (indent-region (point-min) (point-max)))
+
+(setopt next-line-add-newlines t)
+(add-hook 'before-save-hook 'bd/cleanup-buffer)
+
+
+;;;; buffers
+(global-auto-revert-mode 1)
+(winner-mode 1)
+;; do not show async command buffers by default
+(add-to-list 'display-buffer-alist
+ (cons "\\*Async Shell Command\\*.*" (cons #'display-buffer-no-window nil)))
+(setopt scroll-up-aggressively '0.65
+ scroll-down-aggressively '0.65)
+
+
+(provide 'bd--essentials)
diff --git a/.config/emacs/modules/bd--eww.el b/.config/emacs/modules/bd--eww.el
new file mode 100644
index 0000000..7bde428
--- /dev/null
+++ b/.config/emacs/modules/bd--eww.el
@@ -0,0 +1,25 @@
+;; -*- lexical-binding: t; -*-
+
+
+;; do not use an external browser
+(setopt browse-url-browser-function 'eww-browse-url
+ shr-use-fonts nil
+ shr-cookie-policy nil
+ shr-max-width 85
+ ;; send only user agent
+ url-privacy-level '(email os emacs lastloc cookies)
+ eww-search-prefix "https://searx.be/search?q="
+ eww-auto-rename-buffer 'title
+ eww-use-browse-url (regexp-opt '("mailto:"
+ "youtube.com"
+ "youtu.be"
+ "yewtu.be"
+ "vid.puffyan.us"))
+ browse-url-handlers
+ `((,(regexp-opt'("youtube.com" "youtu.be" "yewtu.be" "vid.puffyan.us")) .
+ (lambda (url &rest _)
+ (message "Ludu %s" url)
+ (start-process-shell-command "rip-video" nil (concat "rip-video " url))))))
+
+
+(provide 'bd--eww)
diff --git a/.config/emacs/bd-wm.el b/.config/emacs/modules/bd--exwm-windowing.el
index 9d7f60a..a275f5a 100644
--- a/.config/emacs/bd-wm.el
+++ b/.config/emacs/modules/bd--exwm-windowing.el
@@ -1,6 +1,15 @@
;; -*- lexical-binding: t; -*-
+;;;; utilities
+;; desktop
+(use-package desktop-environment
+ :custom
+ (desktop-environment-screenshot-directory (xdg-user-dir "PICTURES"))
+ (desktop-environment-screenshot-command "flameshot full")
+ (desktop-environment-screenshot-partial-command "flameshot launcher"))
+
+
(defun bd/exwm-update-class ()
"Changes the buffer name to reflect the class name for
that buffer."
@@ -10,6 +19,7 @@ that buffer."
"Make workspace 1 the default startup workspace."
(exwm-workspace-switch-create 1))
+
(defun toggle-current-window-dedication ()
"Adds or revokes dedicated window status from a buffer. A
dedicated buffer will never be automatically orphaned."
@@ -21,6 +31,8 @@ dedicated buffer will never be automatically orphaned."
(if dedicated "no longer " "")
(buffer-name))))
+
+;;;; bookmarks, passwords
(defun insert-bookmark ()
"Inserts a url or string from permanent
bookmark file. If an x window, place in kill-ring."
@@ -48,7 +60,12 @@ select a line from a file."
(point-max)))
"\n" t)))
+(use-package password-store
+ :custom
+ (password-store-time-before-clipboard-restore 20)
+ (define-key global-map (kbd "C-c k") #'password-store-copy))
+;; emacs-pinentry; wonderful in EXWM, has security flaws
(use-package pinentry
:init
(pinentry-start)
@@ -63,22 +80,15 @@ select a line from a file."
;; order is important
(require 'exwm-randr)
(exwm-randr-enable)
- ;; (start-process-shell-command "xrandr" nil "/home/bdunahu/.config/emacs/exwm_xrandr.sh")
+ ;; because my nvidia driver is currently unsupported with nouveau,
+ ;; xrandr seems to be entirely broken. This line is only here for
+ ;; future reference
+ ;;(start-process-shell-command "xrandr" nil (expand-file-name "exwm_xrandr.sh" user-emacs-directory))
(start-process-shell-command "picom" nil "picom")
(start-process-shell-command "bg" nil "set-bg")
(start-process-shell-command "xrate" nil "xset r rate 250 70")
- (dolist (k '(("s-L" "slock")
- ("s-B" "icecat")
- ("s-P" "passmenu --type")
- ("<f2>" "brightnessctl set 1%-")
- ("<f3>" "brightnessctl set 1%+")
- ("<f6>" "pactl set-sink-mute @DEFAULT_SINK@ toggle")
- ("<f7>" "pactl set-sink-volume @DEFAULT_SINK@ -10%")
- ("<f8>" "pactl set-sink-volume @DEFAULT_SINK@ +5%")
- ("<f9>" "mpc prev")
- ("<f11>" "mpc next")
- ("<print>" "flameshot launcher")))
+ (dolist (k '(("s-B" "icecat")))
(let ((f (lambda () (interactive)
(save-window-excursion
(start-process-shell-command (cadr k) nil (cadr k))))))
@@ -105,11 +115,21 @@ select a line from a file."
([?\s-p] . (lambda ()
(interactive)
(other-window -1)))
+ ([?\s-L] . desktop-environment-lock-screen)
+ ([f2] . desktop-environment-brightness-decrement)
+ ([f3] . desktop-environment-brightness-increment)
+ ([f7] . emms-volume-lower)
+ ([f8] . emms-volume-raise)
+ ([f9] . emms-next)
+ ([f10] . emms-pause)
+ ([f11] . emms-previous)
+ ([print] . desktop-environment-screenshot-part)
+ ([S-print] . desktop-environment-screenshot)
([?\s-O] . insert-bookmark)
+ ([?\s-P] . password-store-copy)
([?\s-r] . exwm-reset)
([?\s-d] . toggle-current-window-dedication)
([?\s-q] . kill-current-buffer)
- ;; ([?\s-<f10>] . emms-pause) ; see rest of mpc commands above--mpc pause performed poorly
([?\s-x] . (lambda (command)
(interactive (list (read-shell-command "s-x ")))
(start-process-shell-command command nil command)))
@@ -142,4 +162,7 @@ select a line from a file."
(exwm-workspace-show-all-buffers t)
(exwm-layout-show-all-buffers t)
- (exwm-randr-workspace-monitor-plist '(0 "DVI-D-1" 2 "DVI-D-1" 4 "DVI-D-1" 6 "DVI-D-1" 8 "DVI-D-1")))
+ (exwm-randr-workspace-monitor-plist '(0 "HDMI-1" 6 "HDMI-1" 7 "HDMI-1" 8 "HDMI-1" 9 "HDMI-1")))
+
+
+(provide 'bd--exwm-windowing)
diff --git a/.config/emacs/modules/bd--image.el b/.config/emacs/modules/bd--image.el
new file mode 100644
index 0000000..3dd2526
--- /dev/null
+++ b/.config/emacs/modules/bd--image.el
@@ -0,0 +1,23 @@
+;; -*- lexical-binding: t; -*-
+
+
+(require 'image-mode)
+(defun toggle-mode-line ()
+ "If the mode line is displayed, toggle it off.
+If the mode line is off, set it to the default value."
+ (interactive)
+ (setq mode-line-format
+ (if mode-line-format
+ nil
+ (default-value 'mode-line-format))))
+
+
+;;;; hooks
+(add-hook 'image-mode-hook 'toggle-mode-line)
+
+
+;;;; binds
+(keymap-set image-mode-map "l" #'toggle-mode-line)
+
+
+(provide 'bd--image)
diff --git a/.config/emacs/modules/bd--minibuffer.el b/.config/emacs/modules/bd--minibuffer.el
new file mode 100644
index 0000000..83b0d08
--- /dev/null
+++ b/.config/emacs/modules/bd--minibuffer.el
@@ -0,0 +1,34 @@
+;; -*- lexical-binding: t; -*-
+
+
+(setopt use-short-answers t
+ vc-follow-symlinks t
+ ;; order to try completions
+ completion-styles '(substring
+ initials
+ flex
+ orderless)
+ ;; required for exwm (pass) but
+ ;; always useful
+ enable-recursive-minibuffers t)
+(minibuffer-depth-indicate-mode 1)
+
+
+(use-package vertico
+ :init
+ (vertico-mode)
+ :custom
+ (vertico-cycle t))
+
+(use-package marginalia
+ :init
+ (marginalia-mode))
+
+(use-package orderless
+ :custom
+ (setopt completion-styles '(orderless basic)
+ completion-category-defaults nil
+ completion-category-overrides '((file (styles partial-completion)))))
+
+
+(provide 'bd--minibuffer)
diff --git a/.config/emacs/modules/bd--modeline.el b/.config/emacs/modules/bd--modeline.el
new file mode 100644
index 0000000..b092081
--- /dev/null
+++ b/.config/emacs/modules/bd--modeline.el
@@ -0,0 +1,126 @@
+;; -*- lexical-binding: t; -*-
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Highly customized modeline. Note this currently requires ;;
+;; many of the previous modules to be loaded to function properly. ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun mode-line-fill (reserve)
+ "Return empty space, leaving RESERVE space on the right."
+ (unless reserve
+ (setq reserve 20))
+ (when (and window-system (eq 'right (get-scroll-bar-mode)))
+ (setq reserve (- reserve 3)))
+ (propertize " "
+ 'display `((space :align-to (- (+ right right-fringe right-margin) ,reserve)))))
+
+
+;;;; remove mode-line-clutter
+(define-minor-mode minor-mode-blackout-mode
+ "Hides minor modes from the mode line."
+ t)
+
+(catch 'done
+ (mapc (lambda (x)
+ (when (and (consp x)
+ (equal (cadr x) '("" minor-mode-alist)))
+ (let ((original (copy-sequence x)))
+ (setcar x 'minor-mode-blackout-mode)
+ (setcdr x (list "" original)))
+ (throw 'done t)))
+ mode-line-modes))
+
+(global-set-key (kbd "C-c m") 'minor-mode-blackout-mode)
+
+
+;;;; time and date
+(setq display-time-format "%m/%d/%y %H:%M (%a)"
+ display-time-default-load-average nil)
+(display-time)
+
+(defvar-local bd/time-mode-line
+ '(:eval
+ (when (mode-line-window-selected-p)
+ display-time-string))
+ "displays current time and date in selected window.")
+
+
+;;;; notification-server
+(use-package ednc
+ :init
+ (defun get-num-notifications ()
+ "Return number of active notifcations as a string."
+ (format "%s" (length (ednc-notifications))))
+
+ (defvar-local bd/notify-mode-line
+ '(:eval (when (and (ednc-notifications) (mode-line-window-selected-p))
+ (format " %s %s" (all-the-icons-material "notifications_active")
+ (propertize (get-num-notifications) 'face 'error))))
+ "Formats the notification number.")
+ (ednc-mode))
+
+
+;;;; buffer name
+(defun modeline-buffer-name ()
+ "Return 'buffer-name' with proper spacing and icon."
+ (format " %s %s" (all-the-icons-icon-for-file (buffer-name)) (buffer-name)))
+
+(defvar-local bd/buffer-identification-mode-line
+ '(:eval (format "%s" (modeline-buffer-name)))
+ "Formats the modeline-buffer-name.")
+
+
+;;;; git
+(defun git-vc-modeline ()
+ (let ((branch (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-")))
+ (concat
+ (propertize (format " %s" (all-the-icons-octicon "git-branch"))
+ 'face `(:height 1 :family ,(all-the-icons-octicon-family))
+ 'display '(raise 0))
+ (propertize (format " %s" branch))
+ (propertize " "))))
+
+(defvar-local bd/vc-mode-line
+ '(:eval (when (and vc-mode (not (eq major-mode 'magit-status-mode))) ; temp fix to avoid bug which occurs in magit buffer
+ (format "%s"
+ (propertize (git-vc-modeline) 'face 'shadow))))
+ "Formats the checked out git repository.")
+
+
+;;;; emms
+(defvar-local bd/emms-mode-line
+ '(:eval (when (and (mode-line-window-selected-p) emms-mode-line-string)
+ (format "%s %s" emms-mode-line-string
+ emms-playing-time-string)))
+ "Formats the currently playing emms track.")
+
+
+(dolist (construct '(bd/time-mode-line
+ bd/notify-mode-line
+ bd/buffer-identification-mode-line
+ bd/vc-mode-line
+ bd/emms-mode-line))
+ (put construct 'risky-local-variable t))
+
+
+(setq-default mode-line-format
+ (list
+ mode-line-front-space
+ ;; mode-line-mule-info
+ ;; mode-line-frame-identification
+ bd/buffer-identification-mode-line
+ " "
+ mode-line-modes
+ " "
+ ;; mode-line-position
+ mode-line-modified
+ bd/notify-mode-line
+ bd/vc-mode-line
+ " "
+ bd/emms-mode-line
+ (mode-line-fill 21)
+ bd/time-mode-line))
+
+
+(provide 'bd--modeline)
diff --git a/.config/emacs/modules/bd--org.el b/.config/emacs/modules/bd--org.el
new file mode 100644
index 0000000..c4ade63
--- /dev/null
+++ b/.config/emacs/modules/bd--org.el
@@ -0,0 +1,87 @@
+;; -*- lexical-binding: t; -*-
+
+
+(defvar-local agenda-file "~/Personal/roam/agenda/agenda_tasks.org")
+
+(defun bd/org-mode-setup-hook ()
+ "Sets up improved org-mode defaults upon
+each org file open."
+ (org-indent-mode)
+ (org-toggle-inline-images)
+ (org-toggle-pretty-entities))
+
+;; hooks
+(add-hook 'org-mode-hook 'bd/org-mode-setup-hook)
+
+;; binds
+(keymap-global-set "C-c n a" 'org-agenda)
+(keymap-global-set "C-c n c" 'org-capture)
+(keymap-global-set "C-c n s" 'org-schedule)
+(keymap-global-set "C-c n d" 'org-deadline)
+(keymap-global-set "C-c n r" 'org-refile)
+
+;; source blocks
+(org-babel-do-load-languages
+ 'org-babel-load-languages
+ '((emacs-lisp . t)
+ (python . t)
+ (shell . t)
+ (lisp . t)))
+
+;; standard
+(setopt org-startup-folded 'show2levels
+ org-ellipsis " ▾")
+
+;; agenda
+(advice-add 'org-refile :after 'org-save-all-org-buffers) ; after refiling tasks, save all buffers
+
+(setopt org-agenda-files
+ `(,agenda-file "~/Personal/roam/agenda/archived_tasks.org")
+
+ org-deadline-warning-days 7
+ org-log-done 'time
+ org-log-into-drawer "history"
+
+ org-todo-keywords
+ '((sequence "TODO(t)" "NEXT(n!)" "|" "DONE(d)" "CANC(c)"))
+
+ org-refile-targets ; refile into the headings of these files, not tags
+ '(("archived_tasks.org" :maxlevel . 1)
+ ("agenda_tasks.org" :maxlevel . 1))
+
+ org-capture-templates
+ `(("t" " Tasks")
+ ("ts" "Software Testing" entry (file+olp ,agenda-file "CS415")
+ "* TODO %?\n DEADLINE: %^t")
+ ("tm" "Machine Learning" entry (file+olp ,agenda-file "CS445")
+ "* TODO %?\n DEADLINE: %^t")
+ ("tp" "Programming Languages" entry (file+olp ,agenda-file "CS454")
+ "* TODO %?\n DEADLINE: %^t")
+ ("tc" "Creative Writing" entry (file+olp ,agenda-file "E210")
+ "* TODO %?\n DEADLINE: %^t")
+ ("s" " Self")
+ ("s" "Unsorted Task" entry (file+olp ,agenda-file "Self")
+ "* TODO %?\n %^t\n %a"))
+
+ org-agenda-custom-commands
+ '(("S" "Standard Block Agenda"
+ ((tags-todo "*"
+ ((org-agenda-skip-function '(org-agenda-skip-if nil '(timestamp)))
+ (org-agenda-block-separator nil)
+ (org-agenda-overriding-header "Undated Tasks\n")))
+ (agenda "" ((org-agenda-span 8)
+ (org-deadline-warning-days 0)
+ (org-agenda-block-separator nil)
+ (org-scheduled-past-days 4)
+ (org-agenda-overriding-header "\nUpcoming Tasks\n")))
+ (agenda "" ((org-agenda-time-grid nil)
+ (org-agenda-show-all-dates nil)
+ (org-agenda-span 21)
+ (org-deadline-warning-days 0)
+ (org-agenda-block-separator nil)
+ (org-agenda-entry-types '(:deadline))
+ (org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done))
+ (org-agenda-overriding-header "\nFuture Deadlines (+21d)\n")))))))
+
+
+(provide 'bd--org)
diff --git a/.config/emacs/modules/bd--roam.el b/.config/emacs/modules/bd--roam.el
new file mode 100644
index 0000000..21cf573
--- /dev/null
+++ b/.config/emacs/modules/bd--roam.el
@@ -0,0 +1,38 @@
+;; -*- lexical-binding: t; -*-
+
+
+(defun org-roam-node-insert-immediate (arg &rest args)
+ "Insert a new org mode link, but do not open the
+file."
+ (interactive "P")
+ (let ((args (cons arg args))
+ (org-roam-capture-templates (list (append (car org-roam-capture-templates)
+ '(:immediate-finish t)))))
+ (apply #'org-roam-node-insert args)))
+
+(use-package org-roam
+ :after org
+ :bind (("C-c n l" . 'org-roam-buffer-toggle)
+ ("C-c n f" . 'org-roam-node-find)
+ ("C-c n i" . 'org-roam-node-insert)
+ ("C-c n g" . 'org-roam-graph)
+ ("C-c n I" . 'org-roam-node-insert-immediate)
+ ("C-c n j" . 'org-roam-dailies-capture-today)
+ :map org-mode-map
+ ("C-M-i" . 'completion-at-point))
+ :config
+ (org-roam-db-autosync-mode)
+ :custom
+ (org-roam-directory (expand-file-name "~/Personal/roam/"))
+ (org-roam-dailies-directory "logs/")
+ (org-roam-complete-everywhere t)
+ (org-roam-capture-templates '(("e" "extend" plain
+ "#+AUTHOR: bdunahu\n#+DESCRIPTION: %^{Description}\n#+STARTUP: show3levels\n" :target
+ (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title}")
+ :unnarrowed t)
+ ("d" "default" plain "%?" :target
+ (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}")
+ :unnarrowed t))))
+
+
+(provide 'bd--roam)
diff --git a/.config/emacs/modules/bd--rss.el b/.config/emacs/modules/bd--rss.el
new file mode 100644
index 0000000..6cd8507
--- /dev/null
+++ b/.config/emacs/modules/bd--rss.el
@@ -0,0 +1,24 @@
+;; -*- lexical-binding: t; -*-
+
+
+(keymap-global-set "C-z C-n" 'newsticker-show-news)
+
+(setopt newsticker-url-list-defaults nil
+ newsticker-automatically-mark-items-as-old nil
+ newsticker-url-list '(("Ambrose and Elsewhere" "https://jamesenge.com/engeblog/feed" nil nil nil)
+ ("James Enge Mastodon" "https://mastodon.sdf.org/@jamesenge.rss" nil nil nil)
+ ("Tales From the Magician's Skull" "https://goodman-games.com/tftms/category/book-reviews/feed" nil nil nil)
+ ("Parabola GNU/Linux-libre" "https://www.parabola.nu/feeds/news/" nil nil nil)
+ ("suckless.org news" "https://suckless.org/atom.xml" nil nil nil)
+ ("Mental Outlaw" "https://vid.puffyan.us/feed/channel/UC7YOGHUfC1Tb6E4pudI9STA" nil nil nil)
+ ("Luke Smith" "https://vid.puffyan.us/feed/channel/UC2eYFnH61tmytImy1mTYvhA" nil nil nil)
+ ("Bugswriter" "https://yewtu.be/feed/channel/UCngn7SVujlvskHRvRKc1cTw" nil nil nil)
+ ("Protesilaos Stravrou" "https://yewtu.be/feed/playlist/PL8Bwba5vnQK14z96Gil86pLMDO2GnOhQ6" nil nil nil))
+ ;; may require ./newsticker/groups to be cleared
+ newsticker-groups '("Feeds"
+ ("READING" "James Enge Mastodon" "Tales From the Magician's Skull" "Ambrose and Elsewhere")
+ ("TECH" "Parabola GNU/Linux-libre" "suckless.org news")
+ ("VIDEO" "Mental Outlaw" "Luke Smith" "Bugswriter" "Protesilaos Stravrou")))
+
+
+(provide 'bd--rss)
diff --git a/.config/emacs/modules/bd--shells.el b/.config/emacs/modules/bd--shells.el
new file mode 100644
index 0000000..8bcd9c4
--- /dev/null
+++ b/.config/emacs/modules/bd--shells.el
@@ -0,0 +1,57 @@
+;; -*- lexical-binding: t; -*-
+
+
+(require 'all-the-icons)
+
+
+;;;; term
+(defalias 'term 'ansi-term)
+
+
+;;;; eshell
+(defun eshell-open-buffer ()
+ "Opens eshell in the bottom
+side window."
+ (interactive)
+ (let ((curr-buffer (current-buffer))
+ (eshell (eshell)))
+ (switch-to-buffer curr-buffer)
+ (display-buffer-in-side-window (get-buffer eshell) '((side . top)))
+ (switch-to-buffer-other-window eshell)))
+
+
+(defun bd/get-prompt-path ()
+ (abbreviate-file-name (eshell/pwd)))
+
+(defun bd/eshell-prompt ()
+ "Assemble a shell prompt including host, git
+status, and path."
+ (concat
+ "\n"
+ (propertize (system-name) 'face `(:foreground "#edb54b"))
+ (format " %s " (all-the-icons-fileicon "gn"))
+ (propertize (bd/get-prompt-path) 'face `(:foreground "#33859d"))
+ (propertize (format-time-string " %a, %R") 'face `(:foreground "#888ba5"))
+ (propertize "\n> " 'face `(:foreground "#c33027"))))
+
+
+(require 'esh-mode)
+(keymap-global-set "C-z C-e" 'eshell-open-buffer)
+(keymap-set eshell-mode-map "C-q" 'delete-window) ; mostly for side window
+(keymap-set eshell-mode-map "<tab>" 'completion-at-point) ; mostly for side window
+(setopt eshell-prompt-function 'bd/eshell-prompt
+ eshell-prompt-regexp "^> "
+ eshell-scroll-to-bottom-on-input 'this
+ eshell-banner-message (concat "\n" (propertize " " 'display (create-image (expand-file-name "~/.config/emacs/images/raven.png") 'png nil :scale 0.2 :align-to "center")) "\n"))
+
+
+;;;; shell
+(require 'shell)
+(keymap-set shell-mode-map "C-c C-k" #'comint-clear-buffer)
+(setopt shell-command-prompt-show-cwd t
+ shell-highlight-undef-enable t
+ shell-kill-buffer-on-exit t
+ comint-prompt-read-only t)
+
+
+(provide 'bd--shells)
diff --git a/.config/emacs/modules/bd--themes.el b/.config/emacs/modules/bd--themes.el
new file mode 100644
index 0000000..abf9887
--- /dev/null
+++ b/.config/emacs/modules/bd--themes.el
@@ -0,0 +1,40 @@
+;; -*- lexical-binding: t; -*-
+
+
+(defun modus-themes-custom-faces ()
+ (modus-themes-with-colors
+ (custom-set-faces
+ `(vertical-border ((,class :background ,bg-main
+ :foreground ,bg-main)))
+
+ `(mode-line-inactive ((,class :background ,bg-main
+ :foreground ,fg-active)))
+ `(mode-line-active ((,class :background ,bg-main
+ :foreground ,fg-active)))
+
+ `(hl-line ((,class :background ,magenta-nuanced-bg)))
+
+ `(emms-playlist-track-face ((,class :foreground ,blue-nuanced-fg)))
+ `(emms-playlist-selected-face ((,class :foreground ,fg-special-cold)))
+ `(emms-browser-track-face ((,class :foreground ,blue-nuanced-fg))))))
+
+(add-hook 'modus-themes-after-load-theme-hook #'modus-themes-custom-faces)
+
+(setopt modus-themes-italic-constructs t
+ modus-themes-bold-constructs t
+ modus-themes-hl-line '(accented)
+ modus-themes-subtle-line-numbers t
+ modus-themes-paren-match '(intense)
+ modus-themes-region '(bg-only)
+ modus-themes-syntax '(faint)
+ modus-themes-mode-line '(borderless)
+ modus-themes-org-blocks 'gray-background
+ modus-themes-headings '(
+ (1 . (rainbow overline))))
+
+(load-theme 'modus-vivendi t)
+
+(modus-themes-custom-faces)
+
+
+(provide 'bd--themes)