unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: drew.adams@oracle.com
Cc: 17950@debbugs.gnu.org
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	[thread overview]
Message-ID: <83zjglcice.fsf@gnu.org> (raw)
In-Reply-To: <83a98meb0w.fsf@gnu.org>

> Date: Sun, 06 Jul 2014 18:56:31 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 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?





  reply	other threads:[~2014-07-07 15:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <<a4e125d2-d0a9-472f-a8e5-dda0eeb7a486@default>
     [not found] ` <<83d2dief8e.fsf@gnu.org>
2014-07-06 15:10   ` bug#17950: 24.4.50; REGRESSION: `read-file-name' from a menu (mouse) treats "~/" as installation dir Drew Adams
2014-07-06 15:56     ` Eli Zaretskii
2014-07-07 15:13       ` Eli Zaretskii [this message]
2014-07-07 16:39         ` Stefan Monnier
2014-07-12  9:28           ` Eli Zaretskii
2014-07-06 19:44     ` Eli Zaretskii
     [not found]   ` <<a01720bc-d3f4-408c-9068-c8fd00ac0fc2@default>
     [not found]     ` <<83a98meb0w.fsf@gnu.org>
2014-07-06 16:05       ` Drew Adams
2014-07-06 19:14         ` Eli Zaretskii
     [not found]       ` <<6c30925f-66d0-470a-b1db-0f8200e39bbe@default>
     [not found]         ` <<838uo6e1v9.fsf@gnu.org>
2014-07-06 23:00           ` Drew Adams
2014-07-07  2:38             ` Eli Zaretskii
     [not found]       ` <<83zjglcice.fsf@gnu.org>
2014-07-07 16:23         ` Drew Adams
     [not found]     ` <<837g3qe0hm.fsf@gnu.org>
2014-07-06 22:57       ` Drew Adams
2014-07-05 21:29 Drew Adams
2014-07-06 14:25 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83zjglcice.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=17950@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).