GNU bug report logs -
#34387
26.1; Gnus: handle empty message parts
Previous Next
Full log
Message #31 received at 34387 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 14 February 2019 at 00:20 CET, Katsumi Yamaoka wrote:
>
> The point would be to delete only whitespace that mm-shr inserts.
> How about this?
>
> (defadvice mm-shr (around delete-leading-and-trailing-whitespace activate)
> "Delete leading and trailing whitespace in Gnus article buffer."
> (when (derived-mode-p 'gnus-article-mode)
> (save-restriction
> (narrow-to-region (point) (point))
> ad-do-it
> (goto-char (point-min))
> (skip-chars-forward "\t\n ")
> (delete-region (point-min) (point))
> (goto-char (point-max))
> (skip-chars-backward "\t\n ")
> (delete-region (point) (point-max))
> (insert "\n"))))
The point is to delete all trailing whitespace coming from the conversion of HTML to text. Without this, some emails (such as the one attached) are hard to read because the lines end with so many whitespaces that they take several lines on the screen (filled with spaces). The following does what I want (and does not trigger the bug, thanks to the narrowing).
(define-advice mm-shr (:around (oldfn &rest handle) delete-trailing-whitespace)
"Delete leading and trailing whitespace in Gnus article buffer."
(when (derived-mode-p 'gnus-article-mode)
(save-restriction
(narrow-to-region (point) (point))
(apply oldfn handle)
(delete-trailing-whitespace))))
Thanks,
C.
[1550139099.14508_1.poincare,U=88981:2,S (message/rfc822, attachment)]
This bug report was last modified 6 years and 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.