unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#43780: 27.1; defvaralias and define-obsolete-variable-alias
@ 2020-10-03 18:16 Drew Adams
  2020-10-05  7:47 ` Lars Ingebrigtsen
  2020-10-06 21:41 ` Michael Heerdegen
  0 siblings, 2 replies; 8+ messages in thread
From: Drew Adams @ 2020-10-03 18:16 UTC (permalink / raw)
  To: 43780

I have code that uses `inhibit-null-byte-detection'.  Emacs 27 has
(unfortunately) used `define-obsolete-variable-alias' to declare that
variable obsolete, in favor of the much more erudite and sophisticated
`inhibit-null-byte-detection'.

I don't want my code to forever give a compiler warning for that, and I
don't want to change my code to use (if (boundp...)(...)(...))
everywhere.  And I do want it to continue to be compatible with releases
before Emacs 27.

So I added this, hoping to get back `inhibit-null-byte-detection'
without the annoying gratuitous warning:

(when (> emacs-major-version 26)
  (defvaralias 'inhibit-null-byte-detection
               'inhibit-nul-byte-detection))

The `define-obsolete-variable-alias' is done by `emacs -Q', and my
`defvaralias' comes after that.  So I was hoping it would simply make
`inhibit-null-byte-detection' a recognized alias of the existing new
variable `inhibit-nul-byte-detection' (no?).  Alas, the byte-compiler
still warns that `inhibit-null-byte-detection' is obsolete.

Seems like a bug to me.  Why shouldn't the last alias declaration win?

Please tell me the best way to leave my code alone, using
`inhibit-null-byte-detection', and yet eliminate (only) this
byte-compiler warning.

Should I just use (put 'inhibit-null-byte-detection
'byte-obsolete-variable nil)?

Ideally I'd want to affect only byte-compilation of the given file, and
not want to globally change whether `inhibit-null-byte-detection' is
considered obsolete.

This is a serious question, not rhetorical.

(And please don't perform any more such gratuitous renamings that don't
really help anyone.  There are other, more important things to rename,
if someone is overeager enough to really want to start renaming names
that aren't perfect.)

In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
 of 2020-08-12 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.18362
System Description: Microsoft Windows 10 Pro (v10.0.1903.18362.1082)





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

* bug#43780: 27.1; defvaralias and define-obsolete-variable-alias
  2020-10-03 18:16 bug#43780: 27.1; defvaralias and define-obsolete-variable-alias Drew Adams
@ 2020-10-05  7:47 ` Lars Ingebrigtsen
  2020-10-05 16:27   ` Drew Adams
  2020-10-06 21:41 ` Michael Heerdegen
  1 sibling, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-05  7:47 UTC (permalink / raw)
  To: Drew Adams; +Cc: 43780

Drew Adams <drew.adams@oracle.com> writes:

> Seems like a bug to me.  Why shouldn't the last alias declaration win?

It is "winning", I guess, but the variable is still obsolete, and Emacs
should tell you so, even if somebody has been so unfortunate as to load
this library.

> Please tell me the best way to leave my code alone, using
> `inhibit-null-byte-detection', and yet eliminate (only) this
> byte-compiler warning.
>
> Should I just use (put 'inhibit-null-byte-detection
> 'byte-obsolete-variable nil)?

If you want to cause additional problems for people; sure.  

I don't see anything to fix here, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#43780: 27.1; defvaralias and define-obsolete-variable-alias
  2020-10-05  7:47 ` Lars Ingebrigtsen
@ 2020-10-05 16:27   ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2020-10-05 16:27 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 43780

How about reverting this silly renaming, which
doesn't really help anyone?

There are other, more important things to rename,
if someone is overeager enough to really want to
start renaming names that aren't perfect.
___

FYI, google for "nul byte" and see what you get.
Even just trying to type "nul byte" into the Search
field you get ONLY completions for "null byte", "null
byte character", etc.  There are NO completions that
start with just "nul".  Same thing for Duck Duck Go.

See this Wikipedia page, which is even _named_
"Null Character":

https://en.wikipedia.org/wiki/Null_character

"It is often abbreviated as NUL"

_Abbreviated_.  The character is called the NULL
character.

"In 8-bit codes it is known as a null byte."

___

Was someone trying to show how erudite they are,
by renaming this?  How does such gratuitous help
anyone?  Can you please revert this renaming, or
at least unobsolete the former (and better) name?





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

* bug#43780: 27.1; defvaralias and define-obsolete-variable-alias
  2020-10-03 18:16 bug#43780: 27.1; defvaralias and define-obsolete-variable-alias Drew Adams
  2020-10-05  7:47 ` Lars Ingebrigtsen
@ 2020-10-06 21:41 ` Michael Heerdegen
  2020-10-06 22:54   ` Drew Adams
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2020-10-06 21:41 UTC (permalink / raw)
  To: Drew Adams; +Cc: 43780

Drew Adams <drew.adams@oracle.com> writes:

> Please tell me the best way to leave my code alone, using
> `inhibit-null-byte-detection', and yet eliminate (only) this
> byte-compiler warning.
>
> Should I just use (put 'inhibit-null-byte-detection
> 'byte-obsolete-variable nil)?
>
> Ideally I'd want to affect only byte-compilation of the given file, and
> not want to globally change whether `inhibit-null-byte-detection' is
> considered obsolete.
>
> This is a serious question, not rhetorical.

I guess one could try to use `byte-compile--suppressed-warnings' as a
file-local variable, but it has an "internal" name.  AFAIK you can turn
off compiler warnings regarding obsolete names completely per file, or
locally with `with-suppressed-warnings'.  Is that acceptable?

Michael.





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

* bug#43780: 27.1; defvaralias and define-obsolete-variable-alias
  2020-10-06 21:41 ` Michael Heerdegen
@ 2020-10-06 22:54   ` Drew Adams
  2020-10-06 23:15     ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2020-10-06 22:54 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 43780

> I guess one could try to use `byte-compile--suppressed-warnings' as a
> file-local variable, but it has an "internal" name.  AFAIK you can turn
> off compiler warnings regarding obsolete names completely per file, or
> locally with `with-suppressed-warnings'.  Is that acceptable?

No.  I don't want to turn off all warnings just to be
able to take care of this one.





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

* bug#43780: 27.1; defvaralias and define-obsolete-variable-alias
  2020-10-06 22:54   ` Drew Adams
@ 2020-10-06 23:15     ` Michael Heerdegen
  2020-10-07  0:06       ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Heerdegen @ 2020-10-06 23:15 UTC (permalink / raw)
  To: Drew Adams; +Cc: 43780

Drew Adams <drew.adams@oracle.com> writes:

> No.  I don't want to turn off all warnings just to be
> able to take care of this one.

Since this bug report is just about one example; and since your tried
"fix", when it had worked, would also have had an undesired global
effect - what would be your favorite solution?

Would it make sense if Emacs provided a file-local variable with which
you could specify an Emacs version and the effect would be that for
compiling that file all warnings about obsolete stuff would be
suppressed if the obsolete declaration happened in an Emacs version
newer than what you specified?  So like

  ;;; byte-comp-suppress-obsolete 23.1

would have the effect that only stuff that has been obsolete before 23.1
would be reported?

Michael.





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

* bug#43780: 27.1; defvaralias and define-obsolete-variable-alias
  2020-10-06 23:15     ` Michael Heerdegen
@ 2020-10-07  0:06       ` Drew Adams
  2020-10-07 23:13         ` Michael Heerdegen
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2020-10-07  0:06 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 43780

> Since this bug report is just about one example; and since your tried
> "fix", when it had worked, would also have had an undesired global
> effect - what would be your favorite solution?
> 
> Would it make sense if Emacs provided a file-local variable with which
> you could specify an Emacs version and the effect would be that for
> compiling that file all warnings about obsolete stuff would be
> suppressed if the obsolete declaration happened in an Emacs version
> newer than what you specified?  So like
> 
>   ;;; byte-comp-suppress-obsolete 23.1
> 
> would have the effect that only stuff that has been obsolete before 23.1
> would be reported?

Sorry, but I don't have a plan/solution.

IMHO, that variable should never have been renamed.
If the renaming (done in 27.1, for dubious reasons)
could be reverted that would be great.  Or just
remove the obsolete part - have two aliases (no big
deal, and probably the best way to repair the damage
at this point).

The previous name was better, and in any case there
was no need (no good reason) to apply such a trivial,
gratuitous renaming, even if the new name were
(mistakenly) considered better.

See https://lists.gnu.org/archive/html/emacs-devel/2020-10/msg00326.html

I have no hope that this (trivial) bug (#43780) will
be fixed, and I have no other good solution for it
(besides removing the obsolete labeling).

Any code that uses the old name will lead to a compiler
warning now.  So be it.  I really wish this kind of
thing didn't happen.  No good purpose was served.

That's really the lesson here.  If that gets learned
somehow then the bother caused by this bug will have
been worth it.






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

* bug#43780: 27.1; defvaralias and define-obsolete-variable-alias
  2020-10-07  0:06       ` Drew Adams
@ 2020-10-07 23:13         ` Michael Heerdegen
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2020-10-07 23:13 UTC (permalink / raw)
  To: Drew Adams; +Cc: 43780

Drew Adams <drew.adams@oracle.com> writes:

> The previous name was better, and in any case there was no need (no
> good reason) to apply such a trivial, gratuitous renaming, even if the
> new name were (mistakenly) considered better.

Ok, I see.  If you think it's important, I suggest to make just a (new)
report solely about that name, because the subject of this report and
what had been discussed here was only peripherally related to that.


Regards,

Michael.





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

end of thread, other threads:[~2020-10-07 23:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-03 18:16 bug#43780: 27.1; defvaralias and define-obsolete-variable-alias Drew Adams
2020-10-05  7:47 ` Lars Ingebrigtsen
2020-10-05 16:27   ` Drew Adams
2020-10-06 21:41 ` Michael Heerdegen
2020-10-06 22:54   ` Drew Adams
2020-10-06 23:15     ` Michael Heerdegen
2020-10-07  0:06       ` Drew Adams
2020-10-07 23:13         ` Michael Heerdegen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).