GNU bug report logs - #34387
26.1; Gnus: handle empty message parts

Previous Next

Package: emacs;

Reported by: Christophe Troestler <Christophe.Troestler <at> umons.ac.be>

Date: Fri, 8 Feb 2019 15:00:02 UTC

Severity: normal

Found in version 26.1

Done: Katsumi Yamaoka <yamaoka <at> jpl.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Christophe Troestler <Christophe.Troestler <at> umons.ac.be>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>
Cc: 34387 <at> debbugs.gnu.org
Subject: bug#34387: 26.1; Gnus: handle empty message parts
Date: Thu, 14 Feb 2019 13:30:34 +0100
[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 98 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.