Subject: bug#45854: 28.0.50; [feature/native-comp] autoload behavior different in the presence of errors

From: Andrea Corallo <[email-masked]>
Date: Sun, 17 Jan 2021 16:03:42 +0000

Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

> Mauricio Collares <[email-masked]> writes:
>
>> This might be slightly off-topic (in the sense that the previous message
>> stands alone and is not corrected by this one) but I have a related
>> question to ask about the actual error I was hitting. To reproduce the
>> error, one can use git-commitx.el and elpa2nix.el from the previous
>> email and the following transientx.el file:
>>
>> ;;; transientx.el --- x -*- lexical-binding: t; -*-
>>
>> ;; Package-Requires: ((emacs "25.1"))
>> ;; Package-Version: 0
>>
>> (require 'cl-lib)
>> (require 'eieio)
>>
>> (defclass transient-suffix () ())
>> (cl-defmethod transient--init-suffix-key ((obj transient-suffix)))
>>
>> (advice-add 'top-level :before 'identity)
>>
>> (provide 'transientx)
>>
>> ;;; transientx.el ends here
>>
>> That is, the "provide" line is uncommented but there's now an advice-add
>> call. Running the following commands causes a problem similar to the one
>> in the previous message:
>>
>> $ --batch -Q -l ~/elpa2nix.el -f elpa2nix-install-package /home/collares/transientx.el 
>> $ --batch -Q --eval "(setq comp-eln-load-path '())" -l ~/elpa2nix.el -f elpa2nix-install-package /home/collares/git-commitx.el 
>>
>> git-commitx.el:6:1: Error: Cannot find suitable directory for output in ‘comp-eln-load-path’
>> Done (Total of 0 files compiled, 1 failed, 2 skipped)
>> Debugger entered--Lisp error: (error "transient--init-suffix-key is already defined as s...")
>>   error("%s is already defined as something else than a gen..." transient--init-suffix-key)
>>   cl-generic-ensure-function(transient--init-suffix-key)
>>
>> Apparently, advice-add caused native compilation to happen, and that
>> failed because comp-eln-load-path was empty. This error plays a role
>> similar to the lack of "(provide 'transientx)" in the previous email,
>> leading to the second error which does not happen in trunk.
>>
>> In this email, however, I would like to address the first error. My
>> question is: Is it possible to disable the native compilation caused by
>> advice-add in the above example?
>
> I think that's a bug, I believe `comp-enable-subr-trampolines' should
> cover this case too.

Hi Mauricio,

This should be fixed by 883d937320, could you give it a try and confirm?

Thanks

  Andrea