From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/84068 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: show attachments on the top Date: Thu, 23 Jan 2014 11:09:34 +0900 Organization: Emacsen advocacy group Message-ID: References: <87wqhypil8.fsf@mat.ucm.es> <87k3dth9r7.fsf@gilgamesch.quim.ucm.es> <87y528w9hz.fsf@gilgamesch.quim.ucm.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1390443032 19358 80.91.229.3 (23 Jan 2014 02:10:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jan 2014 02:10:32 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M32320@lists.math.uh.edu Thu Jan 23 03:10:39 2014 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W69kc-0007XU-D1 for ding-account@gmane.org; Thu, 23 Jan 2014 03:10:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1W69js-0007Zd-9E; Wed, 22 Jan 2014 20:09:52 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1W69jp-0007ZP-F2 for ding@lists.math.uh.edu; Wed, 22 Jan 2014 20:09:49 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1W69jn-0003Fe-Nv for ding@lists.math.uh.edu; Wed, 22 Jan 2014 20:09:48 -0600 Original-Received: from hampton-mail.hostforweb.net ([205.234.204.210] helo=hampton.hostforweb.net) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1W69jl-0004oo-Lr for ding@gnus.org; Thu, 23 Jan 2014 03:09:45 +0100 Original-Received: from localhost.localdomain ([127.0.0.1]:58064 helo=localhost) by hampton.hostforweb.net with smtp (Exim 4.80.1) (envelope-from ) id 1W69jc-003EnT-V0 for ding@gnus.org; Wed, 22 Jan 2014 20:09:37 -0600 X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.130008 (=?iso-2022-jp?B?GyRCPz8bKEI=?= Gnus v0.8) Emacs/24.3.50 (i686-pc-cygwin) Cancel-Lock: sha1:y+x1Dvyd61//zxXXiGflDF/nE80= X-OutGoing-Spam-Status: No, score=-2.9 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - hampton.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Get-Message-Sender-Via: hampton.hostforweb.net: acl_c_authenticated_local_user: root X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:84068 Archived-At: --=-=-= Uwe Brauer wrote: > Done, I sent it in three different formats: > - gnus inline > - seamonkey (thunderbird) html, inline > - seamonkey (thunderbird) html, attachment I've received those mails. Thanks. The revised code is attached. I realized my fault was that the MIME parts that the code moves to the top was only attachments. In an example mail, but there is an inline PDF part, that is not inlinable in Gnus normally[1]. So, I've changed the criteria so as to gather the ones that are not inlinable in Gnus. By the way, Lars suggested a way to show attachment buttons in the header[2]. It looks much smart, so I'd like to try it when I have time. [1] Though it might be possible to display an inline PDF part in the article buffer by using docview. [2] --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ;; Show attachments on the top of the body. (defvar my-gnus-summary-show-attachments-on-top-p nil) (defun my-gnus-summary-show-attachments-on-top () "Show attachments on the top of the body." (interactive) (with-current-buffer gnus-article-buffer (let* ((top (progn (article-goto-body) (point))) (st top) (inhibit-read-only t) nd handle parts marker) (while (setq st (text-property-not-all st (point-max) 'gnus-part nil)) (setq nd (or (text-property-any st (point-max) 'gnus-part nil) (point-max))) (if (setq handle (get-text-property st 'gnus-data)) (if (mm-inlinable-p handle) (setq st nd) (push (cons (buffer-substring st nd) (overlays-at st)) parts) (delete-region st (if (eq (char-after nd) ?\n) (1+ nd) nd))) (setq st nd))) (goto-char top) (dolist (part (nreverse parts)) (setq st (point)) (insert (car part)) (unless (bolp) (insert "\n")) (setq nd (point)) (dolist (ovl (cdr part)) (when (setq marker (plist-get (cdr (overlay-get ovl 'button)) :from)) (set-marker marker st)) (when (setq marker (plist-get (cdr (overlay-get ovl 'button)) :to)) (set-marker marker nd)) (move-overlay ovl st nd))) (when (and parts (not (eq (char-after) ?\n))) (insert "\n"))) (set-buffer-modified-p nil))) --=-=-=--