From 1fa027b074265ba912830ea832635bad27b61c9b Mon Sep 17 00:00:00 2001 From: Simon Parri Date: Thu, 25 Sep 2025 15:13:59 -0500 Subject: Emacs: Advise `message-newline-and-reformat' to add spaces at EOL --- common/.emacs.d/init.el | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/.emacs.d/init.el b/common/.emacs.d/init.el index 48a8d38..1cc30a8 100644 --- a/common/.emacs.d/init.el +++ b/common/.emacs.d/init.el @@ -1945,10 +1945,29 @@ buffer's text scale." (rx (or "simonparri@ganzeria.com" "simon@zoar.cx" "marsironpi@ba.ln.ea.cx" - "2025sparri@sullivan.k12.il.us"))) + "2025sparri@sullivan.k12.il.us")) + message-default-headers + "Content-Type: text/plain; format=flowed") :config (add-hooks 'message-mode-hook - 'electric-indent-mode)) + 'electric-indent-mode) + + (define-advice message-newline-and-reformat (:after (&rest _) flow) + (save-excursion + (let* ((bor (progn + (backward-paragraph) + (forward-line) ;; back onto paragraph text + (beginning-of-line) + (point))) + (eor (progn + (forward-paragraph) + (previous-line) ;; back onto paragraph text + (unless (= bor (point)) + (previous-line)) + (end-of-line) + (point)))) + (replace-regexp-in-region "\\([^ \t]\\)$" "\\1 " + bor eor))))) (use-package gnus :if (group-enabled-p 'mail) -- cgit v1.2.3