unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* native-comp: load-true-file-name compatibility
@ 2020-09-08 13:55 Kevin Liu
  2020-09-08 14:11 ` Andrea Corallo via Emacs development discussions.
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Liu @ 2020-09-08 13:55 UTC (permalink / raw)
  To: emacs-devel

I have come across some code that looks like this:

(defconst sayid-version
  (eval-when-compile (lm-version load-file-name)))

In native-comp I believe it has to use load-true-file-name instead,
however this variable only exists in native-comp.  What is a good way
to make this code compatible for both branches?




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

* Re: native-comp: load-true-file-name compatibility
  2020-09-08 13:55 native-comp: load-true-file-name compatibility Kevin Liu
@ 2020-09-08 14:11 ` Andrea Corallo via Emacs development discussions.
  2020-09-08 14:25   ` Kevin Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2020-09-08 14:11 UTC (permalink / raw)
  To: Kevin Liu; +Cc: emacs-devel

Kevin Liu <kevin@nivekuil.com> writes:

> I have come across some code that looks like this:
>
> (defconst sayid-version
>   (eval-when-compile (lm-version load-file-name)))
>
> In native-comp I believe it has to use load-true-file-name instead,
> however this variable only exists in native-comp.  What is a good way
> to make this code compatible for both branches?

Hi Kevin,

ATM `load-file-name' has the value it would have loading the
conventional .elc file.  Therefore most likely this is already the
correct code and no modification is required, but it depends obviously
on what `lm-version' wants to do with that :)

Maybe you like to share more about the specific issue here.

  Andrea



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

* Re: native-comp: load-true-file-name compatibility
  2020-09-08 14:11 ` Andrea Corallo via Emacs development discussions.
@ 2020-09-08 14:25   ` Kevin Liu
  2020-09-08 14:45     ` Andrea Corallo via Emacs development discussions.
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Liu @ 2020-09-08 14:25 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: emacs-devel

Ah, you're right, that was a red herring.

The real problem is `sayid-version' is nil when it wasn't compiled in the current emacs session.
So if I delete the sayid-xxx.eln then restart, it recompiles and it is properly non-nil.
But I restart emacs again, `sayid-version' will be nil in the new session.

For me lm-version is defined in
/usr/share/emacs/28.0.50/lisp/emacs-lisp/lisp-mnt.el -- I haven't taken
the time to look at what it really does but I assume it parses the

;; Version: 0.1.0

line in an elisp file header.



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

* Re: native-comp: load-true-file-name compatibility
  2020-09-08 14:25   ` Kevin Liu
@ 2020-09-08 14:45     ` Andrea Corallo via Emacs development discussions.
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Corallo via Emacs development discussions. @ 2020-09-08 14:45 UTC (permalink / raw)
  To: Kevin Liu; +Cc: emacs-devel

Kevin Liu <kevin@nivekuil.com> writes:

> Ah, you're right, that was a red herring.
>
> The real problem is `sayid-version' is nil when it wasn't compiled in the current emacs session.
> So if I delete the sayid-xxx.eln then restart, it recompiles and it is properly non-nil.
> But I restart emacs again, `sayid-version' will be nil in the new session.

Mmh, with a recent version (< 2 weeks old) of native-comp it should not
make a difference because load-file-name points to the .elc

> For me lm-version is defined in
> /usr/share/emacs/28.0.50/lisp/emacs-lisp/lisp-mnt.el -- I haven't taken
> the time to look at what it really does but I assume it parses the
>
> ;; Version: 0.1.0
>
> line in an elisp file header.

I suggest to make sure native-comp is recent and then have a look into
what's going on exactly or file a bug into the bug tracker.

Thanks

  Andrea



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

end of thread, other threads:[~2020-09-08 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-08 13:55 native-comp: load-true-file-name compatibility Kevin Liu
2020-09-08 14:11 ` Andrea Corallo via Emacs development discussions.
2020-09-08 14:25   ` Kevin Liu
2020-09-08 14:45     ` Andrea Corallo via Emacs development discussions.

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