help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] Traditional find-file vs. file open dialog?


From: Bill Pringlemeir
Subject: Re: [h-e-w] Traditional find-file vs. file open dialog?
Date: 29 Jul 2002 10:54:49 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

>>>>> "Adam" == Adam Taylor <address@hidden> writes:

 Adam> Folks, When I do C-x C-f, I get the traditional behavior,
 Adam> i.e. emacs prompts me in the minibuffer to enter the name of
 Adam> the file I want to open.

 Adam> However, when I do File > Open File... (i.e. use the menu bar),
 Adam> I get the Windows-standard file open dialog.

 Adam> Can anyone tell me how I can get C-x C-f to open the dialog?

 Adam> I've done C-h k on the menu, and it claims that it invokes
 Adam> find-file, but when I do M-x find-file, I get the traditional
 Adam> find-file behavior (i.e. minibuffer-mediated).

Hitting "C-h k" allows you to see what function is bound to a key (or
menu).  It seems that "C-x C-f" is the same thing as the menu item.  I
am using NTEmacs 21.2.1.  It behaves the same as yours.  You can
investigate the function after getting the help.  The find-file
function calls `(interactive "FFind file: \np")'.  I think that the
interactive function is using different behaviour depending on how it
is called... this might be tough.

Grepping the source, "grep -w interactive *.c -l" gives me a file
called, callint.c.  That seems promising...

Here is a call,

        case 'F':               /* Possibly nonexistent file name. */
          args[i] = Fread_file_name (build_string (callint_message),
                                     Qnil, Qnil, Qnil, Qnil);

... thank you for letting me discover this weird wonderland of lispish
"C".  I found the conditional code,

  #if defined (USE_MOTIF) || defined (HAVE_NTGUI)
    if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
        && use_dialog_box
        && have_menus_p ())
      {
        /* If DIR contains a file name, split it.  */
        Lisp_Object file;
        file = Ffile_name_nondirectory (dir);
        if (XSTRING (file)->size && NILP (default_filename))
          {
            default_filename = file;
            dir = Ffile_name_directory (dir);
          }
        if (!NILP(default_filename))
          default_filename = Fexpand_file_name (default_filename, dir);
        val = Fx_file_dialog (prompt, dir, default_filename, mustmatch);
        add_to_history = 1;
      }
    else
  #endif

Apparently we have an NT_GUI.  

  use-dialog-box's value is t

  Documentation:
  *Non-nil means mouse commands use dialog boxes to ask questions.
  This applies to y-or-n and yes-or-no questions asked by commands
  invoked by mouse clicks and mouse menu items.

  You can customize this variable.

and...

  last-nonmenu-event's value is 13

  Documentation:
  Last input event in a command, except for mouse menu events.
  Mouse menus give back keys that don't look like mouse events;
  this variable holds the actual mouse event that led to the menu,
  so that you can determine whether the command was run by mouse or not.

and have-menu-p(), is where...in w32fcns.c

  int
  have_menus_p ()
  {
    return w32_in_use;
  }

This should always be true.

So, I think we only have to set last-nomenu-event to nil before
calling find-file.  Maybe someone with better Lisp skills can help
you.  I tried "M-: (or (setq last-nomenu-event nil) (find-file))", but
that doesn't work...

hth,
Bill Pringlemeir.









reply via email to

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