[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4388: 23.1; rmailmm save option does not prompt for filename correct
David J. Biesack
bug#4388: 23.1; rmailmm save option does not prompt for filename correctly (patch)
Fri, 11 Sep 2009 08:38:18 -0400
> From: Glenn Morris <address@hidden>
> CC: <address@hidden>
> Date: Fri, 11 Sep 2009 02:54:57 -0400
> "David J. Biesack" wrote:
> > On the attachment button/link, press Enter to invoke rmail-mime-save
> > Currently, this prompts for a location to save the attachment but
> > does not pass the current file name and directory name correctly.
> I don't understand what you mean - can you explain?
Yes, sorry, I was not clear.
I invoke rmail-mime-save and enter a different directory, using
completion (and TAB)... this often results with a directory name that
ends with /, such as c:/djb/attachments/
When I press Enter, I get
Debugger entered--Lisp error: (file-error "Opening output file" "no such file
or directory" "c:/djb/attachments/")
That is, it appears to be trying to save the attachment file.rtf
as c:/djb/attachments/ and not as c:/djb/attachments/file.rtf
It works correctly if the entered path is a directory name but does not end
> > + (setq directory (if (not (string-match "^~$\\.*/" directory))
> > + (concat directory "/")
> > + directory))
> What is this supposed to do?
Sorry, my bad; it is buggy. It should just append a / if the directory does not
end with /
(file-name-as-directory (button-get button 'directory)) is better.
> > (read-file-name (format "Save as (default: %s): "
> > filename)
> > directory
> > ! (expand-file-name filename directory)
> > ! nil
> > ! filename)
> It seems you basically want the default value to be eg:
> rather than just
> as it is now?
> The current behaviour is consistent with, eg, C-x C-w. Having an
> initial default file part just means more typing if you want to delete
> it and use a different value.
> The only change I would make here is:
> --- rmailmm.el 10 Sep 2009 06:18:23 -0000 1.9
> +++ rmailmm.el 11 Sep 2009 02:09:11 -0000
> @@ -79,7 +79,7 @@
> (defun rmail-mime-save (button)
> "Save the attachment using info in the BUTTON."
> (let* ((filename (button-get button 'filename))
> - (directory (button-get button 'directory))
> + (directory (file-name-as-directory (button-get button 'directory)))
> (data (button-get button 'data)))
> (while (file-exists-p (expand-file-name filename directory))
> (let* ((f (file-name-sans-extension filename))
I still prefer to have the file name in the prompt so that I can change it more
rather than having to type it all in (i.e. change the case or change blanks to
remove a "-1" or "-2" version string to replace an earlier saved version etc.)
(setq filename (expand-file-name
(read-file-name (format "Save as (default: %s): " filename)
(expand-file-name filename directory)
works the way I would like.
David J. Biesack, SAS
SAS Campus Dr. Cary, NC 27513
www.sas.com (919) 531-7771