unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50898: 28.0.50; with-suppressed-warnings doesn't always work
@ 2021-09-29 18:53 Lars Ingebrigtsen
  2021-09-30  0:51 ` Michael Heerdegen
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-29 18:53 UTC (permalink / raw)
  To: 50898; +Cc: monnier


For some time now, the only compilation warning in Emacs has been:

In toplevel form:
cedet/semantic/bovine/el.el:931:1: Warning: ‘define-child-mode’ is an obsolete
    macro (as of 27.1); use ‘define-derived-mode’ instead.

(It appears in two places.)  But I've forgotten to look into it.

This warning is supposed to be suppressed:

(with-suppressed-warnings ((obsolete define-child-mode))
  ;; FIXME: We should handle this some other way!
  (define-child-mode lisp-mode emacs-lisp-mode
    "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'."))

And this suppression did work at some point, I think?  But it's not
working any more.

I haven't tried to debug it (or bisect it) yet, but perhaps it's obvious
to somebody what change may have triggered this?  My uninformed guess
might be something to do with...  macros and when they are expanded?

I've added Stefan M to the CCs.



In GNU Emacs 28.0.50 (build 23, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-09-26 built on elva
Repository revision: 43ae8c828d853382bbc2a27b9e14b9fff6ba18b6
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

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






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

* bug#50898: 28.0.50; with-suppressed-warnings doesn't always work
  2021-09-29 18:53 bug#50898: 28.0.50; with-suppressed-warnings doesn't always work Lars Ingebrigtsen
@ 2021-09-30  0:51 ` Michael Heerdegen
  2021-11-30 13:38   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Heerdegen @ 2021-09-30  0:51 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50898, monnier

Lars Ingebrigtsen <larsi@gnus.org> writes:

> (with-suppressed-warnings ((obsolete define-child-mode))
>   ;; FIXME: We should handle this some other way!
>   (define-child-mode lisp-mode emacs-lisp-mode
>     "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'."))
>
> And this suppression did work at some point, I think?  But it's not
> working any more.

Indeed, i experienced the same thing in another case in my own code.
And I am sure that it worked as expected in the past.

Michael.





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

* bug#50898: 28.0.50; with-suppressed-warnings doesn't always work
  2021-09-30  0:51 ` Michael Heerdegen
@ 2021-11-30 13:38   ` Lars Ingebrigtsen
  2021-11-30 13:50     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-30 13:38 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 50898, monnier

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> (with-suppressed-warnings ((obsolete define-child-mode))
>>   ;; FIXME: We should handle this some other way!
>>   (define-child-mode lisp-mode emacs-lisp-mode
>>     "Make `lisp-mode' inherit mode local behavior from `emacs-lisp-mode'."))
>>
>> And this suppression did work at some point, I think?  But it's not
>> working any more.
>
> Indeed, i experienced the same thing in another case in my own code.
> And I am sure that it worked as expected in the past.

This should now work again on the trunk.

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





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

* bug#50898: 28.0.50; with-suppressed-warnings doesn't always work
  2021-11-30 13:38   ` Lars Ingebrigtsen
@ 2021-11-30 13:50     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-11-30 14:19       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-11-30 13:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Michael Heerdegen, 50898

> This should now work again on the trunk.

Hmm...

    @@ -216,10 +216,11 @@ macroexp-macroexpand
             (let* ((fun (car form))
                    (obsolete (get fun 'byte-obsolete-info)))
               (macroexp-warn-and-return
    -           (macroexp--obsolete-warning
    -            fun obsolete
    -            (if (symbolp (symbol-function fun))
    -                "alias" "macro"))
    +           (and (byte-compile-warning-enabled-p 'obsolete fun)
    +                (macroexp--obsolete-warning
    +                 fun obsolete
    +                 (if (symbolp (symbol-function fun))
    +                     "alias" "macro")))
                new-form 'obsolete))
           new-form)))

I suspect this can fail if `bytecomp.el` is not yet loaded.

I think "the right way" to do that is to improve
`macroexp-warn-and-return` so that instead of only receiving `obsolete`
as `category` to decide if the warning is enabled or not, it should
additionally also receive `fun`.


        Stefan






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

* bug#50898: 28.0.50; with-suppressed-warnings doesn't always work
  2021-11-30 13:50     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-11-30 14:19       ` Lars Ingebrigtsen
  2021-11-30 17:31         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-30 14:19 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, 50898

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> I suspect this can fail if `bytecomp.el` is not yet loaded.

In what cases does that happen?  I tried both an incremental and
a bootstrap build.

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





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

* bug#50898: 28.0.50; with-suppressed-warnings doesn't always work
  2021-11-30 14:19       ` Lars Ingebrigtsen
@ 2021-11-30 17:31         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-12-01  3:31           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-11-30 17:31 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Michael Heerdegen, 50898

Lars Ingebrigtsen [2021-11-30 15:19:55] wrote:

> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>
>> I suspect this can fail if `bytecomp.el` is not yet loaded.
>
> In what cases does that happen?  I tried both an incremental and
> a bootstrap build.


    emacs -Q
    (with-suppressed-warnings ((obsolete foo)) (define-child-mode sm-foo c-mode "hello"))
    C-j


-- Stefan






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

* bug#50898: 28.0.50; with-suppressed-warnings doesn't always work
  2021-11-30 17:31         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-12-01  3:31           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-01  3:31 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, 50898

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> In what cases does that happen?  I tried both an incremental and
>> a bootstrap build.
>
>     emacs -Q
>     (with-suppressed-warnings ((obsolete foo)) (define-child-mode
> sm-foo c-mode "hello"))
>     C-j

Right.  But instead of duplicating the logic, autoloading
byte-compile-warning-enabled-p would fix that problem.

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





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

end of thread, other threads:[~2021-12-01  3:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 18:53 bug#50898: 28.0.50; with-suppressed-warnings doesn't always work Lars Ingebrigtsen
2021-09-30  0:51 ` Michael Heerdegen
2021-11-30 13:38   ` Lars Ingebrigtsen
2021-11-30 13:50     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-30 14:19       ` Lars Ingebrigtsen
2021-11-30 17:31         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-12-01  3:31           ` Lars Ingebrigtsen

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