emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Permanently fix org versioning breakage during builds?


From: Ihor Radchenko
Subject: Re: Permanently fix org versioning breakage during builds?
Date: Sun, 24 Dec 2023 18:13:39 +0000

João Távora <joaotavora@gmail.com> writes:

>> It is not about a specific macro. Any macro may be broken this way.
>
> No, that's that not true.  Only macros defined in one file and
> expanded in other files.  And not if you use this technique.

You are indeed right. 

>> > [  Tangent: one thing I notice is that the expansion in ox-html.el is
>> > buggy.  It evaluates the keyword arguments to the macros multiple times
>> > for no effect.  The solution would be to change the macro calling
>> > convention to be:
>> >
>> > (cl-defmacro org-export-with-buffer-copy ((&key to-buffer drop-visibility
>> >                                           drop-narrowing drop-contents
>> >                                           drop-locals
>> >                                           &allow-other-keys) &body body)
>> >   ...)
>>
>> May you elaborate?
>
> Just expand the macro as in ox-html.el and see for yourself.

Hmm... It actually looks like a problem with `cl-defmacro' rather than
with macro definition itself.

>> >   `(org-export--call-with-buffer-copy (lambda () ,@body)
>>
>> AFAIU, this technique will prevent compiler optimizations, won't it?
>
> What compiler optimizations are you talking about?  The only
> price to pay is an extra funcall.  "We can solve any problem by
> introducing an extra level of indirection."  The function compiled,
> where presumably the complicated optimization-worthy logic lies
> is still compiled.

Any use of (funcall 'symbol ...) means that compiler is not able to know
the function slot of 'symbol at compile time, because it may change.
Hence, any optimization that relies upon knowing both the context of the
funcall and the internals of 'symbol will become impossible.

And this will not solve the problem when Org files are loaded in mixture
from Emacs built-in version and from some other version (ELPA, manually
installed Org mode, etc).

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

[Prev in Thread] Current Thread [Next in Thread]