Gnus development mailing list
 help / color / mirror / Atom feed
* Attachments without filenames
@ 2013-01-29 17:49 Christopher Schmidt
  2013-01-29 22:48 ` Katsumi Yamaoka
  0 siblings, 1 reply; 7+ messages in thread
From: Christopher Schmidt @ 2013-01-29 17:49 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 43 bytes --]

Try saving this using gnus-mime-save-part.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 12 bytes --]

aloha, Gnus

[-- Attachment #3: Type: text/plain, Size: 227 bytes --]


It will not work.  This is because of this form in mm-save-part:

    (if (file-directory-p file)
        (setq file (expand-file-name filename file))

(file-directory-p file) is non-nil, filename is nil.

        Christopher

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

* Re: Attachments without filenames
  2013-01-29 17:49 Attachments without filenames Christopher Schmidt
@ 2013-01-29 22:48 ` Katsumi Yamaoka
  2013-01-30  7:28   ` Christopher Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2013-01-29 22:48 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 72 bytes --]

Christopher Schmidt wrote:
> Try saving this using gnus-mime-save-part.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 14 bytes --]

> aloha, Gnus

[-- Attachment #3: Type: text/plain, Size: 389 bytes --]


> It will not work.  This is because of this form in mm-save-part:
>     (if (file-directory-p file)
>         (setq file (expand-file-name filename file))
> (file-directory-p file) is non-nil, filename is nil.

Confirmed.  What do you think the best solution?
(error "No file name")
(message "File name is required")
(while (not (setq file (read-file-name "Save MIME part to..." ...))))

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

* Re: Attachments without filenames
  2013-01-29 22:48 ` Katsumi Yamaoka
@ 2013-01-30  7:28   ` Christopher Schmidt
  2013-01-30  8:31     ` Katsumi Yamaoka
  0 siblings, 1 reply; 7+ messages in thread
From: Christopher Schmidt @ 2013-01-30  7:28 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:
> Confirmed.  What do you think the best solution?

> (while (not (setq file (read-file-name "Save MIME part to..." ...))))

I like that one.  The case of read-file-name returning an empty string
should be handled, too.

        Christopher



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

* Re: Attachments without filenames
  2013-01-30  7:28   ` Christopher Schmidt
@ 2013-01-30  8:31     ` Katsumi Yamaoka
  2013-01-30  8:52       ` Christopher Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2013-01-30  8:31 UTC (permalink / raw)
  To: ding

Christopher Schmidt wrote:
>> (while (not (setq file (read-file-name "Save MIME part to..." ...))))

> I like that one.  The case of read-file-name returning an empty string
> should be handled, too.

I like it, too.  Could you provide a patch?



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

* Re: Attachments without filenames
  2013-01-30  8:31     ` Katsumi Yamaoka
@ 2013-01-30  8:52       ` Christopher Schmidt
  2013-01-30  9:36         ` Katsumi Yamaoka
  0 siblings, 1 reply; 7+ messages in thread
From: Christopher Schmidt @ 2013-01-30  8:52 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]

Katsumi Yamaoka <yamaoka@jpl.org> writes:
> I like it, too.  Could you provide a patch?

    2013-01-30  Christopher Schmidt  <christopher@ch.ristopher.com>

            * mm-decode.el (mm-save-part): Handle invalid read-file-name results.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff, Size: 1234 bytes --]

--- a/lisp/mm-decode.el
+++ b/lisp/mm-decode.el
@@ -1298,14 +1298,26 @@ PROMPT overrides the default one used to ask user for a file name."
     (when filename
       (setq filename (gnus-map-function mm-file-name-rewrite-functions
 					(file-name-nondirectory filename))))
-    (setq file
-          (read-file-name
-	   (or prompt
-	       (format "Save MIME part to (default %s): "
-		       (or filename "")))
-	   (or mm-default-directory default-directory)
-	   (expand-file-name (or filename "")
-			     (or mm-default-directory default-directory))))
+    (while
+	(progn
+	  (setq file
+		(read-file-name
+		 (or prompt
+		     (format "Save MIME part to (default %s): "
+			     (or filename "")))
+		 (or mm-default-directory default-directory)
+		 (expand-file-name (or filename "")
+				   (or mm-default-directory default-directory))))
+	  (cond ((or (not file) (equal file ""))
+		 (message "Please enter a file name")
+		 t)
+		((and (file-directory-p file)
+		      (not filename))
+		 (message "Please enter a non-directory file name")
+		 t)
+		(t nil)))
+      (sit-for 2)
+      (discard-input))
     (if (file-directory-p file)
 	(setq file (expand-file-name filename file))
       (setq file (expand-file-name

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


        Christopher

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

* Re: Attachments without filenames
  2013-01-30  8:52       ` Christopher Schmidt
@ 2013-01-30  9:36         ` Katsumi Yamaoka
  2013-01-30  9:56           ` Christopher Schmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2013-01-30  9:36 UTC (permalink / raw)
  To: ding

Christopher Schmidt wrote:
>     2013-01-30  Christopher Schmidt  <christopher@ch.ristopher.com>

>             * mm-decode.el (mm-save-part): Handle invalid
> read-file-name results.

Thanks.  I'll install it to the Gnus master (and the Emacs trunk).



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

* Re: Attachments without filenames
  2013-01-30  9:36         ` Katsumi Yamaoka
@ 2013-01-30  9:56           ` Christopher Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: Christopher Schmidt @ 2013-01-30  9:56 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:
> Christopher Schmidt wrote:
>>     2013-01-30  Christopher Schmidt  <christopher@ch.ristopher.com>
>
>>             * mm-decode.el (mm-save-part): Handle invalid
>> read-file-name results.
>
> Thanks.  I'll install it to the Gnus master (and the Emacs trunk).

Thank you very much.

        Christopher



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

end of thread, other threads:[~2013-01-30  9:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 17:49 Attachments without filenames Christopher Schmidt
2013-01-29 22:48 ` Katsumi Yamaoka
2013-01-30  7:28   ` Christopher Schmidt
2013-01-30  8:31     ` Katsumi Yamaoka
2013-01-30  8:52       ` Christopher Schmidt
2013-01-30  9:36         ` Katsumi Yamaoka
2013-01-30  9:56           ` Christopher Schmidt

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