unofficial mirror of emacs-devel@gnu.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

* Re: Gnus: Indicate undownloaded parts in MIME button
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-05-19 12:38 UTC (permalink / raw)
  To: emacs-devel

Tassilo Horn <tsdh@gnu.org> writes:

> 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.)]
>                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I haven't tried the patch, but it looks good to me.  One super-minor detail:

> +    (when (= 0 gnus-tmp-length)

Could perhaps be `zerop'?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: Gnus: Indicate undownloaded parts in MIME button
  2020-05-19 12:38 ` Lars Ingebrigtsen
@ 2020-05-19 13:24   ` Tassilo Horn
  0 siblings, 0 replies; 3+ messages in thread
From: Tassilo Horn @ 2020-05-19 13:24 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

Lars Ingebrigtsen <larsi@gnus.org> writes:

>> 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.)]
>>                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I haven't tried the patch, but it looks good to me.  One super-minor
> detail:
>
>> +    (when (= 0 gnus-tmp-length)
>
> Could perhaps be `zerop'?

Sure, double-up in readability! :-)

In addition to zerop, I've changed the wording to "not downloaded" as it
seems "undownloaded" is not really English (except in Germany, I guess).

Thanks for having a look,
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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).