unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
To: Harald Hanche-Olsen <hanche@math.ntnu.no>
Cc: 8534@debbugs.gnu.org
Subject: bug#8534: 24.0.50; Documentation bug in ns-read-file-name
Date: Sun, 24 Apr 2011 18:52:39 -0400	[thread overview]
Message-ID: <871v0rs1mw.fsf@stupidchicken.com> (raw)
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)")

Harald Hanche-Olsen <hanche@math.ntnu.no> 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];
      }






  reply	other threads:[~2011-04-24 22:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-22 10:50 bug#8534: 24.0.50; Documentation bug in ns-read-file-name Harald Hanche-Olsen
2011-04-24 17:51 ` Chong Yidong
2011-04-24 18:28   ` Eli Zaretskii
2011-04-24 20:34     ` Harald Hanche-Olsen
2011-04-24 22:52       ` Chong Yidong [this message]
2011-04-25  9:00         ` Harald Hanche-Olsen
2011-04-26 18:31           ` Chong Yidong
2011-04-25 13:00         ` Stefan Monnier

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=871v0rs1mw.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=8534@debbugs.gnu.org \
    --cc=hanche@math.ntnu.no \
    /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).