Re: [Emacs-diffs] master 885c512: Fix a bug in 'generate-new-buffer-name'

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Emacs-diffs] master 885c512: Fix a bug in 'generate-new-buffer-name'

Stefan Monnier
> -  if (!NILP (Fstring_equal (name, ignore)) || NILP (Fget_buffer (name)))
> +  if ((!NILP (ignore) && !NILP (Fstring_equal (name, ignore)))
> +      || NILP (Fget_buffer (name)))

Why not just use Fequal instead of Fstring_equal?


        Stefan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Emacs-diffs] master 885c512: Fix a bug in 'generate-new-buffer-name'

Eli Zaretskii
> From: Stefan Monnier <[hidden email]>
> Cc: Eli Zaretskii <[hidden email]>
> Date: Sat, 05 Aug 2017 08:51:28 -0400
>
> > -  if (!NILP (Fstring_equal (name, ignore)) || NILP (Fget_buffer (name)))
> > +  if ((!NILP (ignore) && !NILP (Fstring_equal (name, ignore)))
> > +      || NILP (Fget_buffer (name)))
>
> Why not just use Fequal instead of Fstring_equal?

Because no one said that using a symbol for the IGNORE argument is
forbidden in that function.  "nil" just happens to be a special case,
but other strings/symbols are allowed.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Emacs-diffs] master 885c512: Fix a bug in 'generate-new-buffer-name'

Stefan Monnier
>> > -  if (!NILP (Fstring_equal (name, ignore)) || NILP (Fget_buffer (name)))
>> > +  if ((!NILP (ignore) && !NILP (Fstring_equal (name, ignore)))
>> > +      || NILP (Fget_buffer (name)))
>> Why not just use Fequal instead of Fstring_equal?
> Because no one said that using a symbol for the IGNORE argument is
> forbidden in that function.  "nil" just happens to be a special case,
> but other strings/symbols are allowed.

I'd be surprised if there is code out there that uses a symbol for the
`ignore` argument.  And I don't think it's a feature that you can use
a symbol rather than a string.  I think it's rather a (harmless (except
for nil)) bug.


        Stefan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Emacs-diffs] master 885c512: Fix a bug in 'generate-new-buffer-name'

Eli Zaretskii
> From: Stefan Monnier <[hidden email]>
> Cc: [hidden email]
> Date: Sat, 05 Aug 2017 11:14:30 -0400
>
> >> > -  if (!NILP (Fstring_equal (name, ignore)) || NILP (Fget_buffer (name)))
> >> > +  if ((!NILP (ignore) && !NILP (Fstring_equal (name, ignore)))
> >> > +      || NILP (Fget_buffer (name)))
> >> Why not just use Fequal instead of Fstring_equal?
> > Because no one said that using a symbol for the IGNORE argument is
> > forbidden in that function.  "nil" just happens to be a special case,
> > but other strings/symbols are allowed.
>
> I'd be surprised if there is code out there that uses a symbol for the
> `ignore` argument.  And I don't think it's a feature that you can use
> a symbol rather than a string.  I think it's rather a (harmless (except
> for nil)) bug.

Maybe so, but I see no real reason to switch to using Fequal, either.

Loading...