Gnus development mailing list
 help / color / mirror / Atom feed
From: Christopher Schmidt <christopher@ch.ristopher.com>
To: ding@gnus.org
Subject: Re: Attachments without filenames
Date: Wed, 30 Jan 2013 08:52:39 +0000 (GMT)	[thread overview]
Message-ID: <874nhzuk6h@ch.ristopher.com> (raw)
In-Reply-To: <b4mboc7ul6f.fsf@jpl.org> (Katsumi Yamaoka's message of "Wed, 30 Jan 2013 17:31:04 +0900")

[-- 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

  reply	other threads:[~2013-01-30  8:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 17:49 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 [this message]
2013-01-30  9:36         ` Katsumi Yamaoka
2013-01-30  9:56           ` Christopher Schmidt

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=874nhzuk6h@ch.ristopher.com \
    --to=christopher@ch.ristopher.com \
    --cc=ding@gnus.org \
    /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).