Subject: bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)

From: Gabriele Nicolardi <[email-masked]>
Date: Thu, 7 Mar 2024 17:26:37 +0100

Il 07/03/24 06:55, Michael Heerdegen ha scritto:
> Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife
> of text editors"<[email-masked]>  writes:
>
>> I can't find a commit "ac89b1141a26" in my repository, though.  Where
>> does your Emacs come from (is it maybe a modified version)?
> Forget this question please.  I can now reproduce with master, too.
>
> But: This is only reproducible when I build Emacs with native
> compilation enabled.  Then I get this backtrace with your recipe:
>
> | Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
> |   forward-paragraph(1)
> |   fill-forward-paragraph(1)
> |   fill-region(11 528 left t)
> |   easy-mmode--mode-docstring("MWE mode" "Mwe mode" mwe-mode-map mwe-mode nil)
> |   #f(compiled-function (arg1 arg2 &rest rest) "Define a new minor mode MODE....
> |   elisp--eval-last-sexp(nil)
>
> When I load the source of paragraphs.el (where `forward-paragraph' is
> defined) the problem goes away.

I confirm that evaluating paragraphs.el makes the problem go away.

But why? I create a copy of the `re-search-forward` function because I 
DON'T want advice the original function:

;; The following breaks my minor-modes definitions (advice-add 
're-search-forward-ifpmod :around #'make-search-sensitive-to-ifpmod-advice)

Why `forward-paragraph` should be sensitive to a function 
`re-search-forward-ifpmod` that it doesn't call?

Is my code wrong in some way?

I mean that I think that

(defalias 're-search-forward-ifpmod (symbol-function 're-search-forward) 
"Copy of `re-search-forward' function (to be) adviced to obey to 
`isearch-filter-predicate'")

should create a COPY, not an ALIAS, of the `re-search-forward` function 
indipendent of the original function.

Anyway, how can I force the loading of paragraphs.el? I don't se the 
"provide" feature and I need to share my code with my teammates.

Gabriele Nicolardi

>
> Maybe Andrea can help?  Just CC'd - I don't know how to continue here.
>
> Thx,
>
> Michael.