[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#8534: 24.0.50; Documentation bug in ns-read-file-name
From: |
Chong Yidong |
Subject: |
bug#8534: 24.0.50; Documentation bug in ns-read-file-name |
Date: |
Sun, 24 Apr 2011 18:52:39 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
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];
}