From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#8534: 24.0.50; Documentation bug in ns-read-file-name Date: Sun, 24 Apr 2011 18:52:39 -0400 Message-ID: <871v0rs1mw.fsf@stupidchicken.com> References: <20110422.125036.50362026316335083.hanche@math.ntnu.no> <87sjt7wnae.fsf@stupidchicken.com> <831v0rbj1h.fsf@gnu.org> <20110424.223449.2244487291930552343.hanche@math.ntnu.no> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1303686463 24888 80.91.229.12 (24 Apr 2011 23:07:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 24 Apr 2011 23:07:43 +0000 (UTC) Cc: 8534@debbugs.gnu.org To: Harald Hanche-Olsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 25 01:07:36 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QE8Ot-0006dR-J9 for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Apr 2011 01:07:35 +0200 Original-Received: from localhost ([::1]:57878 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QE8Os-0007HA-VV for geb-bug-gnu-emacs@m.gmane.org; Sun, 24 Apr 2011 19:07:34 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:43049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QE8Oq-0007H4-E2 for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2011 19:07:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QE8Op-0001e8-5p for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2011 19:07:32 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40788) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QE8Oo-0001e3-VS for bug-gnu-emacs@gnu.org; Sun, 24 Apr 2011 19:07:31 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QE8Ao-0002tL-3q; Sun, 24 Apr 2011 18:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Apr 2011 22:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8534 X-GNU-PR-Package: emacs,ns X-GNU-PR-Keywords: Original-Received: via spool by 8534-submit@debbugs.gnu.org id=B8534.130368556811088 (code B ref 8534); Sun, 24 Apr 2011 22:53:01 +0000 Original-Received: (at 8534) by debbugs.gnu.org; 24 Apr 2011 22:52:48 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QE8Aa-0002sl-8u for submit@debbugs.gnu.org; Sun, 24 Apr 2011 18:52:48 -0400 Original-Received: from vm-emlprdomr-04.its.yale.edu ([130.132.50.145]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QE8AX-0002sV-Rb for 8534@debbugs.gnu.org; Sun, 24 Apr 2011 18:52:46 -0400 Original-Received: from furball (dhcp128036226127.central.yale.edu [128.36.226.127]) (authenticated bits=0) by vm-emlprdomr-04.its.yale.edu (8.14.4/8.14.4) with ESMTP id p3OMqdDQ017450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 24 Apr 2011 18:52:40 -0400 Original-Received: by furball (Postfix, from userid 1000) id 97C3A16055B; Sun, 24 Apr 2011 18:52:39 -0400 (EDT) In-Reply-To: <20110424.223449.2244487291930552343.hanche@math.ntnu.no> (Harald Hanche-Olsen's message of "Sun, 24 Apr 2011 22:34:49 +0200 (CEST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Scanned-By: MIMEDefang 2.71 on 130.132.50.145 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 24 Apr 2011 18:53:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:45976 Archived-At: Harald Hanche-Olsen writes: >> panel = NILP (isLoad) ? >> (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; >> >> This seems to say that if isLoad is non-nil, we pop up a File Open >> dialog, while when it's nil, we pop up a File Save dialog. > > That is exactly correct. And the former dialog only lets you select an > existing file, while the latter lets you navigate to a folder and type > a filename. OK. Does the following patch make sense? It renames `isLoad' to `mustmatch', to be like x-file-dialog. (It sure would have been nice if ns-read-file-name had been named x-file-dialog, and given the same arguments. If anyone with access to Mac OS wants to clean it up properly.) === modified file 'src/nsfns.m' *** src/nsfns.m 2011-04-07 03:34:05 +0000 --- src/nsfns.m 2011-04-24 22:46:40 +0000 *************** *** 1416,1424 **** DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 4, 0, doc: /* Use a graphical panel to read a file name, using prompt PROMPT. Optional arg DIR, if non-nil, supplies a default directory. ! Optional arg ISLOAD, if non-nil, means read a file name for saving. Optional arg INIT, if non-nil, provides a default file name to use. */) ! (Lisp_Object prompt, Lisp_Object dir, Lisp_Object isLoad, Lisp_Object init) { static id fileDelegate = nil; int ret; --- 1416,1425 ---- DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 4, 0, doc: /* Use a graphical panel to read a file name, using prompt PROMPT. Optional arg DIR, if non-nil, supplies a default directory. ! Optional arg MUSTMATCH, if non-nil, means the returned file or ! directory must exist. Optional arg INIT, if non-nil, provides a default file name to use. */) ! (Lisp_Object prompt, Lisp_Object dir, Lisp_Object mustmatch, Lisp_Object init) { static id fileDelegate = nil; int ret; *************** *** 1443,1449 **** if ([dirS characterAtIndex: 0] == '~') dirS = [dirS stringByExpandingTildeInPath]; ! panel = NILP (isLoad) ? (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; [panel setTitle: promptS]; --- 1444,1450 ---- if ([dirS characterAtIndex: 0] == '~') dirS = [dirS stringByExpandingTildeInPath]; ! panel = NILP (mustmatch) ? (id)[EmacsSavePanel savePanel] : (id)[EmacsOpenPanel openPanel]; [panel setTitle: promptS]; *************** *** 1457,1463 **** panelOK = 0; BLOCK_INPUT; ! if (NILP (isLoad)) { ret = [panel runModalForDirectory: dirS file: initS]; } --- 1458,1464 ---- panelOK = 0; BLOCK_INPUT; ! if (NILP (mustmatch)) { ret = [panel runModalForDirectory: dirS file: initS]; }