unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: tpeplt <tpeplt@gmail.com>
To: "picnoir" <picnoir@alternativebit.fr>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Invalid function error when loading elisp through native compilation
Date: Sun, 03 Mar 2024 16:58:26 -0500	[thread overview]
Message-ID: <87le6z0ygt.fsf@gmail.com> (raw)
In-Reply-To: <87edcr8um1.fsf@alternativebit.fr> (picnoir@alternativebit.fr's message of "Sun, 03 Mar 2024 11:42:14 +0100")

"picnoir" <picnoir@alternativebit.fr> writes:

> Hi,
>
> I'm facing a puzzling error that only manifests using native
> compilation.
>
> If I evaluate this particular elisp file:
> https://github.com/picnoir/my-repo-pins/blob/master/my-repo-pins.el
> using eval-buffer (ie. not natively compiled), I can run the following
> snippet just fine:
>
>   (my-repo-pins--clone-project "test/test")

Note: I am using Emacs 29.2 on GNU/Linux.  I did not get the same
results as you described and part of the reason might be due to
differing versions of Emacs.

1. The URL you provided does not give access to the file
‘my-repo-pins.el’ within Emacs.  Here is a URL that other readers should
be able to use in order to view your source file:

https://raw.githubusercontent.com/picnoir/my-repo-pins/master/my-repo-pins.el

2. After downloading your source file, I loaded it into Emacs using:

  $ emacs -Q my-repo-pins.el

3. I then byte-compiled the file and loaded it into Emacs using the
‘Emacs-Lisp’ menu entry ‘Byte compile and Load’.  (There were a number
of warnings about the use of single quotes in several functions’
docstrings due to a new syntax requirement, but those can be ignored for
this discussion.)

4. I switched to the *scratch* buffer and evaluated the following
expression using C-x C-e:

   (my-repo-pins--clone-project "test/test")

This caused the debugger to be triggered and a stack trace ("backtrace")
of function calls was generated.  That backtrace is included at the end
of this message in case you or any readers might be able to follow it to
point out some error(s).

Note that I did NOT compile the elisp file natively.  The error was
generated after byte-compiling the file only.  The positive point from
this is that backtrace might be useful for finding the source of the
problem, and eliminating it from the natively-compiled version, too.

5. Backtrace:

Debugger entered--Lisp error: (invalid-function (my-repo-pins--query-github-owner-repo "test" "test" (lambda (result) (let ((new-state (if (null result) 'not-found result))) (my-repo-pins--update-forges-state "GitHub.com" new-state "test/test")))))
  (my-repo-pins--query-github-owner-repo "test" "test" (lambda (result) (let ((new-state (if (null result) 'not-found result))) (my-repo-pins--update-forges-state "GitHub.com" new-state "test/test"))))(my-repo-pins--query-github-owner-repo "test" "test" (lambda (result) (let ((new-state (if (null result) 'not-found result))) (my-repo-pins--update-forges-state "GitHub.com" new-state "test/test"))))
  #f(compiled-function (forge) #<bytecode 0x823cf967506dbe8>)(("GitHub.com" (query-user-repo . my-repo-pins--query-github-owner-repo)))
  mapcar(#f(compiled-function (forge) #<bytecode 0x823cf967506dbe8>) (("GitHub.com" (query-user-repo . my-repo-pins--query-github-owner-repo)) ("GitLab.com" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-gitlab-owner-repo "gitlab.com" owner repo cb))) ("git.sr.ht" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-sourcehut-owner-repo "git.sr.ht" owner repo cb))) ("Codeberg.org" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-gitea-owner-repo "codeberg.org" owner repo cb)))))
  #f(compiled-function #'sequence #<bytecode 0x1857601701b27f74>)(#f(compiled-function (forge) #<bytecode 0x823cf967506dbe8>) (("GitHub.com" (query-user-repo . my-repo-pins--query-github-owner-repo)) ("GitLab.com" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-gitlab-owner-repo "gitlab.com" owner repo cb))) ("git.sr.ht" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-sourcehut-owner-repo "git.sr.ht" owner repo cb))) ("Codeberg.org" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-gitea-owner-repo "codeberg.org" owner repo cb)))))
  apply(#f(compiled-function #'sequence #<bytecode 0x1857601701b27f74>) #f(compiled-function (forge) #<bytecode 0x823cf967506dbe8>) (("GitHub.com" (query-user-repo . my-repo-pins--query-github-owner-repo)) ("GitLab.com" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-gitlab-owner-repo "gitlab.com" owner repo cb))) ("git.sr.ht" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-sourcehut-owner-repo "git.sr.ht" owner repo cb))) ("Codeberg.org" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-gitea-owner-repo "codeberg.org" owner repo cb)))) nil)
  seq-map(#f(compiled-function (forge) #<bytecode 0x823cf967506dbe8>) (("GitHub.com" (query-user-repo . my-repo-pins--query-github-owner-repo)) ("GitLab.com" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-gitlab-owner-repo "gitlab.com" owner repo cb))) ("git.sr.ht" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-sourcehut-owner-repo "git.sr.ht" owner repo cb))) ("Codeberg.org" (query-user-repo lambda (owner repo cb) (my-repo-pins--query-gitea-owner-repo "codeberg.org" owner repo cb)))))
  my-repo-pins--query-forge-fetchers("test/test")
  my-repo-pins--clone-project("test/test")
  (progn (my-repo-pins--clone-project "test/test"))
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  command-execute(eval-last-sexp)

End of Backtrace.

--



  parent reply	other threads:[~2024-03-03 21:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-03 10:42 Invalid function error when loading elisp through native compilation picnoir
2024-03-03 21:56 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-03-03 23:27   ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-03-04  0:50     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-03-04  1:07       ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-03-04  1:56     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-03-03 21:58 ` tpeplt [this message]
2024-03-04  1:22   ` tpeplt
2024-03-04  1:43     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-03-04  2:01       ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-03-04  3:53         ` [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87le6z0ygt.fsf@gmail.com \
    --to=tpeplt@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=picnoir@alternativebit.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).