bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34387: 26.1; Gnus: handle empty message parts


From: Katsumi Yamaoka
Subject: bug#34387: 26.1; Gnus: handle empty message parts
Date: Fri, 15 Feb 2019 07:50:14 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-cygwin)

On Thu, 14 Feb 2019 13:30:34 +0100, Christophe Troestler wrote:
> 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))))

I see.  But, sorry, I meant to do first was:

(define-advice mm-shr (:around (oldfn &rest handle) delete-trailing-whitespace)
  "Delete leading and trailing whitespace in Gnus article buffer."
  (if (derived-mode-p 'gnus-article-mode)
      (save-restriction
        (narrow-to-region (point) (point))
        (apply oldfn handle)
        (delete-trailing-whitespace))
    (apply oldfn handle)))

That is, not to do the whitespace deletion when mm-shr is used
in other than Gnus as it might require whitespace.  Anyway the
(when ...) way makes mm-shr work only in the Gnus article buffer.
:-p

Regards,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]