bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog)


From: Eli Zaretskii
Subject: bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog)
Date: Mon, 19 Nov 2012 21:08:02 +0200

> Date: Mon, 19 Nov 2012 21:53:02 +0800
> From: Du Yanning <duyanning@gmail.com>
> 
> x-file-dialog uses GetOpenFileName to get a file name.
> If you have a buffer that is not visiting any file, when you call
> save-buffer through a tool-bar button, x-file-dialog gets called.
> However, with GetOpenFileName, you must select an existing file.
> 
> We can fix this bug by minimum change.
> 
> in x-file-dialog (defined in win32fns.c)
> 
> change the line:
> 
>     file_opened = GetOpenFileName (file_details);
> 
> to
> 
>     if (!NILP (mustmatch))
>       {
>         file_opened = GetOpenFileName (file_details);
>       }
>     else
>       {
>         file_opened = GetSaveFileName (file_details);
>       }

Thanks.  However, looking at the current code, I see this:

    file_details->Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR
                           | OFN_EXPLORER | OFN_ENABLEHOOK);

    if (!NILP (mustmatch))
      {
        /* Require that the path to the parent directory exists.  */
        file_details->Flags |= OFN_PATHMUSTEXIST;
        /* If we are looking for a file, require that it exists.  */
        if (NILP (only_dir_p))
          file_details->Flags |= OFN_FILEMUSTEXIST;
      }

which means that the OFN_FILEMUSTEXIST and OFN_PATHMUSTEXIST flags are
_not_ set if mustmatch is nil.  Are you saying that GetOpenFileName
requires the file to exist, even though these flags are not set?  This
seems to contradict the MSDN documentation at

  
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839%28v=vs.85%29.aspx

Or are you saying that the mustmatch flag is set incorrectly when the
buffer is not visiting a file?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]