summaryrefslogtreecommitdiff
path: root/.config/emacs
diff options
context:
space:
mode:
authorbd <bdunahu@gmail.com>2023-12-25 22:22:24 -0700
committerbd <bdunahu@gmail.com>2023-12-25 22:22:24 -0700
commita7af6aa11b3980eae5ddfcc46c74347534c343dd (patch)
tree11331fc6c19261e74bdf4196a63238316b941f1d /.config/emacs
Initial dotfiles commit.
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/bd-development.el93
-rw-r--r--.config/emacs/bd-emms.el46
-rw-r--r--.config/emacs/bd-mode-and-themes.el151
-rw-r--r--.config/emacs/bd-org.el98
-rw-r--r--.config/emacs/bd-wm.el75
-rw-r--r--.config/emacs/bookmarks17
-rw-r--r--.config/emacs/init.el170
-rw-r--r--.config/emacs/slock/config.def.h12
l---------.config/emacs/slock/config.h1
9 files changed, 663 insertions, 0 deletions
diff --git a/.config/emacs/bd-development.el b/.config/emacs/bd-development.el
new file mode 100644
index 0000000..18bc6d5
--- /dev/null
+++ b/.config/emacs/bd-development.el
@@ -0,0 +1,93 @@
+;; -*- lexical-binding: t; -*-
+
+(defun cleanup-buffer ()
+ (interactive)
+ (delete-trailing-whitespace)
+ (untabify (point-min) (point-max))
+ (indent-region (point-min) (point-max)))
+
+(require 'display-line-numbers)
+
+(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 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))
+
+(use-package whole-line-or-region
+ :defer 15
+ :config
+ (whole-line-or-region-global-mode 1))
+
+(use-package python
+ :mode (("\\.py\\'" . python-ts-mode)))
+
+(use-package conda
+ :after python
+ :config
+ (conda-env-initialize-interactive-shells)
+ (custom-set-variables '(conda-anaconda-home "/home/bdunahu/miniforge3/"))
+ ;; kind of bad
+ (when (executable-find "ipython")
+ (setq python-shell-interpreter "ipython"
+ python-shell-interpreter-args "--simple-prompt")))
+
+;; compilation mode
+(setq compilation-always-kill t)
diff --git a/.config/emacs/bd-emms.el b/.config/emacs/bd-emms.el
new file mode 100644
index 0000000..cf39f94
--- /dev/null
+++ b/.config/emacs/bd-emms.el
@@ -0,0 +1,46 @@
+;; -*- lexical-binding: t; -*-
+
+(defun emms-open-playlist-buffer ()
+ "Opens the current playlist in the
+side window."
+ (interactive)
+ ;; if playlist open, open playlist view. Else, if browser open, open browser view. Else, print failure
+ (cond ((match-buffer-name "*Playlist*")
+ (display-buffer-in-side-window (get-buffer "*Playlist*") '((side . right)))
+ (select-window (get-buffer-window "*Playlist*")))
+ ((match-buffer-name "Browsing by: artist")
+ (display-buffer-in-side-window (get-buffer "Browsing by: artist") '((side . right)))
+ (select-window (get-buffer-window "Browsing by: artist")))
+ (t (message "No EMMS buffers open!"))))
+
+(defun emms-quickstart ()
+ "Queues a shuffled playlist and starts
+playback."
+ (interactive)
+ (emms-stop)
+ (when (bufferp emms-playlist-buffer-name)
+ (kill-buffer emms-playlist-buffer-name))
+ (emms-play-directory-tree (expand-file-name "~/Personal/mpd/music/"))
+ (emms-shuffle)
+ (emms-next))
+
+(use-package emms
+ ;; need to load immediately for mode line
+ :bind (("C-z C-m" . 'emms-open-playlist-buffer))
+ :config
+ (emms-all)
+ (add-to-list 'emms-info-functions 'emms-info-functions 'emms-info-mpd)
+ (add-to-list 'emms-player-list 'emms-player-mpd)
+ ;; refresh database
+ (emms-player-mpd-update-all-reset-cache)
+ :custom
+ ;; make sure mpd is configured similarly
+ (emms-player-mpd-server-name "localhost")
+ (emms-player-mod-server-port "6600")
+ ;; set dir and volume keys
+ (emms-player-mpd-music-directory "/home/bdunahu/Personal/mpd/music/")
+ (emms-source-file-default-directory "/home/bdunahu/Personal/mpd/playlists/")
+ (emms-volume-change-function 'emms-volume-mpd-change)
+ ;; misc
+ (emms-mode-line-format "%s ")
+ (emms-playlist-buffer-name "*Playlist*"))
diff --git a/.config/emacs/bd-mode-and-themes.el b/.config/emacs/bd-mode-and-themes.el
new file mode 100644
index 0000000..7f4104b
--- /dev/null
+++ b/.config/emacs/bd-mode-and-themes.el
@@ -0,0 +1,151 @@
+;; -*- 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
+ :init
+ (progn (progn (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."))
+
+ (progn (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.")))
+ :config
+ (setq emms-mode-line-icon-before-format (format "%s" (all-the-icons-fileicon "owl"))
+ emms-mode-line-icon-enabled-p t))
+
+;;;; time and date
+(setq display-time-format "%m/%d/%y %H:%M (%a)"
+ display-time-default-load-average nil)
+(display-time)
+(display-battery-mode 1)
+
+(defvar-local bd/misc-mode-line
+ '(:eval
+ (when (mode-line-window-selected-p)
+ global-mode-string))
+ "Displays misc mode line content (emms, time, etc.)
+only in the selected buffer.")
+
+(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)))))
+
+;;;; pad out space for time (this method is probably horrendous)
+(insert-into-list global-mode-string (mode-line-fill 21) (cl-position 'display-time-string global-mode-string))
+
+(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/vc-mode-line
+ " "
+ bd/misc-mode-line
+ (mode-line-fill 3)))
+
+;;;; 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)
+
+(global-display-line-numbers-mode)
+(global-visual-line-mode t)
+(setq display-line-numbers-type 'relative)
+;; required for other customizations later in themes.
+(global-hl-line-mode 1)
+
+;;;; true transparency
+(when (>= emacs-major-version 29)
+ (add-to-list 'default-frame-alist '(alpha-background . 60)))
+
+(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)
+
+(setq modus-themes-italic-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
new file mode 100644
index 0000000..7f3919f
--- /dev/null
+++ b/.config/emacs/bd-org.el
@@ -0,0 +1,98 @@
+;; -*- lexical-binding: t; -*-
+
+(defvar-local agenda-file "/home/bdunahu/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
+ "/home/bdunahu/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 "/home/bdunahu/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-wm.el b/.config/emacs/bd-wm.el
new file mode 100644
index 0000000..515f9c8
--- /dev/null
+++ b/.config/emacs/bd-wm.el
@@ -0,0 +1,75 @@
+;; -*- lexical-binding: t; -*-
+
+(defun bd/exwm-update-class ()
+ "Changes the buffer name to reflect the class name for
+that buffer."
+ (exwm-workspace-rename-buffer exwm-class-name))
+
+(winner-mode 1)
+
+(use-package exwm
+ :config
+ (add-hook 'exwm-update-class-hook #'bd/exwm-update-class)
+ ;; order is important
+ (require 'exwm-randr)
+ (exwm-randr-enable)
+ ;; (start-process-shell-command "xrandr" nil "/home/bdunahu/.config/emacs/exwm_xrandr.sh")
+ (start-process-shell-command "picom" nil "picom")
+ (start-process-shell-command "bg" nil "set-bg")
+ (start-process-shell-command "xmodmap" nil "xmodmap ~/.config/xmodmap.config")
+ (start-process-shell-command "xrate" nil "xset r rate 250 70")
+
+ (dolist (k '(("s-L" "slock")
+ ("s-B" "icecat")
+ ("s-<return>" "st")
+ ("s-O" "xdotool type $(grep -v '^#' /home/bdunahu/Personal/scripts/bookmarks.txt | dmenu -i -l 12 | awk '{print $NF}')")
+ ("s-P" "passmenu --type")
+ ("s-<f2>" "brightnessctl set 1%-")
+ ("s-<f3>" "brightnessctl set 1%+")
+ ("s-<f6>" "pactl set-sink-mute @DEFAULT_SINK@ toggle")
+ ("s-<f7>" "pactl set-sink-volume @DEFAULT_SINK@ -10%")
+ ("s-<f8>" "pactl set-sink-volume @DEFAULT_SINK@ +5%")
+ ("s-<f9>" "mpc prev")
+ ("s-<f11>" "mpc next")
+ ("<print>" "flameshot launcher")))
+ (let ((f (lambda () (interactive)
+ (save-window-excursion
+ (start-process-shell-command (cadr k) nil (cadr k))))))
+ (exwm-input-set-key (kbd (car k)) f)
+ (define-key exwm-mode-map (kbd (car k)) f)))
+
+ (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
+ (exwm-enable)
+ (server-start)
+ :custom
+ (exwm-workspace-number 10)
+ (exwm-input-prefix-keys
+ '(?\C-x
+ ?\C-u
+ ?\C-g
+ ?\C-h
+ ?\C-z
+ ?\M-x
+ ?\M-`
+ ?\M-&
+ ?\M-: ))
+ (exwm-input-global-keys
+ `(([?\s-n] . other-window)
+ ([?\s-p] . (lambda ()
+ (interactive)
+ (other-window -1)))
+ ([?\s-r] . exwm-reset)
+ ([?\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)))
+
+ ,@(mapcar (lambda (i)
+ `(,(kbd (format "s-%s" (car i))) .
+ (lambda ()
+ (interactive
+ (exwm-workspace-switch-create ,(car (cdr i)))))))
+ '((! 0) (@ 1) (\# 2) ($ 3) (% 4) (^ 5) (& 6) (* 7) (\( 8) (\) 9)))))
+
+ (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")))
diff --git a/.config/emacs/bookmarks b/.config/emacs/bookmarks
new file mode 100644
index 0000000..9a905cb
--- /dev/null
+++ b/.config/emacs/bookmarks
@@ -0,0 +1,17 @@
+;;;; Emacs Bookmark Format Version 1;;;; -*- coding: utf-8-emacs; mode: lisp-data -*-
+;;; This format is meant to be slightly human-readable;
+;;; nevertheless, you probably don't want to edit it.
+;;; -*- End Of Bookmark File Format Version Stamp -*-
+(("emacs-dired"
+ (filename . "~/.config/emacs/")
+ (front-context-string . "auto-save-list\n ")
+ (rear-context-string . "0K Dec 22 22:30 ")
+ (position . 187)
+ (last-modified 25991 13342 785210 917000))
+("agenda"
+ (filename . "~/Personal/roam/agenda/agenda_tasks.org")
+ (front-context-string . ":PROPERTIES:\n:ID")
+ (rear-context-string)
+ (position . 1)
+ (last-modified 25991 16926 960521 263000))
+)
diff --git a/.config/emacs/init.el b/.config/emacs/init.el
new file mode 100644
index 0000000..71d6cdf
--- /dev/null
+++ b/.config/emacs/init.el
@@ -0,0 +1,170 @@
+;; -*- 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)
+(setq gc-cons-threshold 50000000)
+
+(setenv "PATH" (format "%s:%s" "/home/bdunahu/Personal/scripts/" (getenv "PATH")))
+
+;;; do not store customized setting (automatic) here
+(setq custom-file "/home/bdunahu/.config/emacs/custom.el")
+(load custom-file t)
+
+(defun bd/display-startup-time ()
+ (message "Emacs loaded in %s with %d garbage collections."
+ (format "%.2f seconds"
+ (float-time
+ (time-subtract after-init-time before-init-time)))
+ gcs-done))
+
+(add-hook 'emacs-startup-hook #'bd/display-startup-time)
+
+(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 match-buffer-name (name)
+ "Returns non-nil if NAME matches the name of an existing buffer"
+ (try-completion name (mapcar #'buffer-name (buffer-list))))
+
+(defun toggle-current-window-dedication ()
+ "Adds or revokes dedicated window status from a buffer. A
+dedicated buffer will never be automatically orphaned."
+ (interactive)
+ (let* ((window (selected-window))
+ (dedicated (window-dedicated-p window)))
+ (set-window-dedicated-p window (not dedicated))
+ (message "Window %sdedicated to %s"
+ (if dedicated "no longer " "")
+ (buffer-name))))
+
+(defun 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))))
+ (message "Ludu %s" URL-OR-SEARCH)
+ (start-process-shell-command "rip-video" nil (concat "rip-video " URL-OR-SEARCH))))
+
+(defun clamp (lower-bound upper-bound value)
+ (max lower-bound (min value upper-bound)))
+
+(defun insert-into-list (list el n)
+ "Insert into list LIST an element EL at index N.
+
+If N is 0, EL is inserted before the first element.
+
+The resulting list is returned. As the list contents is mutated
+in-place, the old list reference does not remain valid."
+ (let* ((padded-list (cons nil list))
+ (c (nthcdr n padded-list)))
+ (setcdr c (cons el (cdr c)))
+ (cdr padded-list)))
+
+(defun remote-shell ()
+ (interactive)
+ (let ((default-directory "/ssh:bdunahu@perch.cs.colostate.edu:"))
+ (shell)))
+
+(global-unset-key (kbd "C-z"))
+
+(require 'package)
+(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
+(package-initialize)
+(package-refresh-contents)
+;; (setq use-package-verbose t) ; for debugging
+
+(require 'use-package-ensure)
+(setq use-package-always-ensure t)
+
+(load "/home/bdunahu/.config/emacs/bd-org.el")
+(load "/home/bdunahu/.config/emacs/bd-emms.el")
+(load "/home/bdunahu/.config/emacs/bd-development.el")
+
+(use-package newsticker
+ :demand t
+ :bind (("C-z C-g" . newsticker-show-news)
+ :map newsticker-treeview-item-mode-map
+ ("C-j" . 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)
+ ("Book Reviews | Tales From the Magician's Skull" "https://goodman-games.com/tftms/category/book-reviews/feed" nil nil nil)
+ ("Arch Linux: Recent news updates" "https://archlinux.org/feeds/news/" nil nil nil)
+ ("Parabola GNU/Linux-libre: Recent news updates" "https://www.parabola.nu/feeds/news/" nil nil nil)
+ ("suckless.org news" "https://suckless.org/atom.xml" nil nil nil)
+ ("Richard Stallman's Political News" "https://stallman.org/rss/rss.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" "Ambrose and Elsewhere" "James Enge Mastodon" "Book Reviews | Tales From the Magician's Skull")
+ ("TECH" ("GNU/Linux" "Arch Linux: Recent news updates" "Parabola GNU/Linux-libre: Recent news updates") "suckless.org news")
+ ("POLITICAL" "Richard Stallman's Political News")
+ ("VIDEO" "Mental Outlaw" "Luke Smith" "Brent Westbrook" "Bugswriter" "Protesilaos Stravrou"))))
+
+(setq erc-server "irc.libera.chat"
+ erc-nick "Isaz"
+ erc-user-full-name "bd"
+ erc-kill-buffer-on-part t
+ erc-autojoin-channels-alist '(("irc.libera.char" "#parabola" "#emacs")))
+(defalias 'erc 'erc-tls)
+
+;; dired
+(setq dired-listing-switches "-alh")
+
+(setq inhibit-startup-message t)
+(menu-bar-mode -1)
+(tool-bar-mode -1)
+(scroll-bar-mode -1)
+
+;; move backups to tmp folder
+(setq 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
+(setq 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)))
+
+(setq scroll-up-aggressively '0.0
+ scroll-down-aggressively '0.0)
+
+(global-auto-revert-mode 1)
+
+(setq fit-window-to-buffer-horizontally t)
+
+(ido-mode 1)
+;; allow same buffer on multiple frames
+(setq ido-default-buffer-method 'selected-window)
+
+;; allow one side window per side of frame
+(setq window-sides-slots '(1 1 1 1))
+
+(global-unset-key (kbd "C-x C-z")) ; unbind suspend-frame--terrible spot for binding
+
+;; dired
+(global-set-key (kbd "C-z d") 'dired-jump)
+
+;; text-scale
+(global-set-key (kbd "C-z =") 'text-scale-increase)
+(global-set-key (kbd "C-z -") 'text-scale-decrease)
+
+(load "/home/bdunahu/.config/emacs/bd-wm.el")
+(load "/home/bdunahu/.config/emacs/bd-mode-and-themes.el")
+
+(setq gc-cons-threshold 800000)
+
+;; packages to consider:
+;;; pydocs
+;;; yasnippit
diff --git a/.config/emacs/slock/config.def.h b/.config/emacs/slock/config.def.h
new file mode 100644
index 0000000..41133a8
--- /dev/null
+++ b/.config/emacs/slock/config.def.h
@@ -0,0 +1,12 @@
+/* user and group to drop privileges to */
+static const char *user = "nobody";
+static const char *group = "nobody";
+
+static const char *colorname[NUMCOLS] = {
+ [INIT] = "black", /* after initialization */
+ [INPUT] = "#404040", /* during input */
+ [FAILED] = "#4d0000", /* wrong password */
+};
+
+/* treat a cleared input like a wrong password (color) */
+static const int failonclear = 1;
diff --git a/.config/emacs/slock/config.h b/.config/emacs/slock/config.h
new file mode 120000
index 0000000..c6d6219
--- /dev/null
+++ b/.config/emacs/slock/config.h
@@ -0,0 +1 @@
+config.def.h \ No newline at end of file