GNU bug report logs - #15862
aliases to macros at compile time

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Mon, 11 Nov 2013 20:04:02 UTC

Severity: minor

Found in versions 27.1, 24.3

To reply to this bug, email your comments to 15862 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Message #1 received at quiet <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: quiet <at> debbugs.gnu.org
Subject: aliases to macros at compile time
Date: Mon, 11 Nov 2013 15:03:08 -0500
Package: emacs
Version: 24.3
Severity: minor

[ From http://lists.gnu.org/archive/html/emacs-devel/2013-09/msg00354.html ]

(defvar foo-var 0)

(defmacro foo-mac ()
  '(setq foo-var (1+ foo-var)))

(define-obsolete-function-alias 'old-mac #'foo-mac "24.4")

(defun foo-fails ()
  (old-mac))

(defun foo-works ()
  (foo-mac))


Compile:
foo.el:13:4:Warning: the function `foo-mac' is not known to be defined.

Load compiled version:
(foo-fails) ; -> (invalid-function old-mac)


Also, neither version warns that old-mac is obsolete.

I see now that

(eval-and-compile
  (define-obsolete-function-alias 'old-mac #'foo-mac "24.4"))

works. So maybe that should happen automatically at top-level.




Message #2 received at 15862-quiet <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 15862-quiet <at> debbugs.gnu.org
Subject: Re: aliases to macros at compile time
Date: Thu, 21 Dec 2017 19:01:10 -0500
Fixed the obsolescence warning in 5e6fb1e (auto eval-and-compile make-obsolete.
The invalid function issue remains (still need to manaully eval
top-level aliases to macros at compile-time).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15862; Package emacs. (Mon, 07 Oct 2019 15:51:02 GMT) Full text and rfc822 format available.

Message #5 received at 15862 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: bug#15862 <15862 <at> debbugs.gnu.org>
Subject: Re: Status: aliases to macros at compile time
Date: Mon, 07 Oct 2019 17:50:26 +0200
This bug report also comes out blank in the mbox interface, but is
displayed on the web.

[...]

-----

(defvar foo-var 0)

(defmacro foo-mac ()
  '(setq foo-var (1+ foo-var)))

(define-obsolete-function-alias 'old-mac #'foo-mac "24.4")

(defun foo-fails ()
  (old-mac))

(defun foo-works ()
  (foo-mac))


Compile:
foo.el:13:4:Warning: the function `foo-mac' is not known to be defined.

Load compiled version:
(foo-fails) ; -> (invalid-function old-mac)


Also, neither version warns that old-mac is obsolete.

I see now that

(eval-and-compile
  (define-obsolete-function-alias 'old-mac #'foo-mac "24.4"))

works. So maybe that should happen automatically at top-level.


[...]

Fixed the obsolescence warning in 5e6fb1e (auto eval-and-compile make-obsolete.
The invalid function issue remains (still need to manaully eval
top-level aliases to macros at compile-time).

-----

Then I compile it in Emacs 27, I get:

Compiling file /tmp/c.el at Mon Oct  7 17:45:55 2019

In foo-fails:
c.el:9:4:Warning: ‘old-mac’ is an obsolete function (as of 24.4); use
    ‘foo-mac’ instead.

Which seems correct.

If I then

(load "/tmp/c.elc")

I don't get anything about invalid functions.  So has this been fixed,
or am I misinterpreting what the invalid function issue is?

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





Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 07 Oct 2019 15:51:02 GMT) Full text and rfc822 format available.

Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Mon, 04 May 2020 12:13:01 GMT) Full text and rfc822 format available.

Notification sent to Glenn Morris <rgm <at> gnu.org>:
bug acknowledged by developer. (Mon, 04 May 2020 12:13:01 GMT) Full text and rfc822 format available.

Message #12 received at 15862-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: bug#15862 <15862-done <at> debbugs.gnu.org>
Subject: Re: bug#15862: Status: aliases to macros at compile time
Date: Mon, 04 May 2020 14:12:25 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> I don't get anything about invalid functions.  So has this been fixed,
> or am I misinterpreting what the invalid function issue is?

More information was requested, but none was given within 6 months, so
I'm closing this bug.

If this is still an issue, please reply to this email (use "Reply to
all" in your email client) and we can reopen the bug report.

Best regards,
Stefan Kangas




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 04 May 2020 16:10:01 GMT) Full text and rfc822 format available.

bug Marked as found in versions 27.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 04 May 2020 16:10:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15862; Package emacs. (Mon, 04 May 2020 16:15:02 GMT) Full text and rfc822 format available.

Message #19 received at 15862 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 15862 <at> debbugs.gnu.org
Cc: larsi <at> gnus.org, stefan <at> marxist.se
Subject: Re: bug#15862: Status: aliases to macros at compile time
Date: Mon, 04 May 2020 12:14:29 -0400
The invalid function issue remains.

As in the original report:
Compile the file, load the compiled version, *then evaluate: (foo-fails)*.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15862; Package emacs. (Wed, 26 Jan 2022 17:20:01 GMT) Full text and rfc822 format available.

Message #22 received at 15862 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: stefan <at> marxist.se, 15862 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#15862: aliases to macros at compile time
Date: Wed, 26 Jan 2022 18:19:07 +0100
[Message part 1 (text/plain, inline)]
Glenn Morris <rgm <at> gnu.org> writes:

> The invalid function issue remains.
>
> As in the original report:
> Compile the file, load the compiled version, *then evaluate: (foo-fails)*.

I can confirm that this issue is still present in Emacs 29.

To reproduce, save the file, byte-compile it and say

M-: (foo-fails)

Debugger entered--Lisp error: (invalid-function old-mac)
  old-mac()
  foo-fails()
  eval-expression((foo-fails) nil nil 127)
  funcall-interactively(eval-expression (foo-fails) nil nil 127)
  command-execute(eval-expression)

Perhaps Stefan M has some comments; added to the CCs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no
[foo.el (application/emacs-lisp, attachment)]

This bug report was last modified 3 years and 137 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.