From: Shenghuo ZHU <zsh@cs.rochester.edu>
Subject: Re: Numbering invisible parts
Date: 31 Oct 1999 21:50:24 -0500 [thread overview]
Message-ID: <2n1zabapsf.fsf@tiger.jia.vnet> (raw)
In-Reply-To: <87k8o3yrn9.fsf@pc-hrvoje.srce.hr>
[-- 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))))
next prev parent reply other threads:[~1999-11-01 2:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-31 23:32 Hrvoje Niksic
1999-11-01 0:23 ` Kai Großjohann
1999-11-01 0:36 ` Hrvoje Niksic
1999-11-01 2:50 ` Shenghuo ZHU [this message]
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
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=2n1zabapsf.fsf@tiger.jia.vnet \
--to=zsh@cs.rochester.edu \
/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.
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).