unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Martin Edström" <meedstrom@runbox.eu>
To: "Liliana Marie Prikler" <liliana.prikler@gmail.com>
Cc: 73681 <73681@debbugs.gnu.org>
Subject: bug#73681: Maybe partly undo the patch on Elisp comp-el-to-eln-filename
Date: Fri, 18 Oct 2024 18:55:10 +0200 (CEST)	[thread overview]
Message-ID: <E1t1qFq-000402-Iv@rmmprod06.runbox> (raw)
In-Reply-To: <518988807953a1b77acb5f9833992fa9ced883c1.camel@gmail.com>

In case anyone reads this, I believe I have the right
algorithm now.

First, the trick to locate an .eln regardless of OS:

    (comp-lookup-eln (locate-library "my-library.el"))

Turns out I do not need the trick, because if an OS like Guix
has indeed shipped an .eln and set it up to be loaded,
then `symbol-file` should return that one.

TL;DR: it took a while to figure out, but the following
snippet is how my program chooses an .el, .elc or .eln that
corresponds to currently loaded Lisp definitions, so that we
know the file is safe to be executed by a subprocess.

If the current definitions come from an .el, then it
opportunistically builds an .eln and returns that instead.
    
    (let ((loaded-file
           (or (ignore-errors
                 (symbol-file 'a-func-from-my-library nil t))
               (symbol-file 'a-func-from-my-library))))
      (if (string-suffix-p ".el" loaded-file)
          (let ((out (comp-el-to-eln-filename loaded-file)))
            (native-compile loaded-file out)
            out)
        loaded-file))



      reply	other threads:[~2024-10-18 16:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07 14:56 bug#73681: Maybe partly undo the patch on Elisp comp-el-to-eln-filename Martin Edström
2024-10-07 18:02 ` Liliana Marie Prikler
2024-10-07 20:46   ` Martin Edström
2024-10-08  4:32     ` Liliana Marie Prikler
2024-10-08 10:41       ` Martin Edström
2024-10-08 17:33         ` Liliana Marie Prikler
2024-10-09 15:15           ` Martin Edström
2024-10-09 17:22             ` Liliana Marie Prikler
2024-10-18 16:55               ` Martin Edström [this message]

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to=E1t1qFq-000402-Iv@rmmprod06.runbox \
    --to=meedstrom@runbox.eu \
    --cc=73681@debbugs.gnu.org \
    --cc=liliana.prikler@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.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).