Reify themes with eval-and-compile

This is an attempt to fix a bug that has existed since version 1.2.0 of
the themes or even earlier.

The bug is about a mismatch between compiled code and runtime
dependencies.  The runtime expects the current version while the
compiled code only furnishes an outdated one, thus resulting in an
error.  This only happens when:

1. Private functions change to accept more/fewer arguments.
2. Variables change their acceptable value (e.g. from symbol to list).
3. The user is installing the package via the package.el mechanism which
   takes care of byte compilation (though anything that mimics
   package.el should exhibit the same behaviour).

My understanding is that the cause was the limited scope of the
'eval-and-compile' we had before: it would run the 'require' also at
compile time, whereas the 'modus-themes-theme' macro, which reifies the
actual theme, would only be evaluated at runtime.  Hence the mismatch as
'require' would read the already installed byte code while the macro
would expect newer forms.

Wrapping everything in the 'eval-and-compile' should address this
problem.  Hopefully it will not engender new ones...

* * *

The latest reports about this bug:

* GitLab issue 287 with Mark Bestley and Daniel Mendler:
  <https://gitlab.com/protesilaos/modus-themes/-/issues/287>.

* GitHub issue 22 with Rytis Paškauskas:
  <https://github.com/protesilaos/modus-themes/issues/22>.
This commit is contained in:
Protesilaos Stavrou 2022-03-03 06:52:31 +02:00
parent 425d428a01
commit f067d2ef39
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
4 changed files with 33 additions and 32 deletions

View file

@ -5428,15 +5428,15 @@ Ideas and user feedback
Michael Goldenberg, Morgan Smith, Morgan Willcock, Murilo Pereira,
Nicky van Foreest, Nicolas De Jaeghere, Paul Poloskov, Pengji
Zhang, Pete Kazmier, Peter Wu, Philip Kaludercic, Pierre
Téchoueyres, Robert Hepple, Roman Rudakov, Ryan Phillips, Rudolf
Adamkovič, Sam Kleinman, Samuel Culpepper, Saša Janiška, Shreyas
Ragavan, Simon Pugnet, Tassilo Horn, Thibaut Verron, Thomas
Heartman, Togan Muftuoglu, Trey Merkley, Tomasz Hołubowicz, Toon
Claes, Uri Sharf, Utkarsh Singh, Vincent Foley. As well as users:
Ben, CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik,
Moesasji, Nick, TheBlob42, Trey, bepolymathe, bit9tream,
derek-upham, doolio, fleimgruber, gitrj95, iSeeU, jixiuf, okamsn,
pRot0ta1p.
Téchoueyres, Robert Hepple, Roman Rudakov, Ryan Phillips, Rytis
Paškauskas, Rudolf Adamkovič, Sam Kleinman, Samuel Culpepper, Saša
Janiška, Shreyas Ragavan, Simon Pugnet, Tassilo Horn, Thibaut
Verron, Thomas Heartman, Togan Muftuoglu, Trey Merkley, Tomasz
Hołubowicz, Toon Claes, Uri Sharf, Utkarsh Singh, Vincent Foley.
As well as users: Ben, CsBigDataHub1, Emacs Contrib, Eugene,
Fourchaux, Fredrik, Moesasji, Nick, TheBlob42, Trey, bepolymathe,
bit9tream, derek-upham, doolio, fleimgruber, gitrj95, iSeeU,
jixiuf, okamsn, pRot0ta1p.
Packaging
Basil L. Contovounesios, Eli Zaretskii, Glenn Morris, Mauro Aranda,
@ -6256,12 +6256,12 @@ Node: Sources of the themes215163
Node: Issues you can help with215799
Node: Patches require copyright assignment to the FSF216999
Node: Acknowledgements219294
Node: Meta222391
Node: GNU Free Documentation License224870
Node: Indices250222
Node: Function index250401
Node: Variable index251924
Node: Concept index254211
Node: Meta222409
Node: GNU Free Documentation License224888
Node: Indices250240
Node: Function index250419
Node: Variable index251942
Node: Concept index254229

End Tag Table

View file

@ -5388,13 +5388,14 @@ The Modus themes are a collective effort. Every bit of work matters.
Smith, Morgan Willcock, Murilo Pereira, Nicky van Foreest, Nicolas De
Jaeghere, Paul Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu, Philip
Kaludercic, Pierre Téchoueyres, Robert Hepple, Roman Rudakov, Ryan
Phillips, Rudolf Adamkovič, Sam Kleinman, Samuel Culpepper, Saša
Janiška, Shreyas Ragavan, Simon Pugnet, Tassilo Horn, Thibaut Verron,
Thomas Heartman, Togan Muftuoglu, Trey Merkley, Tomasz Hołubowicz,
Toon Claes, Uri Sharf, Utkarsh Singh, Vincent Foley. As well as
users: Ben, CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik,
Moesasji, Nick, TheBlob42, Trey, bepolymathe, bit9tream, derek-upham,
doolio, fleimgruber, gitrj95, iSeeU, jixiuf, okamsn, pRot0ta1p.
Phillips, Rytis Paškauskas, Rudolf Adamkovič, Sam Kleinman, Samuel
Culpepper, Saša Janiška, Shreyas Ragavan, Simon Pugnet, Tassilo Horn,
Thibaut Verron, Thomas Heartman, Togan Muftuoglu, Trey Merkley, Tomasz
Hołubowicz, Toon Claes, Uri Sharf, Utkarsh Singh, Vincent Foley. As
well as users: Ben, CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux,
Fredrik, Moesasji, Nick, TheBlob42, Trey, bepolymathe, bit9tream,
derek-upham, doolio, fleimgruber, gitrj95, iSeeU, jixiuf, okamsn,
pRot0ta1p.
+ Packaging :: Basil L.{{{space()}}} Contovounesios, Eli Zaretskii, Glenn
Morris, Mauro Aranda, Richard Stallman, Stefan Kangas (core Emacs),

View file

@ -56,17 +56,17 @@
(equal (file-name-directory load-file-name)
(expand-file-name "themes/" data-directory))
(require-theme 'modus-themes t))
(require 'modus-themes)))
(require 'modus-themes))
(deftheme modus-operandi
"Accessible and customizable light theme (WCAG AAA standard).
(deftheme modus-operandi
"Accessible and customizable light theme (WCAG AAA standard).
Conforms with the highest legibility standard for color contrast
between background and foreground in any given piece of text,
which corresponds to a minimum contrast in relative luminance of
7:1.")
(modus-themes-theme modus-operandi)
(modus-themes-theme modus-operandi)
(provide-theme 'modus-operandi)
(provide-theme 'modus-operandi))
;;; modus-operandi-theme.el ends here

View file

@ -56,17 +56,17 @@
(equal (file-name-directory load-file-name)
(expand-file-name "themes/" data-directory))
(require-theme 'modus-themes t))
(require 'modus-themes)))
(require 'modus-themes))
(deftheme modus-vivendi
"Accessible and customizable dark theme (WCAG AAA standard).
(deftheme modus-vivendi
"Accessible and customizable dark theme (WCAG AAA standard).
Conforms with the highest legibility standard for color contrast
between background and foreground in any given piece of text,
which corresponds to a minimum contrast in relative luminance of
7:1.")
(modus-themes-theme modus-vivendi)
(modus-themes-theme modus-vivendi)
(provide-theme 'modus-vivendi)
(provide-theme 'modus-vivendi))
;;; modus-vivendi-theme.el ends here