From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/26101 Path: main.gmane.org!not-for-mail From: Shenghuo ZHU Newsgroups: gmane.emacs.gnus.general Subject: Re: Numbering invisible parts Date: 31 Oct 1999 21:50:24 -0500 Organization: U of Rochester Sender: owner-ding@hpc.uh.edu Message-ID: <2n1zabapsf.fsf@tiger.jia.vnet> References: <87aeoz14yq.fsf@pc-hrvoje.srce.hr> <87k8o3yrn9.fsf@pc-hrvoje.srce.hr> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035163372 17599 80.91.224.250 (21 Oct 2002 01:22:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 01:22:52 +0000 (UTC) Return-Path: Original-Received: from bart.math.uh.edu (bart.math.uh.edu [129.7.128.48]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id VAA20425 for ; Sun, 31 Oct 1999 21:52:34 -0500 (EST) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by bart.math.uh.edu (8.9.1/8.9.1) with ESMTP id UAB32524; Sun, 31 Oct 1999 20:52:31 -0600 (CST) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sun, 31 Oct 1999 20:52:24 -0600 (CST) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id UAA13460 for ; Sun, 31 Oct 1999 20:52:12 -0600 (CST) Original-Received: from cayuga.cs.rochester.edu (cayuga.cs.rochester.edu [192.5.53.209]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id VAA20411 for ; Sun, 31 Oct 1999 21:51:41 -0500 (EST) Original-Received: from heart.cs.rochester.edu (heart.cs.rochester.edu [192.5.53.109]) by cayuga.cs.rochester.edu (8.9.3/Q) with ESMTP id VAA06011 for ; Sun, 31 Oct 1999 21:51:36 -0500 (EST) Original-Received: (from zsh@localhost) by heart.cs.rochester.edu (8.9.3/8.9.3) id VAA02075; Sun, 31 Oct 1999 21:50:25 -0500 Original-To: ding@gnus.org X-Attribution: ZSH X-Face: 'IF:e51ib'Qbl^(}l^&4-J`'P!@[4~O|&k#:@Gld#b/]oMq&`&FVY._3+b`mzp~Jeve~/#/ ERD!OTe<86UhyN=l`mrPY)M7_}`Ktt\K+58Z!hu7>qU,i.N7TotU[FYE(f1;}`g2xj!u*l`^&=Q!g{ *q|ddto|nkt"$r,K$[)"|6,elPH= GJ6Q Original-Lines: 28 User-Agent: Gnus/5.07009701 (Pterodactyl Gnus v0.97.1) XEmacs/21.2 (Shinjuku) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:26101 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:26101 --=-=-= >>>>> "HN" == Hrvoje Niksic 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 * 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=97-119.diff 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)))) --=-=-=--