How to get format=flowed working in GNUs

Yusef Aslam - 03 Apr 2024

Tags: gnus,f=f,format=flowed

GNUs makes it very easy to enable format=flowed1.

Put this code in .emacs or .emacs.d/init.el:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;; format=flowed email messages
;; https://www.emacswiki.org/emacs/GnusFormatFlowed
(defun harden-newlines ()
  (save-excursion
    (goto-char (point-min))
    (while (search-forward "\n" nil t)
      (put-text-property (1- (point)) (point) 'hard t))))

(setq fill-flowed-display-column nil)

;; The following line is needed since emacs 24.1:
(setq gnus-treat-fill-long-lines nil)

(add-hook 'message-setup-hook
  (lambda ()
    (when message-this-is-mail
      (turn-off-auto-fill)
      (setq
	truncate-lines nil
	word-wrap t
	use-hard-newlines t))))

(add-hook 'message-send-hook
  (lambda ()
    (when use-hard-newlines
      (harden-newlines))))

(add-hook 'gnus-article-mode-hook
  (lambda ()
    (setq
      truncate-lines nil
      word-wrap t)))

Regenerated at : November 21, 2024 - 10:15:37 GMT