emacs-devel
[Top][All Lists]
Advanced

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

Gnus: Indicate undownloaded parts in MIME button


From: Tassilo Horn
Subject: Gnus: Indicate undownloaded parts in MIME button
Date: Sat, 16 May 2020 10:52:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi all,

right now it is possible to fetch only some parts of an article by
default as controlled by `nnimap-fetch-partial-articles'.  I had set it
to "text/" and then wondered why it seemed all attachments are broken.
Well, I haven't been aware of the fact that one has to invoke
`gnus-summary-show-complete-article' before being able to view/download
them.

Obviously, that was a usage error (I somehow assumed Gnus would download
the missing parts as soon as I act on them).  But that there's no
indication that a part hasn't been downloaded is still a bit annoying.
So I propose the following patch which makes the MIME buttons of empty
parts read like

  [ --- image/png (undownloaded, A C to fetch.)]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(the underlined part is the addition) and also mentions the binding in
the help-echo.

I'm no Gnus expert, so could someone have a look at that?

One limitation I'm aware of is that it doesn't differentiate between
"part intentionally not downloaded" and "broken zero-byte part" so it
would indicate the former also for the latter, and A C would result in
the very same button again.  (IMHO, that's not too bad...)

--8<---------------cut here---------------start------------->8---
modified   lisp/gnus/gnus-art.el
@@ -5833,6 +5833,7 @@ gnus-insert-mime-button
             "" "..."))
        (gnus-tmp-length (with-current-buffer (mm-handle-buffer handle)
                           (buffer-size)))
+        (help-echo "mouse-2: toggle the MIME part; down-mouse-3: more options")
        gnus-tmp-type-long b e)
     (when (string-match ".*/" gnus-tmp-name)
       (setq gnus-tmp-name (replace-match "" t t gnus-tmp-name)))
@@ -5841,6 +5842,16 @@ gnus-insert-mime-button
                                          (concat "; " gnus-tmp-name))))
     (unless (equal gnus-tmp-description "")
       (setq gnus-tmp-type-long (concat " --- " gnus-tmp-type-long)))
+    (when (= 0 gnus-tmp-length)
+      (setq gnus-tmp-type-long
+            (concat
+             gnus-tmp-type-long
+             (substitute-command-keys
+              (concat "\\<gnus-summary-mode-map> (undownloaded, "
+                      "\\[gnus-summary-show-complete-article] to fetch.)"))))
+      (setq help-echo
+            (concat "Type \\[gnus-summary-show-complete-article] "
+                    "to download complete article. ")))
     (setq b (point))
     (gnus-eval-format
      gnus-mime-button-line-format gnus-mime-button-line-format-alist
@@ -5859,8 +5870,7 @@ gnus-insert-mime-button
      'keymap gnus-mime-button-map
      'face gnus-article-button-face
      'follow-link t
-     'help-echo
-     "mouse-2: toggle the MIME part; down-mouse-3: more options")))
+     'help-echo help-echo)))
 
 (defvar gnus-displaying-mime nil)
 --8<---------------cut here---------------end--------------->8---

Bye,
Tassilo



reply via email to

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