From a7e590d471e2cb973cf43c178339ba24d075e274 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Wed, 10 Jan 2024 19:24:29 +0100 Subject: Always set visual-line-mode to the intended state Since the article buffer is re-used, visual-line-mode will keep its previous state if not explicitly set. So before the patch 1. I display article 1, which should be wrapped: the hook sets visual-line-mode to t, 2. I display article 2, which should not be wrapped: truncate-lines is set to t, but visual-line-mode remains t (not a biggie, truncate-lines "wins"), 3. I decide I want to wrap article 2, so I call the visual-line-mode toggling command: visual-line-mode is set to nil; seemingly nothing happens. This patch dispels the confusion. --- .gnus | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gnus b/.gnus index 37a17af..056a1c6 100644 --- a/.gnus +++ b/.gnus @@ -189,8 +189,8 @@ (setq fill-column 80 my/centered-set-right-margin t) (my/centered-mode) - (when (my/gnus-article-should-wrap) - (visual-line-mode))) + (visual-line-mode + (unless (my/gnus-article-should-wrap) -1))) (add-hook 'gnus-article-prepare-hook 'my/gnus-article-setup) -- cgit v1.2.3