Max Nikulin <maniku...@gmail.com> writes:

>> What about creating org-assert-version.el file that will contain
>> something like
>> 
>> (if (fboundp 'org-assert-version)
>>   (org-assert-version)
>>   (warn "<workaround for compilation>"))
>> 
>> Then, instead of (org-assert-version) call, we can put
>> (load "org-assert-version.el") in Org libraries.
>
> I believed that the only way to make `org-assert-version' effective is 
> to put org version in every Org compiled .elc file, so you suggestion 
> makes version check useless.

Hmm. Not completely useless - it will still effectively compare between
Org version in org-version.el and org-assert-version.el. But indeed less
accurate.

>  An earlier idea was to put 
> `org-assert-version' *definition* to a separate file keeping call in 
> each file as one time workaround to ensure that `org-assert-version' is 
> defined while compiling when an older Org version is loaded to Emacs < 29.

Does it solve the problem with "make install" on Debian?

> Currently I do not understand:
> - Why presence of .el files in the same directory (old Org version) with 
> .elc files affects result of compilation (at least for Emacs-28)?

I may be missing your point, but `load-prefer-newer' maybe?

> - Why even when the `org-assert-version' macro is defined, an error is 
> signaled on attempt to load a compiled file with unexpanded 
> (org-assert-version) call (a file compiled with warning "the function 
> ‘org-assert-version’ is not known")?

This is because `org-assert-version' was not defined in Emacs during
compile time. During compilation, Emacs produces byte code calling a
function. AFAIU, the byte code is equivalent to
(funcall #'org-assert-version), which fails with error (try it with M-:).

> Unfortunately I did not bookmarked discussions containing details 
> related to straight.el issues, so I am unsure if the problems are the 
> same as for installing from ELPA by package.el.

straight.el has a special arrangement for compiling Org. See
https://github.com/radian-software/straight.el/blob/master/straight.el#L3133
Basically, it spawns a child Emacs process and thus does not struggle
with mixed compilation state. (I am not 100% sure about the "make
install" issue you encountered).

The main issue with straight.el is its design - straight.el has no
equivalent of `package-selected-packages' and instead loads the packages
as they appear in the init.el. It is a problem when some statement has
(require 'org) early in the config, before straight sets up the newer
Org version.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to