Subject: Re: bug#62762: 'make' often errors with "Org version mismatch" after pulling a new version of the code

From: Eli Zaretskii <[email-masked]>
Date: Thu, 04 May 2023 08:35:55 +0300

> Date: Wed, 3 May 2023 21:37:11 +0000
> Cc: Stefan Monnier <[email-masked]>, [email-masked], [email-masked],
>   Eli Zaretskii <[email-masked]>, [email-masked],
>   Max Nikulin <[email-masked]>
> From: Alan Mackenzie <[email-masked]>
> 
> It occurs to me that perhaps the CC Mode solution to the original
> problem might be useful.  It was written by my predecessor at CC Mode,
> Martin Stjernholm.  In ~20 years of using it, I've never had problems
> with using incorrect versions of macros, or anything like that.

No, the situation with CC Mode solution is far from ideal.  It's the
reason that we have had the dependencies below in lisp/Makefile.in for
the past 15 years:

  # https://debbugs.gnu.org/1004
  # CC Mode uses a compile time macro system which causes a compile time
  # dependency in cc-*.elc files on the macros in other cc-*.el and the
  # version string in cc-defs.el.
  $(lisp)/progmodes/cc-align.elc\
   $(lisp)/progmodes/cc-cmds.elc $(lisp)/progmodes/cc-compat.elc\
   $(lisp)/progmodes/cc-engine.elc $(lisp)/progmodes/cc-fonts.elc\
   $(lisp)/progmodes/cc-langs.elc $(lisp)/progmodes/cc-menus.elc\
   $(lisp)/progmodes/cc-mode.elc $(lisp)/progmodes/cc-styles.elc\
   $(lisp)/progmodes/cc-vars.elc: \
     $(lisp)/progmodes/cc-bytecomp.elc $(lisp)/progmodes/cc-defs.elc

  $(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-cmds.elc: \
     $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc

  $(lisp)/progmodes/cc-compat.elc: \
     $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-styles.elc \
     $(lisp)/progmodes/cc-engine.elc

  $(lisp)/progmodes/cc-defs.elc: $(lisp)/progmodes/cc-bytecomp.elc

  $(lisp)/progmodes/cc-engine.elc: $(lisp)/progmodes/cc-langs.elc \
     $(lisp)/progmodes/cc-vars.elc

  $(lisp)/progmodes/cc-fonts.elc: $(lisp)/progmodes/cc-langs.elc \
     $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc

  $(lisp)/progmodes/cc-langs.elc: $(lisp)/progmodes/cc-vars.elc

  $(lisp)/progmodes/cc-mode.elc: $(lisp)/progmodes/cc-langs.elc \
     $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \
     $(lisp)/progmodes/cc-styles.elc $(lisp)/progmodes/cc-cmds.elc \
     $(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-menus.elc

  $(lisp)/progmodes/cc-styles.elc: $(lisp)/progmodes/cc-vars.elc \
     $(lisp)/progmodes/cc-align.elc

Each time some of the cc-*.el files change we recompile all of them.
The difference between this and Org is that Org has many more files,
so spelling out their dependencies is impractical (that was the first
possible solution I thought about when I tried to solve the Org
issue).