unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog)
@ 2012-11-19 13:53 Du Yanning
  2012-11-19 19:08 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Du Yanning @ 2012-11-19 13:53 UTC (permalink / raw)
  To: 12931

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

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);
      }

[-- Attachment #2: Type: text/html, Size: 664 bytes --]

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

* bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog)
  2012-11-19 13:53 bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog) Du Yanning
@ 2012-11-19 19:08 ` Eli Zaretskii
       [not found]   ` <CALr_ej2asGEUoTkBRPyryMMm7dFVtmYuixPt+nuXoPV+gYs0sw@mail.gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2012-11-19 19:08 UTC (permalink / raw)
  To: Du Yanning; +Cc: 12931

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





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

* bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog)
       [not found]   ` <CALr_ej2asGEUoTkBRPyryMMm7dFVtmYuixPt+nuXoPV+gYs0sw@mail.gmail.com>
@ 2012-11-20 16:18     ` Eli Zaretskii
  2014-02-06  1:38       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2012-11-20 16:18 UTC (permalink / raw)
  To: Du Yanning; +Cc: 12931

You replied only to me, so I'm CC'ing the bug address to get this
archived with the bug.

> Date: Tue, 20 Nov 2012 12:27:10 +0800
> From: Du Yanning <duyanning@gmail.com>
> 
> I cannot recreate it every time.
> I do not know the reason. Perhaps it is a problem with my system.
> Sorry for my premature conclusion.
> If I can recreate it, I will contact you.
> I am sorry, and Thank you!





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

* bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog)
  2012-11-20 16:18     ` Eli Zaretskii
@ 2014-02-06  1:38       ` Lars Ingebrigtsen
  2014-02-06  6:16         ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2014-02-06  1:38 UTC (permalink / raw)
  To: Du Yanning, 12931

Eli Zaretskii <eliz@gnu.org> writes:

> You replied only to me, so I'm CC'ing the bug address to get this
> archived with the bug.
>
>> Date: Tue, 20 Nov 2012 12:27:10 +0800
>> From: Du Yanning <duyanning@gmail.com>
>> 
>> I cannot recreate it every time.
>> I do not know the reason. Perhaps it is a problem with my system.
>> Sorry for my premature conclusion.
>> If I can recreate it, I will contact you.
>> I am sorry, and Thank you!

Are you still seeing this problem in Emacs 24.3?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog)
  2014-02-06  1:38       ` Lars Ingebrigtsen
@ 2014-02-06  6:16         ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2014-02-06  6:16 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: duyanning, 12931-done

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 05 Feb 2014 17:38:04 -0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > You replied only to me, so I'm CC'ing the bug address to get this
> > archived with the bug.
> >
> >> Date: Tue, 20 Nov 2012 12:27:10 +0800
> >> From: Du Yanning <duyanning@gmail.com>
> >> 
> >> I cannot recreate it every time.
> >> I do not know the reason. Perhaps it is a problem with my system.
> >> Sorry for my premature conclusion.
> >> If I can recreate it, I will contact you.
> >> I am sorry, and Thank you!
> 
> Are you still seeing this problem in Emacs 24.3?

This is a duplicate of #13065, which was fixed long ago.

Closing.





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

end of thread, other threads:[~2014-02-06  6:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-19 13:53 bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog) Du Yanning
2012-11-19 19:08 ` Eli Zaretskii
     [not found]   ` <CALr_ej2asGEUoTkBRPyryMMm7dFVtmYuixPt+nuXoPV+gYs0sw@mail.gmail.com>
2012-11-20 16:18     ` Eli Zaretskii
2014-02-06  1:38       ` Lars Ingebrigtsen
2014-02-06  6:16         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).