From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Du Yanning Newsgroups: gmane.emacs.bugs Subject: bug#12931: a bug in Emacs for Windows (win32fns.c: x-file-dialog) Date: Mon, 19 Nov 2012 21:53:02 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec502d4c8a2628d04ced96fe7 X-Trace: ger.gmane.org 1353333248 9624 80.91.229.3 (19 Nov 2012 13:54:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Nov 2012 13:54:08 +0000 (UTC) To: 12931@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 19 14:54:19 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 1TaRnm-0001fE-L2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Nov 2012 14:54:18 +0100 Original-Received: from localhost ([::1]:59333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaRnc-0002kl-GG for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Nov 2012 08:54:08 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:36101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaRnX-0002kX-Nf for bug-gnu-emacs@gnu.org; Mon, 19 Nov 2012 08:54:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TaRnU-0005s8-KU for bug-gnu-emacs@gnu.org; Mon, 19 Nov 2012 08:54:03 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaRnU-0005ry-Aa for bug-gnu-emacs@gnu.org; Mon, 19 Nov 2012 08:54:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TaRoV-00068d-6P for bug-gnu-emacs@gnu.org; Mon, 19 Nov 2012 08:55:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Du Yanning Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Nov 2012 13:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12931 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135333325923538 (code B ref -1); Mon, 19 Nov 2012 13:55:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Nov 2012 13:54:19 +0000 Original-Received: from localhost ([127.0.0.1]:54702 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TaRnn-00067b-2s for submit@debbugs.gnu.org; Mon, 19 Nov 2012 08:54:19 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:39441) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TaRnl-00067U-4U for submit@debbugs.gnu.org; Mon, 19 Nov 2012 08:54:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TaRmg-0005Wo-HF for submit@debbugs.gnu.org; Mon, 19 Nov 2012 08:53:13 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:40670) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaRmg-0005Wk-Dp for submit@debbugs.gnu.org; Mon, 19 Nov 2012 08:53:10 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaRmd-0002hu-BH for bug-gnu-emacs@gnu.org; Mon, 19 Nov 2012 08:53:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TaRma-0005WL-8b for bug-gnu-emacs@gnu.org; Mon, 19 Nov 2012 08:53:07 -0500 Original-Received: from mail-vb0-f41.google.com ([209.85.212.41]:39197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaRma-0005W9-4b for bug-gnu-emacs@gnu.org; Mon, 19 Nov 2012 08:53:04 -0500 Original-Received: by mail-vb0-f41.google.com with SMTP id v13so5827633vbk.0 for ; Mon, 19 Nov 2012 05:53:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=k0sMUJ9/1Ms9XAxIw6od4RSzPIlB0R0QypOHKJWXfi0=; b=Oy4+IZzoPSIulUurVpmbTaf1R//6ERkEvVXV+IY+zs8tb2dmd4h7BRe3QK+tUIDg6f mILdnTpPG7VDuySHpjW+GKoLAVTmb5MssdcZoXZxKCXKOTiotXHtuGCkg4niU+iWU3qQ WyWgVgjlxH7ZKo16fqEOUxDG24U3ajJIM5Gru9I+vPdGcAoCY2jHrvhJfDuY4jx+wY8I xytgh7gyR89Y62HPVmJsdNvYdRSYD/eL4x+sJe+0u/UYzmJBsa4qda7fgfIZLtpdOyvh qN7nPph1WeI/2UEn08HWxz+SgATvhK4hwKI+B6/5KOEpwy1Gh1tFO+mwyD57ALFnQ3uX i2VA== Original-Received: by 10.52.17.244 with SMTP id r20mr14684098vdd.29.1353333182980; Mon, 19 Nov 2012 05:53:02 -0800 (PST) Original-Received: by 10.220.141.16 with HTTP; Mon, 19 Nov 2012 05:53:02 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -3.4 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-Spam-Score: -3.4 (---) 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:67158 Archived-At: --bcaec502d4c8a2628d04ced96fe7 Content-Type: text/plain; charset=ISO-8859-1 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); } --bcaec502d4c8a2628d04ced96fe7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable x-file-dialog uses GetOpenFileName to get a file name.
If you have a buf= fer that is not visiting any file, when you call save-buffer through a tool= -bar button, x-file-dialog gets called.
However, with GetOpenFileName, y= ou must select an existing file.

We can fix this bug by minimum change.

in x-file-dialog (defined= in win32fns.c)

change the line:

=A0=A0=A0 file_opened =3D Ge= tOpenFileName (file_details);

to

=A0=A0=A0 if (!NILP (mustmat= ch))
=A0=A0=A0=A0=A0 {
=A0=A0=A0=A0=A0=A0=A0 file_opened =3D GetOpenFileName (file_details);
= =A0=A0=A0=A0=A0 }
=A0=A0=A0 else
=A0=A0=A0=A0=A0 {
=A0=A0=A0=A0=A0= =A0=A0 file_opened =3D GetSaveFileName (file_details);
=A0=A0=A0=A0=A0 }=


--bcaec502d4c8a2628d04ced96fe7--