Gnus development mailing list
 help / color / mirror / Atom feed
* Re: small change suggested for mh-mm-save-part
       [not found]   ` <17907.1226075080@maps>
@ 2008-11-10 23:09     ` Reiner Steib
  2008-11-12 11:55       ` Stephen Eglen
  0 siblings, 1 reply; 2+ messages in thread
From: Reiner Steib @ 2008-11-10 23:09 UTC (permalink / raw)
  To: ding; +Cc: mh-e-devel, Stephen Eglen

On Fri, Nov 07 2008, Stephen Eglen wrote:

> Dear Bill,
>
> Thanks for your comments, I was able to upload an item of the
> sourceforge site this afternoon.  [...]
>
> https://sourceforge.net/tracker/index.php?func=detail&aid=2235022&group_id=13357&atid=313357
>
> I'll write to Reiner now.

Here's the code from Stephen's mail:

----------------------------------------------------------------------
;; The two lines following the three line comment are new.  When
;; saving an attachment in MH-E, you are prompted for a filename.
;; With this change, you can give a directory name, and then the
;; attachment is stored in that directory, using the default name of
;; the attachment.  This mirrors what happens when you save a file
;; using C-x C-w and supply a directory name.

(defun mh-mm-save-part (handle)
  "Write HANDLE to a file."
  (let ((name (mail-content-type-get (mm-handle-type handle) 'name))
        (filename (mail-content-type-get
                   (mm-handle-disposition handle) 'filename))
        file)
    (when filename
      (setq filename (file-name-nondirectory filename)))
    (setq file (read-file-name "Save MIME part to: "
                               (or mm-default-directory
                                   default-directory)
                               nil nil (or filename name "")))
    (setq mm-default-directory (file-name-directory file))

    ;; If user entered a directory, assume that is the directory where
    ;; the attachment should be saved, with the default filename
    ;; provided in the attachment.
    (when (and (file-directory-p file) filename)
      (setq file (concat (file-name-as-directory file) filename)))

    (and (or (not (file-exists-p file))
             (yes-or-no-p (format "File %s already exists; overwrite? "
                                  file)))
         (mm-save-part-to-file handle file))))
----------------------------------------------------------------------

Stephen, MH-E's copy `mh-mm-save-part' (`lisp/mh-e/mh-gnus.el') isn't
the same as the current version `mm-save-part' in
`lisp/gnus/mm-decode.el'.  Could you please provide a patch ("diff -u"
preferred) against `lisp/gnus/mm-decode.el', please?

Bill, wouldn't it make more sense to add a proper check in
`mh-mm-save-part' and simply use `mm-save-part' if Gnus is new enough.
This would avoid divergent versions.  (E.g. check (fboundp
'mm-complicated-handles) or the Gnus version.)

> Bill Wohler <wohler@newt.com> wrote:
>
>> Stephen Eglen <S.J.Eglen@damtp.cam.ac.uk> wrote:
>> 
>> > Would it be okay if I committed the following extra lines to
>> > mh-mm-save-part in the CVS Emacs repository?  They are the two lines
>> > following the long comment, which doesn't need to go in, but I put it
>> > there so you can see what it does.
>> 
>> Hi Stephen,
>> 
>> This looks like a good change. It is, however, in an awkward location
>> and time.
>> 
>> 1. There is an Emacs code freeze.
>> 
>> 2. I'd want the Emacs release to have a released version of MH-E.
>> 
>> 3. Ordinarily, we would have dropped this function when we stop
>>    supporting Emacs 21. Since this change is not present in the current
>>    version of Gnus in Emacs 23, 5.13, we would then lose this
>>    functionality.
>> 
>> One scenario is to submit this patch at [1] and encourage Reiner to
>> incorporate this patch in the developmental version of Gnus. It could
>> then be incorporated after Emacs 23 is released. Although this is the
>> most likely scenario, this means that we'll have to support
>> mh-mm-save-part until we drop support of Emacs 23 :-(.
>> 
>> Another scenario, assuming we have time (the Kepler launch is March 5 so
>> this is a grand assumption), is to add this change to both Gnus 5.13 and
>> Emacs 23, creating an MH-E 8.2 release, so that we would only have to
>> support mh-mm-save-part until we drop support of Emacs 22.
>> 
>> In any event, I'd like to get Reiner's opinion before we proceed.
>> 
>> 1. http://sourceforge.net/tracker/?group_id=13357&atid=313357
>> 
>> -- 
>> Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



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

* Re: small change suggested for mh-mm-save-part
  2008-11-10 23:09     ` small change suggested for mh-mm-save-part Reiner Steib
@ 2008-11-12 11:55       ` Stephen Eglen
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Eglen @ 2008-11-12 11:55 UTC (permalink / raw)
  To: ding, mh-e-devel, Stephen Eglen

Dear Reiner,

> Stephen, MH-E's copy `mh-mm-save-part' (`lisp/mh-e/mh-gnus.el') isn't
> the same as the current version `mm-save-part' in
> `lisp/gnus/mm-decode.el'.  Could you please provide a patch ("diff -u"
> preferred) against `lisp/gnus/mm-decode.el', please?

sure -- see below.  I've not tested it within gnus though, as I don't
use it now for reading email.

Thanks, Stephen

--- mm-decode.el~	2008-11-12 11:51:11.000000000 +0000
+++ mm-decode.el	2008-11-12 11:54:35.000000000 +0000
@@ -1241,6 +1241,8 @@
                           (or mm-default-directory default-directory)
                           nil nil (or filename "")))
     (setq mm-default-directory (file-name-directory file))
+    (when (and (file-directory-p file) filename)
+      (setq file (concat (file-name-as-directory file) filename)))
     (and (or (not (file-exists-p file))
 	     (yes-or-no-p (format "File %s already exists; overwrite? "
 				  file)))

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

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

end of thread, other threads:[~2008-11-12 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <338.1225540156@cpc1-cmbg2-0-0-cust309.cmbg.cable.ntl.com>
     [not found] ` <1228.1225565342@olgas.newt.com>
     [not found]   ` <17907.1226075080@maps>
2008-11-10 23:09     ` small change suggested for mh-mm-save-part Reiner Steib
2008-11-12 11:55       ` Stephen Eglen

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).