all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8534: 24.0.50; Documentation bug in ns-read-file-name
@ 2011-04-22 10:50 Harald Hanche-Olsen
  2011-04-24 17:51 ` Chong Yidong
  0 siblings, 1 reply; 8+ messages in thread
From: Harald Hanche-Olsen @ 2011-04-22 10:50 UTC (permalink / raw)
  To: 8534

The doc string for ns-read-file-name (defined in src/nsfns.m) says

Optional arg ISLOAD, if non-nil, means read a file name for saving.

However the exact opposite is true, as the name of the variable also
indicates.

On a side note, when the function is called (with ISLOAD = nil) and
you select an existing file, the usual warning pane about overwriting
an existing file pops up briefly before the dialog vanishes and the
function returns the chosen filename. It is not clear to me if this is
the intended behaviour, but I find it confusing. It would have been
better, I think, to let the save dialog do its usual thing, and then
for the caller of ns-read-file-name to assume that the user has
authorized the overwriting of a pre-existing file with the same name.

In GNU Emacs 24.0.50.1 (x86_64-apple-darwin10.7.0, NS apple-appkit-1038.35)
 of 2011-04-21 on mack
Windowing system distributor `Apple', version 10.3.1038
configured using `configure  '--with-ns''

- Harald





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#8534: 24.0.50; Documentation bug in ns-read-file-name
  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
  0 siblings, 1 reply; 8+ messages in thread
From: Chong Yidong @ 2011-04-24 17:51 UTC (permalink / raw)
  To: Harald Hanche-Olsen; +Cc: 8534

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

> The doc string for ns-read-file-name (defined in src/nsfns.m) says
>
> Optional arg ISLOAD, if non-nil, means read a file name for saving.
>
> However the exact opposite is true, as the name of the variable also
> indicates.

I can patch up the docstring if you explain to me what the opposite of
"read a file name for saving" is, and what is the difference between the
two kinds of file dialogs (I don't use OSX).





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#8534: 24.0.50; Documentation bug in ns-read-file-name
  2011-04-24 17:51 ` Chong Yidong
@ 2011-04-24 18:28   ` Eli Zaretskii
  2011-04-24 20:34     ` Harald Hanche-Olsen
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2011-04-24 18:28 UTC (permalink / raw)
  To: Chong Yidong; +Cc: hanche, 8534

> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00
> 	autolearn=unavailable version=3.3.1
> Resent-From: Chong Yidong <cyd@stupidchicken.com>
> Original-Sender: debbugs-submit-bounces@debbugs.gnu.org
> Resent-To: owner@debbugs.gnu.org
> Resent-CC: bug-gnu-emacs@gnu.org
> Resent-Sender: help-debbugs@gnu.org
> From: Chong Yidong <cyd@stupidchicken.com>
> Date: Sun, 24 Apr 2011 13:51:21 -0400
> Cc: 8534@debbugs.gnu.org
> 
> Harald Hanche-Olsen <hanche@math.ntnu.no> writes:
> 
> > The doc string for ns-read-file-name (defined in src/nsfns.m) says
> >
> > Optional arg ISLOAD, if non-nil, means read a file name for saving.
> >
> > However the exact opposite is true, as the name of the variable also
> > indicates.
> 
> I can patch up the docstring if you explain to me what the opposite of
> "read a file name for saving" is, and what is the difference between the
> two kinds of file dialogs (I don't use OSX).

I guess it means that "non-nil" is backwards, as this part of
ns-read-file-name shows:

  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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#8534: 24.0.50; Documentation bug in ns-read-file-name
  2011-04-24 18:28   ` Eli Zaretskii
@ 2011-04-24 20:34     ` Harald Hanche-Olsen
  2011-04-24 22:52       ` Chong Yidong
  0 siblings, 1 reply; 8+ messages in thread
From: Harald Hanche-Olsen @ 2011-04-24 20:34 UTC (permalink / raw)
  To: eliz; +Cc: cyd, 8534

[Eli Zaretskii <eliz@gnu.org> (2011-04-24 18:28:42 UTC)]

> > I can patch up the docstring if you explain to me what the opposite of
> > "read a file name for saving" is, and what is the difference between the
> > two kinds of file dialogs (I don't use OSX).
> 
> I guess it means that "non-nil" is backwards, as this part of
> ns-read-file-name shows:
> 
>   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.

- Harald





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#8534: 24.0.50; Documentation bug in ns-read-file-name
  2011-04-24 20:34     ` Harald Hanche-Olsen
@ 2011-04-24 22:52       ` Chong Yidong
  2011-04-25  9:00         ` Harald Hanche-Olsen
  2011-04-25 13:00         ` Stefan Monnier
  0 siblings, 2 replies; 8+ messages in thread
From: Chong Yidong @ 2011-04-24 22:52 UTC (permalink / raw)
  To: Harald Hanche-Olsen; +Cc: 8534

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];
      }






^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#8534: 24.0.50; Documentation bug in ns-read-file-name
  2011-04-24 22:52       ` Chong Yidong
@ 2011-04-25  9:00         ` Harald Hanche-Olsen
  2011-04-26 18:31           ` Chong Yidong
  2011-04-25 13:00         ` Stefan Monnier
  1 sibling, 1 reply; 8+ messages in thread
From: Harald Hanche-Olsen @ 2011-04-25  9:00 UTC (permalink / raw)
  To: cyd; +Cc: 8534

[Chong Yidong <cyd@stupidchicken.com> (2011-04-24 22:52:39 UTC)]

> OK.  Does the following patch make sense?  It renames `isLoad' to
> `mustmatch', to be like x-file-dialog.

Yes, I think that is good.

> (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.)

I have access, but lack the Objective-C-fu (for the time being, anyhow).

- Harald





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#8534: 24.0.50; Documentation bug in ns-read-file-name
  2011-04-24 22:52       ` Chong Yidong
  2011-04-25  9:00         ` Harald Hanche-Olsen
@ 2011-04-25 13:00         ` Stefan Monnier
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2011-04-25 13:00 UTC (permalink / raw)
  To: Chong Yidong; +Cc: Harald Hanche-Olsen, 8534

> (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

No, it should be ns-file-dialog.
I know we have a lot of "x-" used as "generic GUI functions", but that's
a bad habit which we should aim to fix.


        Stefan





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#8534: 24.0.50; Documentation bug in ns-read-file-name
  2011-04-25  9:00         ` Harald Hanche-Olsen
@ 2011-04-26 18:31           ` Chong Yidong
  0 siblings, 0 replies; 8+ messages in thread
From: Chong Yidong @ 2011-04-26 18:31 UTC (permalink / raw)
  To: Harald Hanche-Olsen; +Cc: 8534

Harald Hanche-Olsen <hanche@math.ntnu.no> writes:

> [Chong Yidong <cyd@stupidchicken.com> (2011-04-24 22:52:39 UTC)]
>
>> OK.  Does the following patch make sense?  It renames `isLoad' to
>> `mustmatch', to be like x-file-dialog.
>
> Yes, I think that is good.

OK, committed to the emacs-23 branch.





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-04-26 18:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2011-04-25  9:00         ` Harald Hanche-Olsen
2011-04-26 18:31           ` Chong Yidong
2011-04-25 13:00         ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.