all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#76033: file-equal-p should accept nil arguments
@ 2025-02-03 18:12 Ship Mints
  2025-02-03 20:00 ` Eli Zaretskii
  2025-02-04  8:05 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 6+ messages in thread
From: Ship Mints @ 2025-02-03 18:12 UTC (permalink / raw)
  To: 76033

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

I think file-equal-p should accept nil arguments and consider the result
unspecified as in its docstring: "If FILE1 or FILE2 does not exist, the
return value is unspecified."

Currently, file-equal-p signals an error when nil file names are specified.

-Stephane

[-- Attachment #2: Type: text/html, Size: 527 bytes --]

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

* bug#76033: file-equal-p should accept nil arguments
  2025-02-03 18:12 bug#76033: file-equal-p should accept nil arguments Ship Mints
@ 2025-02-03 20:00 ` Eli Zaretskii
  2025-02-03 20:01   ` Ship Mints
  2025-02-04  8:05 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2025-02-03 20:00 UTC (permalink / raw)
  To: Ship Mints; +Cc: 76033

> From: Ship Mints <shipmints@gmail.com>
> Date: Mon, 3 Feb 2025 13:12:08 -0500
> 
> I think file-equal-p should accept nil arguments and consider the result unspecified as in its docstring: "If
> FILE1 or FILE2 does not exist, the return value is unspecified."
> 
> Currently, file-equal-p signals an error when nil file names are specified.

Yes, because nil is not a valid file name.  So it neither exists nor
does not exist.  It simply doesn't name a file.

If we accept nil, then why not t or any other symbol or a number?





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

* bug#76033: file-equal-p should accept nil arguments
  2025-02-03 20:00 ` Eli Zaretskii
@ 2025-02-03 20:01   ` Ship Mints
  0 siblings, 0 replies; 6+ messages in thread
From: Ship Mints @ 2025-02-03 20:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 76033

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

If the file can't be opened based on the arguments, then it will fail as it
should. I'd simply add a stringp test and the result is unspecified, per
the docstring, if the arguments aren't strings.

On Mon, Feb 3, 2025 at 3:00 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Ship Mints <shipmints@gmail.com>
> > Date: Mon, 3 Feb 2025 13:12:08 -0500
> >
> > I think file-equal-p should accept nil arguments and consider the result
> unspecified as in its docstring: "If
> > FILE1 or FILE2 does not exist, the return value is unspecified."
> >
> > Currently, file-equal-p signals an error when nil file names are
> specified.
>
> Yes, because nil is not a valid file name.  So it neither exists nor
> does not exist.  It simply doesn't name a file.
>
> If we accept nil, then why not t or any other symbol or a number?
>

[-- Attachment #2: Type: text/html, Size: 1325 bytes --]

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

* bug#76033: file-equal-p should accept nil arguments
  2025-02-03 18:12 bug#76033: file-equal-p should accept nil arguments Ship Mints
  2025-02-03 20:00 ` Eli Zaretskii
@ 2025-02-04  8:05 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2025-02-04 10:32   ` Ship Mints
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-02-04  8:05 UTC (permalink / raw)
  To: Ship Mints; +Cc: 76033

Ship Mints <shipmints@gmail.com> writes:

Hi,

> I think file-equal-p should accept nil arguments and consider the
> result unspecified as in its docstring: "If FILE1 or FILE2 does not
> exist, the return value is unspecified."

This is against the docstring. file-equal-p has two arguments, "files
FILE1 and FILE2". nil is not a file.

> Currently, file-equal-p signals an error when nil file names are
> specified.

As specified. We should not support to write too sloppy code. Getting an
error is often an indication, that the code using file-equal-p is not in
its best shape.

> -Stephane

Best regards.





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

* bug#76033: file-equal-p should accept nil arguments
  2025-02-04  8:05 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2025-02-04 10:32   ` Ship Mints
  2025-02-04 10:47     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 6+ messages in thread
From: Ship Mints @ 2025-02-04 10:32 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 76033

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]

I am also against writing sloppy code, of course, but if a change like this
can help avoid error signals for cases as I illustrated, I figured it was
worth a discussion. Of course, the docstring could be changed to say that
the arguments need to resolve to files and, if not, the return value is
unspecified.

I will offer patches related to calling file-equal-p with incorrect
arguments as I've been doing, like to project.el.

Please close this issue.

-Stephane

On Tue, Feb 4, 2025 at 3:05 AM Michael Albinus <michael.albinus@gmx.de>
wrote:

> Ship Mints <shipmints@gmail.com> writes:
>
> Hi,
>
> > I think file-equal-p should accept nil arguments and consider the
> > result unspecified as in its docstring: "If FILE1 or FILE2 does not
> > exist, the return value is unspecified."
>
> This is against the docstring. file-equal-p has two arguments, "files
> FILE1 and FILE2". nil is not a file.
>
> > Currently, file-equal-p signals an error when nil file names are
> > specified.
>
> As specified. We should not support to write too sloppy code. Getting an
> error is often an indication, that the code using file-equal-p is not in
> its best shape.
>
> > -Stephane
>
> Best regards.
>

[-- Attachment #2: Type: text/html, Size: 2030 bytes --]

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

* bug#76033: file-equal-p should accept nil arguments
  2025-02-04 10:32   ` Ship Mints
@ 2025-02-04 10:47     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2025-02-04 10:47 UTC (permalink / raw)
  To: Ship Mints; +Cc: 76033-done

Ship Mints <shipmints@gmail.com> writes:

Hi Ship,

> I am also against writing sloppy code, of course, but if a change like
> this can help avoid error signals for cases as I illustrated, I
> figured it was worth a discussion. Of course, the docstring could be
> changed to say that the arguments need to resolve to files and, if
> not, the return value is unspecified.
>
> I will offer patches related to calling file-equal-p with incorrect
> arguments as I've been doing, like to project.el.
>
> Please close this issue.

Done.

> -Stephane

Best regards, Michael.





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

end of thread, other threads:[~2025-02-04 10:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 18:12 bug#76033: file-equal-p should accept nil arguments Ship Mints
2025-02-03 20:00 ` Eli Zaretskii
2025-02-03 20:01   ` Ship Mints
2025-02-04  8:05 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-02-04 10:32   ` Ship Mints
2025-02-04 10:47     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

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.