all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Gnus: Indicate undownloaded parts in MIME button
@ 2020-05-16  8:52 Tassilo Horn
  2020-05-19 12:38 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Tassilo Horn @ 2020-05-16  8:52 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-19 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16  8:52 Gnus: Indicate undownloaded parts in MIME button Tassilo Horn
2020-05-19 12:38 ` Lars Ingebrigtsen
2020-05-19 13:24   ` Tassilo Horn

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.