Major config overhaul: use custom modules, setup for multi-host config, and less boilerplate

This commit is contained in:
Emmet K
2025-02-09 16:50:26 -06:00
parent 1fa8b17b07
commit 0453901d17
303 changed files with 3560 additions and 5566 deletions

View File

@ -0,0 +1,55 @@
;;; line-wrapping-and-numbers.el --- basic line wrapping management library -*- lexical-binding: t; no-byte-compile: t; -*-
;;
;; Author: Emmet K <https://gitlab.com/librephoenix>
;; Maintainer: Emmet K <https://gitlab.com/librephoenix>
;; Source: https://github.com/librephoenix/nixos-config
;; Source: https://gitlab.com/librephoenix/nixos-config
;; Source: https://codeberg.org/librephoenix/nixos-config
;;
;;; Commentary:
;;
;; A basic line wrapping management library.
;; Turns on line wrapping for programming modes,
;; and turns it off for thinks like markdown and org.
;;
;;; Code:
;; Line wrapping management
(defun truncate-lines-off ()
"Stop truncating lines in current buffer."
(interactive)
(toggle-truncate-lines 0))
(defun truncate-lines-on ()
"Truncate lines in current buffer."
(interactive)
(toggle-truncate-lines 1))
(defun visual-line-mode-off ()
"Disable `visual-line-mode` in current buffer."
(interactive)
(visual-line-mode 0))
(add-hook 'org-mode-hook 'truncate-lines-off)
(add-hook 'markdown-mode-hook 'truncate-lines-off)
(add-hook 'org-mode-hook 'visual-line-mode)
(add-hook 'markdown-mode-hook 'visual-line-mode)
(add-hook 'prog-mode-hook 'truncate-lines-on)
(add-hook 'prog-mode-hook 'visual-line-mode-off)
(defun apply-proper-line-wrapping ()
"Apply proper line wrapping and visual line mode settings according to whether or not the current mode derives from `prog-mode`."
(if (derived-mode-p 'prog-mode)
(progn
(display-line-numbers-mode)
(truncate-lines-on)
(visual-line-mode-off)
(display-line-numbers-mode 1))
(progn
(truncate-lines-off)
(visual-line-mode)
(display-line-numbers-mode 0))))
(add-hook 'prog-mode-hook 'apply-proper-line-wrapping)
(add-hook 'org-mode-hook 'apply-proper-line-wrapping)
(if (featurep 'markdown-mode)
(add-hook 'markdown-mode-hook 'apply-proper-line-wrapping))
(if (featurep 'git-timemachine)
(add-hook 'git-timemachine-mode-hook 'apply-proper-line-wrapping))
;;; line-wrapping.el ends here