diff options
| author | bd <bdunahu@operationnull.com> | 2025-12-13 23:43:10 -0500 |
|---|---|---|
| committer | bdunahu <bdunahu@operationnull.com> | 2026-01-03 21:46:06 -0700 |
| commit | 288ccb3984c7cb46b67d0f6bf7fb6d53c5d7a2d3 (patch) | |
| tree | 47091f5aeede90e1364546e8122cd55e6d7f2971 /guix/kolwynia/home/bdunahu/files/.config/emacs/libraries/fill-column.el | |
| parent | df14036eb22ff9326c2806eb3f8cafc0d3042efa (diff) | |
guix: full refactor of configuration structure
Diffstat (limited to 'guix/kolwynia/home/bdunahu/files/.config/emacs/libraries/fill-column.el')
| -rw-r--r-- | guix/kolwynia/home/bdunahu/files/.config/emacs/libraries/fill-column.el | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/guix/kolwynia/home/bdunahu/files/.config/emacs/libraries/fill-column.el b/guix/kolwynia/home/bdunahu/files/.config/emacs/libraries/fill-column.el new file mode 100644 index 0000000..2a70cd6 --- /dev/null +++ b/guix/kolwynia/home/bdunahu/files/.config/emacs/libraries/fill-column.el @@ -0,0 +1,39 @@ +;;; -*- lexical-binding: t; -*- +;;; Commentary: + +;; yanked from https://codeberg.org/daviwil/dotfiles/src/branch/master/emacs + +;;; Code: + + +(defvar fill-column-desired-width 120 + "The desired width of a document centered in the window.") + +(defun fill-column--adjust-margins () + "Resets window margins, then calculates the appropriate +margin given the window width and `fill-column-desired-width' +if fill-column-mode is t." + (set-window-parameter nil 'min-margins nil) + (set-window-margins nil nil) + (when fill-column-mode + (let ((margin-width (max 0 + (truncate + (/ (- (window-width) + fill-column-desired-width) + 2.0))))) + (when (> margin-width 0) + (set-window-parameter nil 'min-margins '(0 . 0)) + (set-window-margins nil margin-width margin-width))))) + +(define-minor-mode fill-column-mode + "Toggle centered text layout in the current buffer." + :lighter " Centered" + :group 'editing + (if fill-column-mode + (add-hook 'window-configuration-change-hook #'fill-column--adjust-margins 'append 'local) + (remove-hook 'window-configuration-change-hook #'fill-column--adjust-margins 'local)) + (fill-column--adjust-margins)) + + +(provide 'fill-column) +;;; fill-column ends here |
