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#17950: 24.4.50; REGRESSION: `read-file-name' from a menu (mouse) treats "~/" as installation dir Date: Mon, 07 Jul 2014 18:13:37 +0300 Message-ID: <83zjglcice.fsf@gnu.org> References: <83a98meb0w.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1404746083 19325 80.91.229.3 (7 Jul 2014 15:14:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Jul 2014 15:14:43 +0000 (UTC) Cc: 17950@debbugs.gnu.org To: drew.adams@oracle.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 07 17:14:37 2014 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 1X4Acg-0006Lb-E1 for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Jul 2014 17:14:30 +0200 Original-Received: from localhost ([::1]:51220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4Acg-0004dW-10 for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Jul 2014 11:14:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4AcL-0004HF-9V for bug-gnu-emacs@gnu.org; Mon, 07 Jul 2014 11:14:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4AcE-0007pG-3I for bug-gnu-emacs@gnu.org; Mon, 07 Jul 2014 11:14:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4AcE-0007p4-0J for bug-gnu-emacs@gnu.org; Mon, 07 Jul 2014 11:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X4AcD-0006zj-Kc for bug-gnu-emacs@gnu.org; Mon, 07 Jul 2014 11:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Jul 2014 15:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17950 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17950-submit@debbugs.gnu.org id=B17950.140474604126884 (code B ref 17950); Mon, 07 Jul 2014 15:14:01 +0000 Original-Received: (at 17950) by debbugs.gnu.org; 7 Jul 2014 15:14:01 +0000 Original-Received: from localhost ([127.0.0.1]:46118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X4Ac8-0006zA-Mb for submit@debbugs.gnu.org; Mon, 07 Jul 2014 11:14:00 -0400 Original-Received: from mtaout25.012.net.il ([80.179.55.181]:33340) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X4Ac2-0006ym-FR for 17950@debbugs.gnu.org; Mon, 07 Jul 2014 11:13:54 -0400 Original-Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0N8C00A00KP2P700@mtaout25.012.net.il> for 17950@debbugs.gnu.org; Mon, 07 Jul 2014 18:09:32 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N8C008CMKRWQA20@mtaout25.012.net.il>; Mon, 07 Jul 2014 18:09:32 +0300 (IDT) In-reply-to: <83a98meb0w.fsf@gnu.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.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:91278 Archived-At: > Date: Sun, 06 Jul 2014 18:56:31 +0300 > From: Eli Zaretskii > Cc: 17950@debbugs.gnu.org > > > However, it seems that the directory used for the file selection box > > is not related to `Start in'. It seems to be the something like a > > dir used in a different or a previous Emacs session (?). Not sure > > about that, but it definitely comes up with a directory that is > > unrelated to either my HOME or the directory in `Start in'. > > Could be a Windows 7 thing (I'm testing on XP here). I think it > remembers the last directory you were in, or something. I'll try on > Windows 7 when I can. OK, I do see this on Windows 7. But it's not due to something Emacs does or started to do lately. This is due to a deliberate change in behavior of the file selection dialogs introduced in Windows 7. It is explicitly documented in the pertinent parameter we pass to the API that pops up the dialog: lpstrInitialDir Type: LPCTSTR The initial directory. The algorithm for selecting the initial directory varies on different platforms. Windows 7: If lpstrInitialDir has the same value as was passed the first time the application used an Open or Save As dialog box, the path most recently selected by the user is used as the initial directory. Otherwise, if lpstrFile contains a path, that path is the initial directory. Otherwise, if lpstrInitialDir is not NULL, it specifies the initial directory. If lpstrInitialDir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory. Otherwise, the initial directory is the personal files directory of the current user. Otherwise, the initial directory is the Desktop folder. Windows 2000/XP/Vista: If lpstrFile contains a path, that path is the initial directory. Otherwise, lpstrInitialDir specifies the initial directory. Otherwise, if the application has used an Open or Save As dialog box in the past, the path most recently used is selected as the initial directory. However, if an application is not run for a long time, its saved selected path is discarded. If lpstrInitialDir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory. Otherwise, the initial directory is the personal files directory of the current user. Otherwise, the initial directory is the Desktop folder. IOW, whenever you call x-file-dialog with the same 2nd argument as the last time, you will be presented with the directory where you selected a file at that prior call. So I'm quite sure your previous binary (and all the older ones) behaves exactly like your current binary does. All you need to trigger this "feature" is to navigate away from your home directory using the file selection dialog, and actually select a file in another directory, then invoke x-file-dialog again with the same "~/" argument as the first call -- you will see that the file selection dialog displays that other directory. Given that this is standard behavior of the file selection dialog on Windows 7 and later, the question is, should we try to work around it (assuming there is a workaround, which is something I'm not yet sure)? And if the workaround comes at a price, like initially having something like "*.*" in the "File Name" field, which currently starts empty, is that price acceptable, or would it be a nuisance?