From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#13065: Bug in x-file-dialog with GetOpenFileName Date: Tue, 04 Dec 2012 21:10:39 +0200 Message-ID: <83liddr5u8.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1354648273 10496 80.91.229.3 (4 Dec 2012 19:11:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Dec 2012 19:11:13 +0000 (UTC) Cc: 13065@debbugs.gnu.org To: Du Yanning , jasonr@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 04 20:11:25 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tfxtr-0002Hq-2Q for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Dec 2012 20:11:23 +0100 Original-Received: from localhost ([::1]:37876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tfxtf-0005hM-7x for geb-bug-gnu-emacs@m.gmane.org; Tue, 04 Dec 2012 14:11:11 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfxtU-0005Lh-QV for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2012 14:11:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TfxtT-0000TS-Kk for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2012 14:11:00 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TfxtT-0000TO-GS for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2012 14:10:59 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TfxtW-0001wX-CQ for bug-gnu-emacs@gnu.org; Tue, 04 Dec 2012 14:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Dec 2012 19:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13065 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: Original-Received: via spool by 13065-submit@debbugs.gnu.org id=B13065.13546482487448 (code B ref 13065); Tue, 04 Dec 2012 19:11:02 +0000 Original-Received: (at 13065) by debbugs.gnu.org; 4 Dec 2012 19:10:48 +0000 Original-Received: from localhost ([127.0.0.1]:53609 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TfxtH-0001w5-Ne for submit@debbugs.gnu.org; Tue, 04 Dec 2012 14:10:48 -0500 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:58183) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TfxtF-0001vx-T8 for 13065@debbugs.gnu.org; Tue, 04 Dec 2012 14:10:47 -0500 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MEI00500SPE0N00@a-mtaout21.012.net.il> for 13065@debbugs.gnu.org; Tue, 04 Dec 2012 21:10:41 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MEI005XKT9S0Q20@a-mtaout21.012.net.il>; Tue, 04 Dec 2012 21:10:41 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:67913 Archived-At: > Date: Mon, 3 Dec 2012 19:09:49 +0800 > From: Du Yanning > > Platform: Windows 7 > Emacs version: 24.2.1 > > Steps to reproduce this bug: > emacs -Q > > copy and paste the next line into the *scratch* buffer: > (x-file-dialog "hi" "c:\\") > > C-x C-e to evaluate it. > The dialog appears. > > Type "abc" (without the enclosing double quotes) in the "File name" field. > Click the "Desktop" icon on the left side of the dialog. > Click the "Open" button. > The dialog does NOT disappear while it should. This works fine on XP. On Windows 7, I indeed see the problem, and it seems to be related to any action in the dialog that changes the original directory, which results in receiving in the dialog hook procedure of the CDN_FOLDERCHANGE and CDN_SELCHANGE notifications (which we don't handle). If you just type "abc" and click "Open", the dialog works as expected. It also works if you do change to another directory and select an existing file. > I have tried GetOpenFileName/GetSaveFileName in my own Win32 programs and > found that this behavior is casued by GetOpenFileName and GetSaveFileName > is OK in such situation. GetSaveFileName only works with existing files, which might explain why it works where GetOpenFileName fails. I tried to get this to work on Windows 7, or at least figure out why it doesn't, but came up empty-handed. Which is not surprising, since I know absolutely nothing about Windows GUI dialogs in general, and this dialog in particular. It doesn't particularly help that: a) Windows 7 deprecated this kind of dialogs and instead wants us to use some hotshot new ones. So it could be simply a bug in the implementation of this dialog on Windows 7. b) We use a file selection dialog in non-standard ways, to be able to open directories, not just files. The way we do this employs some undocumented tricks which I don't fully understand. E.g., when the hook gets the CDN_INITDONE notification, we access the File Name field of the dialog, but don't do anything with it, and just call EnableWindow. Is that really necessary, and if so, why? c) The filter string uses some "*|*" magic in the directory filter, which doesn't seem to be documented anywhere. What does it do? I CC Jason, who is the author of this code, in the hope that he will be able to give some advice. Failing that, I really don't know what to do to fix this. Ideas and advice will be most appreciated.