GNU bug report logs - #8534
24.0.50; Documentation bug in ns-read-file-name

Previous Next

Packages: emacs, ns;

Reported by: Harald Hanche-Olsen <hanche <at> math.ntnu.no>

Date: Fri, 22 Apr 2011 10:51:02 UTC

Severity: minor

Found in version 24.0.50

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Cc: eliz <at> gnu.org, 8534 <at> 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
Harald Hanche-Olsen <hanche <at> 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];
      }





This bug report was last modified 14 years and 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.