From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/76551 Path: news.gmane.org!not-for-mail From: Antoine Levitt Newsgroups: gmane.emacs.gnus.general Subject: gnus-summary-save-parts enhancement Date: Thu, 10 Feb 2011 16:43:30 +0100 Message-ID: <87wrl7dhel.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297352656 2901 80.91.229.12 (10 Feb 2011 15:44:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 Feb 2011 15:44:16 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M24898@lists.math.uh.edu Thu Feb 10 16:44:12 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PnYgl-0007az-C0 for ding-account@gmane.org; Thu, 10 Feb 2011 16:44:11 +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 1PnYgZ-0001g8-Ev; Thu, 10 Feb 2011 09:43:59 -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 1PnYgW-0001fp-Em for ding@lists.math.uh.edu; Thu, 10 Feb 2011 09:43:56 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PnYgL-0005V5-3A for ding@lists.math.uh.edu; Thu, 10 Feb 2011 09:43:55 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1PnYgI-0004zl-UQ for ding@gnus.org; Thu, 10 Feb 2011 16:43:42 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PnYgI-0007Eu-AX for ding@gnus.org; Thu, 10 Feb 2011 16:43:42 +0100 Original-Received: from portable62.ceremade.dauphine.fr ([193.48.71.62]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Feb 2011 16:43:42 +0100 Original-Received: from antoine.levitt by portable62.ceremade.dauphine.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Feb 2011 16:43:42 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 80 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: portable62.ceremade.dauphine.fr User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:LOtXScG7TOmhhjo4oSRN/dJOMtM= X-Spam-Score: -1.0 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:76551 Archived-At: First of all, can someone merge this? === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2011-02-05 00:11:16 +0000 +++ lisp/gnus/gnus-sum.el 2011-02-10 15:27:11 +0000 @@ -12087,7 +12087,7 @@ gnus-summary-save-parts-default-mime) 'gnus-summary-save-parts-type-history) (setq gnus-summary-save-parts-last-directory - (read-file-name "Save to directory: " + (read-directory-name "Save to directory: " gnus-summary-save-parts-last-directory nil t)) current-prefix-arg)) It just clarifies that the completion asks for a directory and not a file. Ido users need this or ido fails spectacularly. Second of all, I think there should be a setting to only save non-displayable content (typical use case is someone sends you several pdf/doc/jpeg files, you want to use X m with "." but not save the plaintext and HTML part). Here's another patch to do that (basically adds a defcustom and an if, using mm-automatic-display-p). === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2011-02-05 00:11:16 +0000 +++ lisp/gnus/gnus-sum.el 2011-02-10 15:36:37 +0000 @@ -1259,6 +1259,13 @@ :group 'gnus-summary :type 'regexp) +(defcustom gnus-summary-save-parts-only-non-display nil + "*Whether to only save parts that are not displayed in + `gnus-summary-save-parts' (\\\\[gnus-summary-save-parts]). Check + is performed using `mm-automatic-display-p'." + :group 'gnus-summary + :type 'boolean) + (defcustom gnus-read-all-available-headers nil "Whether Gnus should parse all headers made available to it. This is mostly relevant for slow back ends where the user may @@ -12117,22 +12124,23 @@ (when (if reverse (not (string-match type (mm-handle-media-type handle))) (string-match type (mm-handle-media-type handle))) - (let ((file (expand-file-name - (gnus-map-function - mm-file-name-rewrite-functions - (file-name-nondirectory - (or - (mail-content-type-get - (mm-handle-disposition handle) 'filename) - (mail-content-type-get - (mm-handle-type handle) 'name) - (format "%s.%d.%d" gnus-newsgroup-name - (cdr gnus-article-current) - gnus-summary-save-parts-counter)))) - dir))) - (incf gnus-summary-save-parts-counter) - (unless (file-exists-p file) - (mm-save-part-to-file handle file)))))) + (unless (and gnus-summary-save-parts-only-non-display (mm-automatic-display-p handle)) + (let ((file (expand-file-name + (gnus-map-function + mm-file-name-rewrite-functions + (file-name-nondirectory + (or + (mail-content-type-get + (mm-handle-disposition handle) 'filename) + (mail-content-type-get + (mm-handle-type handle) 'name) + (format "%s.%d.%d" gnus-newsgroup-name + (cdr gnus-article-current) + gnus-summary-save-parts-counter)))) + dir))) + (incf gnus-summary-save-parts-counter) + (unless (file-exists-p file) + (mm-save-part-to-file handle file))))))) ;; Summary extract commands