all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: emacs-devel@gnu.org
Subject: Gnus: Indicate undownloaded parts in MIME button
Date: Sat, 16 May 2020 10:52:04 +0200	[thread overview]
Message-ID: <87sgg0feiz.fsf@gnu.org> (raw)

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	other threads:[~2020-05-16  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-16  8:52 Tassilo Horn [this message]
2020-05-19 12:38 ` Gnus: Indicate undownloaded parts in MIME button Lars Ingebrigtsen
2020-05-19 13:24   ` Tassilo Horn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgg0feiz.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.