Gnus development mailing list
 help / color / mirror / Atom feed
* Numbering invisible parts
@ 1999-10-31 23:32 Hrvoje Niksic
  1999-11-01  0:23 ` Kai Großjohann
  1999-11-07  0:34 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 12+ messages in thread
From: Hrvoje Niksic @ 1999-10-31 23:32 UTC (permalink / raw)


Randal's recent message reminded me of my pet peeve with the MIME
numbering system: If most of the buttons are hidden, why are they
numbered?  I find it highly confusing that the visible buttons have
non-contiguous numbers, like 2, 3, 8, 15, ...

Maybe someone who understands Gnus' MIME handling could fix that?
Shenghuo?


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

* Re: Numbering invisible parts
  1999-10-31 23:32 Numbering invisible parts Hrvoje Niksic
@ 1999-11-01  0:23 ` Kai Großjohann
  1999-11-01  0:36   ` Hrvoje Niksic
  1999-11-07  0:34 ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 12+ messages in thread
From: Kai Großjohann @ 1999-11-01  0:23 UTC (permalink / raw)


Hrvoje Niksic <hniksic@srce.hr> writes:

> Randal's recent message reminded me of my pet peeve with the MIME
> numbering system: If most of the buttons are hidden, why are they
> numbered?  I find it highly confusing that the visible buttons have
> non-contiguous numbers, like 2, 3, 8, 15, ...

I find it highly useful that the numbers indicate that there are other
hidden buttons.

kai
-- 
Life is hard and then you die.


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

* Re: Numbering invisible parts
  1999-11-01  0:23 ` Kai Großjohann
@ 1999-11-01  0:36   ` Hrvoje Niksic
  1999-11-01  2:50     ` Shenghuo ZHU
  1999-11-01  3:39     ` David S. Goldberg
  0 siblings, 2 replies; 12+ messages in thread
From: Hrvoje Niksic @ 1999-11-01  0:36 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> Hrvoje Niksic <hniksic@srce.hr> writes:
> 
> > Randal's recent message reminded me of my pet peeve with the MIME
> > numbering system: If most of the buttons are hidden, why are they
> > numbered?  I find it highly confusing that the visible buttons have
> > non-contiguous numbers, like 2, 3, 8, 15, ...
> 
> I find it highly useful that the numbers indicate that there are
> other hidden buttons.

Why would you want the hidden buttons being "indicated"?  Their
corresponding parts are shown in the message.  For example, Randal's
GIF was numbered 2 instead of 1, because there was preceding text.  I
guess you could call the preceding text a "hidden button", but I don't
see the point of numbering it explicitly.

If for you non-contiguous button numeration is an indicator of
unbuttonized MIME parts, then it's a very bad indicator, because in
most cases it doesn't show anything at all.


Another reason why not numbering hidden buttons would be useful: In
the usual case, there is only one attachment in a message; with my
proposed change, you could simply press `b' to activate it.  As things
are now, you have to press `2 b', or `3 b', or...


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

* Re: Numbering invisible parts
  1999-11-01  0:36   ` Hrvoje Niksic
@ 1999-11-01  2:50     ` Shenghuo ZHU
  1999-11-01  2:57       ` Hrvoje Niksic
  1999-11-01  3:39     ` David S. Goldberg
  1 sibling, 1 reply; 12+ messages in thread
From: Shenghuo ZHU @ 1999-11-01  2:50 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

>>>>> "HN" == Hrvoje Niksic <hniksic@srce.hr> writes:

[...]

HN> Another reason why not numbering hidden buttons would be useful:
HN> In the usual case, there is only one attachment in a message; with
HN> my proposed change, you could simply press `b' to activate it.  As
HN> things are now, you have to press `2 b', or `3 b', or...

Right. Why not make life easier? Try the (committed) patch. Though
invisible parts are still numbered, you can customize the behavior of
`b', even by a function, say
`gnus-article-mime-match-undisplayed-image-handle-whose-size-is-\
larger-than-100K'. :)

Happy Halloween!

-- 
Shenghuo ZHU

1999-10-31 21:24:59  Shenghuo ZHU  <zsh@cs.rochester.edu>

	* gnus-art.el (gnus-article-mime-match-handle-first): New function.
	(gnus-article-mime-match-handle-function): New variable.
	(gnus-article-view-part): Make `b' customizable.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 97-119.diff --]
[-- Type: text/x-patch, Size: 2450 bytes --]

Index: gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 5.82
diff -u -r5.82 gnus-art.el
--- gnus-art.el	1999/10/23 10:51:09	5.82
+++ gnus-art.el	1999/11/01 02:36:58
@@ -616,6 +616,22 @@
   :group 'gnus-article-headers
   :type 'boolean)
 
+(defcustom gnus-article-mime-match-handle-function 'undisplayed-alternative
+  "Function called with a MIME handle as the argument.
+This is meant for people who want to view first matched part.
+For `undisplayed-alternative' (default), the first undisplayed 
+part or alternative part is used. For `undisplayed', the first 
+undisplayed part is used. For a function, the first part which 
+the function return `t' is used. For `nil', the first part is
+used."
+  :group 'gnus-article-mime
+  :type '(choice 
+	  (item :tag "first" :value nil)
+	  (item :tag "undisplayed" :value undisplayed)
+	  (item :tag "undisplayed or alternative" 
+		:value undisplayed-alternative)
+	  (function)))
+
 ;;;
 ;;; The treatment variables
 ;;;
@@ -2922,12 +2938,34 @@
   "Inline MIME part N, which is the numerical prefix."
   (interactive "p")
   (gnus-article-part-wrapper n 'gnus-mime-inline-part))
+
+(defun gnus-article-mime-match-handle-first (condition)
+  (if condition
+      (let ((alist gnus-article-mime-handle-alist) ihandle n)
+	(while (setq ihandle (pop alist))
+	  (if (and (cond 
+		    ((functionp condition)
+		     (funcall condition (cdr ihandle)))
+		    ((eq condition 'undisplayed) 
+		     (not (or (mm-handle-undisplayer (cdr ihandle))
+			      (equal (mm-handle-media-type (cdr ihandle))
+				 "multipart/alternative"))))
+		    ((eq condition 'undisplayed-alternative)
+		     (not (mm-handle-undisplayer (cdr ihandle))))
+		    (t t))
+		   (gnus-article-goto-part (car ihandle))
+		   (or (not n) (< (car ihandle) n)))
+	      (setq n (car ihandle))))
+	(or n 1))
+    1))
 
-(defun gnus-article-view-part (n)
+(defun gnus-article-view-part (&optional n)
   "View MIME part N, which is the numerical prefix."
-  (interactive "p")
+  (interactive "P")
   (save-current-buffer
     (set-buffer gnus-article-buffer)
+    (or (numberp n) (setq n (gnus-article-mime-match-handle-first 
+			     gnus-article-mime-match-handle-function)))
     (when (> n (length gnus-article-mime-handle-alist))
       (error "No such part"))
     (let ((handle (cdr (assq n gnus-article-mime-handle-alist))))

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

* Re: Numbering invisible parts
  1999-11-01  2:50     ` Shenghuo ZHU
@ 1999-11-01  2:57       ` Hrvoje Niksic
  1999-11-01  3:42         ` Shenghuo ZHU
  0 siblings, 1 reply; 12+ messages in thread
From: Hrvoje Niksic @ 1999-11-01  2:57 UTC (permalink / raw)


Shenghuo ZHU <zsh@cs.rochester.edu> writes:

> >>>>> "HN" == Hrvoje Niksic <hniksic@srce.hr> writes:
> 
> [...]
> 
> HN> Another reason why not numbering hidden buttons would be useful:
> HN> In the usual case, there is only one attachment in a message; with
> HN> my proposed change, you could simply press `b' to activate it.  As
> HN> things are now, you have to press `2 b', or `3 b', or...
> 
> Right. Why not make life easier?

Thanks; this is cool, although it breaks the usual
"no-argument-means-1" assumption with cooked numerical prefixes.

However, it only partially fixes my problem, because I would like `1
b' (or just b) to work on the first button I see, `2 b' on the second,
etc.

Maybe numbering invisible parts should be an option?  I never want to
number invisible parts, while Kai always wants to number them.  Sounds
like we need an option to settle our differences.  :-)


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

* Re: Numbering invisible parts
  1999-11-01  0:36   ` Hrvoje Niksic
  1999-11-01  2:50     ` Shenghuo ZHU
@ 1999-11-01  3:39     ` David S. Goldberg
  1999-11-01  3:43       ` Hrvoje Niksic
  1 sibling, 1 reply; 12+ messages in thread
From: David S. Goldberg @ 1999-11-01  3:39 UTC (permalink / raw)


I don't care too much either way but it occurs to me that if inlined
parts that are not buttonized are not counted then the button numbers
have to change when someone does a K-b.  I have to wonder if that
would cause any problems.
-- 
Dave Goldberg
Post: The Mitre Corporation\MS B325\202 Burlington Rd.\Bedford, MA 01730
Phone: 781-271-3887
Email: dsg@mitre.org


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

* Re: Numbering invisible parts
  1999-11-01  2:57       ` Hrvoje Niksic
@ 1999-11-01  3:42         ` Shenghuo ZHU
  1999-11-01  3:54           ` Hrvoje Niksic
  1999-11-01 12:47           ` Steinar Bang
  0 siblings, 2 replies; 12+ messages in thread
From: Shenghuo ZHU @ 1999-11-01  3:42 UTC (permalink / raw)


>>>>> "Hrvoje" == Hrvoje Niksic <hniksic@srce.hr> writes:

[...]


Hrvoje> Thanks; this is cool, although it breaks the usual
Hrvoje> "no-argument-means-1" assumption with cooked numerical
Hrvoje> prefixes.

Hrvoje> However, it only partially fixes my problem, because I would
Hrvoje> like `1 b' (or just b) to work on the first button I see, `2
Hrvoje> b' on the second, etc.

Hrvoje> Maybe numbering invisible parts should be an option?  I never
Hrvoje> want to number invisible parts, while Kai always wants to
Hrvoje> number them.  Sounds like we need an option to settle our
Hrvoje> differences.  :-)

The numbers come from dissecting function. They are kinda like the IDs
of parts. Though some buttons are displayed, they need ID.

Suppose a complicated case like (message/rfc822 is an attachment part)

[1. multipart/mixed]
        [2. message/rfc822]
                [7. multipart/mixed]
                        [8. image/jpeg]
                        [9. text/plain]
        [3. multipart/mixed]
                [4. image/gif]
                [5. text/html]
        [6. image/bmp]

Why I got such numbered buttons? Because part message/rfc822 is
dissected when it is displayed. So we get unordered buttons.

Suppose we could number the buttons in order. How about (un)display
the message/rfc822 button?  We still get non-contiguous buttons. (In
pGnus, undisplaying a button does not affect its sibling buttons.  I
don't think relabeling them is reasonable.)

-- 
Shenghuo ZHU


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

* Re: Numbering invisible parts
  1999-11-01  3:39     ` David S. Goldberg
@ 1999-11-01  3:43       ` Hrvoje Niksic
  1999-11-01  4:22         ` Shenghuo ZHU
  0 siblings, 1 reply; 12+ messages in thread
From: Hrvoje Niksic @ 1999-11-01  3:43 UTC (permalink / raw)


dsg@mitre.org (David S. Goldberg) writes:

> I don't care too much either way but it occurs to me that if inlined
> parts that are not buttonized are not counted then the button
> numbers have to change when someone does a K-b.

Yes, they'd change in that case.  But in that case a bunch of new
buttons would become visible, so the change should be fine.

One things that bothers me about `K b' is that it's very slow.  It
would be really nice if it merely inserted the buttons.  As it is, it
probably re-parses the message (I haven't checked.)


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

* Re: Numbering invisible parts
  1999-11-01  3:42         ` Shenghuo ZHU
@ 1999-11-01  3:54           ` Hrvoje Niksic
  1999-11-01 12:47           ` Steinar Bang
  1 sibling, 0 replies; 12+ messages in thread
From: Hrvoje Niksic @ 1999-11-01  3:54 UTC (permalink / raw)


Shenghuo ZHU <zsh@cs.rochester.edu> writes:

> Suppose we could number the buttons in order. How about (un)display
> the message/rfc822 button?

Undisplaying a button should not reorder the rest.


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

* Re: Numbering invisible parts
  1999-11-01  3:43       ` Hrvoje Niksic
@ 1999-11-01  4:22         ` Shenghuo ZHU
  0 siblings, 0 replies; 12+ messages in thread
From: Shenghuo ZHU @ 1999-11-01  4:22 UTC (permalink / raw)


>>>>> "Hrvoje" == Hrvoje Niksic <hniksic@srce.hr> writes:


[...]


Hrvoje> One things that bothers me about `K b' is that it's very slow.
Hrvoje> It would be really nice if it merely inserted the buttons.  As
Hrvoje> it is, it probably re-parses the message (I haven't checked.)

Right. 

Unfortunately, a handle is unaware where to insert its button
(beginning marker is unknown to the handle).

-- 
Shenghuo ZHU


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

* Re: Numbering invisible parts
  1999-11-01  3:42         ` Shenghuo ZHU
  1999-11-01  3:54           ` Hrvoje Niksic
@ 1999-11-01 12:47           ` Steinar Bang
  1 sibling, 0 replies; 12+ messages in thread
From: Steinar Bang @ 1999-11-01 12:47 UTC (permalink / raw)


>>>>> Shenghuo ZHU <zsh@cs.rochester.edu>:

> The numbers come from dissecting function. They are kinda like the IDs
> of parts. Though some buttons are displayed, they need ID.

It's also important to have an ID for everything, if you're going to
to late retrieval of message parts over IMAP.


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

* Re: Numbering invisible parts
  1999-10-31 23:32 Numbering invisible parts Hrvoje Niksic
  1999-11-01  0:23 ` Kai Großjohann
@ 1999-11-07  0:34 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 12+ messages in thread
From: Lars Magne Ingebrigtsen @ 1999-11-07  0:34 UTC (permalink / raw)


Hrvoje Niksic <hniksic@srce.hr> writes:

> Randal's recent message reminded me of my pet peeve with the MIME
> numbering system: If most of the buttons are hidden, why are they
> numbered?  I find it highly confusing that the visible buttons have
> non-contiguous numbers, like 2, 3, 8, 15, ...

Yes, but.  Even though some parts may not have their numbers shown,
you can still do actions on them.  To take a common example -- if you
get a message with one GIF attachment, the text bits will be part 1,
so you can say `1 K o' to save the text bits.

When we do the user-customizable part decoration thing, then it will
also be possible to see where parts start, even if they don't have
buttons. 

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


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

end of thread, other threads:[~1999-11-07  0:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-31 23:32 Numbering invisible parts Hrvoje Niksic
1999-11-01  0:23 ` Kai Großjohann
1999-11-01  0:36   ` Hrvoje Niksic
1999-11-01  2:50     ` Shenghuo ZHU
1999-11-01  2:57       ` Hrvoje Niksic
1999-11-01  3:42         ` Shenghuo ZHU
1999-11-01  3:54           ` Hrvoje Niksic
1999-11-01 12:47           ` Steinar Bang
1999-11-01  3:39     ` David S. Goldberg
1999-11-01  3:43       ` Hrvoje Niksic
1999-11-01  4:22         ` Shenghuo ZHU
1999-11-07  0:34 ` Lars Magne Ingebrigtsen

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 NNTP newsgroup(s).