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

Previous Next

Package: emacs;

Reported by: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>

Date: Tue, 5 Mar 2024 23:55:01 UTC

Severity: normal

Done: Andrea Corallo <acorallo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 69573 in the body.
You can then email your comments to 69573 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Tue, 05 Mar 2024 23:55:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gabriele Nicolardi <gabriele <at> medialab.sissa.it>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 05 Mar 2024 23:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: bug-gnu-emacs <at> gnu.org
Subject: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Wed, 6 Mar 2024 00:53:20 +0100
[Message part 1 (text/plain, inline)]
Hi,
I have this code:

|(defun make-search-sensitive-to-ifpmod-advice (orig-fun &rest args) 
"Temporary advice the search functions to make them sensitive to 
`isearch-filter-predicate'" (let ((POINT (point))) (catch 'filtered 
(while (apply orig-fun args) (let ((B (match-beginning 0)) (E (match-end 
0))) ;; 1 - If all points in the region that matches the search ;; from 
the previous "search-command" meet the criteria ;; accepted by the 
filter, then the loop stops (`throw') and ;; returns the position 
`(point)`: (when (funcall isearch-filter-predicate B E) (throw 'filtered 
(point))))) ;; 2 - If the search is unsuccessful, or does not meet ;; 
the criteria accepted by the filter, then return to the ;; starting 
position and return the value `nil'. (goto-char POINT) nil))) |

|(defalias 'search-forward-ifpmod (symbol-function 'search-forward) 
"Copy of `search-forward' function (to be) adviced to obey to 
`isearch-filter-predicate'") (advice-add 'search-forward-ifpmod :around 
#'make-search-sensitive-to-ifpmod-advice) (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'") (defalias 'search-forward-regexp-ifpmod 
're-search-forward-ifpmod) ;; The following breaks my minor-modes 
definitions (advice-add 're-search-forward-ifpmod :around 
#'make-search-sensitive-to-ifpmod-advice) |

I found that this particular code snippet:

|(advice-add 're-search-forward-ifpmod :around 
#'make-search-sensitive-to-ifpmod-advice) |

breaks my minor-modes definitions. E.g. if I evaluate the code above and 
later on the following code (MWE):

|(defun mwe-function-1 () "MWE function 1" (interactive) (message 
"function 1 executed")) (define-minor-mode mwe-mode "MWE mode" 
:init-value nil :lighter (:eval (propertize " MWE " 'face '(:foreground 
"RoyalBlue" :background "DarkGoldenrod1"))) :keymap `( (,(kbd 
"<C-kp-1>") . mwe-function) ) (if mwe-mode (easy-menu-define mwe-menu 
mwe-mode-map "MWE" '("MWE mode" ;; I want the menu on mode-line only: 
:visible (not (eq (framep (selected-frame)) 'x)) ["mwe-function-1" 
mwe-function-1 :help "mwe-function 1"] )) t)) |

I get this error:

   internal-macroexpand-for-load: Eager macro-expansion failure:
   (wrong-type-argument integer-or-marker-p nil)


       Step to reproduce the error:

1. |emacs -Q|
2. Evalute the |add-advice| code
3. Evalute my minor-mode definiton

Did I make a mistake in the |add-advice| usage or is it a bug?

Best regards,

Gabriele Nicolardi

​
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Wed, 06 Mar 2024 00:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Wed, 06 Mar 2024 01:31:16 +0100
Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:

> I have this code: [...]

I can't reproduce this is with master or 29.1, but I can with 28.2.
This is the backtrace in 28.2:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  forward-paragraph(1)
  fill-forward-paragraph(1)
  fill-region(1 520 left t)
  easy-mmode--mode-docstring("MWE mode" "Mwe mode" mwe-mode-map mwe-mode)

I guess you hit a bug that has already been fixed.

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Wed, 06 Mar 2024 05:18:02 GMT) Full text and rfc822 format available.

Message #11 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Wed, 6 Mar 2024 06:16:31 +0100
I'm on Emacs 29.2

emacs -version
GNU Emacs 29.2
Development version ac89b1141a26 on master branch; build date 2024-02-27.

Il 06/03/24 01:31, Michael Heerdegen ha scritto:
> Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:
>
>> I have this code: [...]
> I can't reproduce this is with master or 29.1, but I can with 28.2.
> This is the backtrace in 28.2:
>
> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
>    forward-paragraph(1)
>    fill-forward-paragraph(1)
>    fill-region(1 520 left t)
>    easy-mmode--mode-docstring("MWE mode" "Mwe mode" mwe-mode-map mwe-mode)
>
> I guess you hit a bug that has already been fixed.
>
> Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Wed, 06 Mar 2024 05:44:01 GMT) Full text and rfc822 format available.

Message #14 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Wed, 6 Mar 2024 06:42:48 +0100
This is the backtrace in 29.2:

Debugger entered--Lisp error: (error "Eager macro-expansion failure: 
(wrong-type-argumen...")
  error("Eager macro-expansion failure: %S" (wrong-type-argument 
integer-or-marker-p nil))
  internal-macroexpand-for-load((define-minor-mode mwe-mode "MWE mode" 
:init-value nil :lighter (:eval (propertize " MWE " 'face '(:foreground 
"RoyalBlue" :background "DarkGoldenrod1"))) :keymap `((,(kbd "<C-kp-1>") 
. mwe-function)) (if mwe-mode (easy-menu-define mwe-menu mwe-mode-map 
"MWE" '("MWE mode" :visible (not (eq ... ...)) ["mwe-function-1" 
mwe-function-1 :help "mwe-function 1"])) t)) nil)
  eval-buffer()  ; Reading at buffer position 767

Il 06/03/24 01:31, Michael Heerdegen ha scritto:
> Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:
>
>> I have this code: [...]
> I can't reproduce this is with master or 29.1, but I can with 28.2.
> This is the backtrace in 28.2:
>
> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
>    forward-paragraph(1)
>    fill-forward-paragraph(1)
>    fill-region(1 520 left t)
>    easy-mmode--mode-docstring("MWE mode" "Mwe mode" mwe-mode-map mwe-mode)
>
> I guess you hit a bug that has already been fixed.
>
> Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Thu, 07 Mar 2024 02:54:02 GMT) Full text and rfc822 format available.

Message #17 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Thu, 07 Mar 2024 03:52:55 +0100
Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:

> I'm on Emacs 29.2
>
> emacs -version
> GNU Emacs 29.2
> Development version ac89b1141a26 on master branch; build date 2024-02-27.

Thanks.

I can't find a commit "ac89b1141a26" in my repository, though.  Where
does your Emacs come from (is it maybe a modified version)?

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Thu, 07 Mar 2024 03:17:02 GMT) Full text and rfc822 format available.

Message #20 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Thu, 07 Mar 2024 04:15:57 +0100
Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:

> This is the backtrace in 29.2:
>
> Debugger entered--Lisp error: (error "Eager macro-expansion failure:
> (wrong-type-argumen...")
>   error("Eager macro-expansion failure: %S" (wrong-type-argument
> integer-or-marker-p nil))

Thanks - I think that's the same problem as my backtrace showed.

My guesses are that either `easy-mmode--mode-docstring's setup of the
temporary buffer it uses for filling the docstring doesn't always suffice,
or there is an interference with nadvice's advices of docstring making
functions (`advice--defalias-fset', `nadvice--make-docstring').

Michael.




Information forwarded to acorallo <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Thu, 07 Mar 2024 05:56:02 GMT) Full text and rfc822 format available.

Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife
 of text editors" <bug-gnu-emacs <at> gnu.org>
Cc: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Thu, 07 Mar 2024 06:55:17 +0100
Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife
of text editors" <bug-gnu-emacs <at> gnu.org> 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.

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

Thx,

Michael.




Information forwarded to acorallo <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Thu, 07 Mar 2024 05:56:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Thu, 07 Mar 2024 16:28:01 GMT) Full text and rfc822 format available.

Message #29 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Michael Heerdegen via Bug reports for GNU "Emacs," the Swiss army knife of
 text editors <bug-gnu-emacs <at> gnu.org>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Thu, 7 Mar 2024 17:26:37 +0100
[Message part 1 (text/plain, inline)]
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"<bug-gnu-emacs <at> gnu.org>  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.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Thu, 07 Mar 2024 16:28:02 GMT) Full text and rfc822 format available.

Information forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Sat, 09 Mar 2024 04:31:02 GMT) Full text and rfc822 format available.

Message #35 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Sat, 09 Mar 2024 05:30:24 +0100
Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:

> Is my code wrong in some way?

I don't know.

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

Stefan, can you help maybe?  Gabriele then does this:

#+begin_src emacs-lisp
(advice-add 're-search-forward-ifpmod
            :around
            #'make-search-sensitive-to-ifpmod-advice)
#+end_src

and we have found that this causes weird errors because at least some
definitions, like `forward-paragraph', call `re-search-forward-ifpmod'
afterwards.  This seems to happen only when using a native compiled
Emacs, and the effect disappears when loading the source - paragraphs.el
in this case.  Is this normal?


Michael




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Sat, 09 Mar 2024 04:34:02 GMT) Full text and rfc822 format available.

Message #38 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Sat, 09 Mar 2024 05:33:14 +0100
Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:

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

`load'.  But I think this would only work around one symptom, and I
guess more things are broken by your advice.  Let's first wait for
someone who understands better what's going on, ok?

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Sat, 09 Mar 2024 07:16:02 GMT) Full text and rfc822 format available.

Message #41 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Sat, 9 Mar 2024 08:14:49 +0100
[Message part 1 (text/plain, inline)]
Il 09/03/24 05:33, Michael Heerdegen ha scritto:
>> 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.
> `load'.  But I think this would only work around one symptom, and I
> guess more things are broken by your advice.  Let's first wait for
> someone who understands better what's going on, ok?
>
> Michael.
Ok, thanks
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Sat, 09 Mar 2024 14:48:02 GMT) Full text and rfc822 format available.

Message #44 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Gabriele Nicolardi <gabriele <at> medialab.sissa.it>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Sat, 09 Mar 2024 09:47:06 -0500
>> (defalias 're-search-forward-ifpmod (symbol-function 're-search-forward) ...)
[...]
> Stefan, can you help maybe?  Gabriele then does this:
[...]
> and we have found that this causes weird errors because at least some
> definitions, like `forward-paragraph', call `re-search-forward-ifpmod'
> afterwards.  This seems to happen only when using a native compiled

Sounds like a problem in the code that installs trampolines.

Andrea?

If we look at `fset`, the C code does:

    if (!NILP (Vnative_comp_enable_subr_trampolines)
        && SUBRP (function)
        && !SUBR_NATIVE_COMPILEDP (function))
      CALLN (Ffuncall, Qcomp_subr_trampoline_install, symbol);

so indeed if the SUBR_NATIVE_COMPILEDP function is stored in another
symbol, we will still call Qcomp_subr_trampoline_install, even tho it's
a case where it should not be necessary, and I suspect this can lead to
the kind of problems mentioned above, if we do something like

    (defalias 'foo (symbol-function 'bar))
    (fset 'foo <something-else>)

where native calls to `bar` could end up redirected to the definition of
`foo` :-(


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Sat, 09 Mar 2024 21:44:01 GMT) Full text and rfc822 format available.

Message #47 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Gabriele Nicolardi <gabriele <at> medialab.sissa.it>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Sat, 09 Mar 2024 16:41:02 -0500
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> (defalias 're-search-forward-ifpmod (symbol-function 're-search-forward) ...)
> [...]
>> Stefan, can you help maybe?  Gabriele then does this:
> [...]
>> and we have found that this causes weird errors because at least some
>> definitions, like `forward-paragraph', call `re-search-forward-ifpmod'
>> afterwards.  This seems to happen only when using a native compiled
>
> Sounds like a problem in the code that installs trampolines.
>
> Andrea?
>
> If we look at `fset`, the C code does:
>
>     if (!NILP (Vnative_comp_enable_subr_trampolines)
>         && SUBRP (function)
>         && !SUBR_NATIVE_COMPILEDP (function))
>       CALLN (Ffuncall, Qcomp_subr_trampoline_install, symbol);
>
> so indeed if the SUBR_NATIVE_COMPILEDP function is stored in another
> symbol, we will still call Qcomp_subr_trampoline_install, even tho it's
> a case where it should not be necessary, and I suspect this can lead to
> the kind of problems mentioned above, if we do something like
>
>     (defalias 'foo (symbol-function 'bar))
>     (fset 'foo <something-else>)
>
> where native calls to `bar` could end up redirected to the definition of
> `foo` :-(

Here I'm,

mmmhh, I'm really not sure why calling Qcomp_subr_trampoline_install
should be problematic.  I'll look at it, but this week I'm on holiday so
might take a bit more :)

Bests

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Sat, 09 Mar 2024 21:50:02 GMT) Full text and rfc822 format available.

Message #50 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Gabriele Nicolardi <gabriele <at> medialab.sissa.it>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Sat, 09 Mar 2024 16:48:22 -0500
> mmmhh, I'm really not sure why calling Qcomp_subr_trampoline_install
> should be problematic.  I'll look at it, but this week I'm on holiday so
> might take a bit more :)

I'm not completely sure either, but the arg of
`comp-subr-trampoline-install` is called `subr-name` whereas the value
we pass there is the symbol that was found to contain that subr but is
*not* the name of the subr (and when that's the case, there's simply no
need to install any trampoline).

So, I'd expect `comp-subr-trampoline-install` to compare its argument
with the actual name of the subr (presumably extracted from the subr),
but I don't see any such test.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Fri, 15 Mar 2024 13:56:02 GMT) Full text and rfc822 format available.

Message #53 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Gabriele Nicolardi <gabriele <at> medialab.sissa.it>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Fri, 15 Mar 2024 09:52:23 -0400
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>> mmmhh, I'm really not sure why calling Qcomp_subr_trampoline_install
>> should be problematic.  I'll look at it, but this week I'm on holiday so
>> might take a bit more :)
>
> I'm not completely sure either, but the arg of
> `comp-subr-trampoline-install` is called `subr-name` whereas the value
> we pass there is the symbol that was found to contain that subr but is
> *not* the name of the subr (and when that's the case, there's simply no
> need to install any trampoline).
>
> So, I'd expect `comp-subr-trampoline-install` to compare its argument
> with the actual name of the subr (presumably extracted from the subr),
> but I don't see any such test.

Okay I've installed 00553628558 into master, I believe it does what we
want and seems to fix the minimal reproducer I made from the original
example.

Gabriele could you check it solves the issue for you?

Now thinking about, I think we should install it into 29 if it proves to
be the right fix.

Thanks!

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Fri, 15 Mar 2024 14:38:01 GMT) Full text and rfc822 format available.

Message #56 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Gabriele Nicolardi <gabriele <at> medialab.sissa.it>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Fri, 15 Mar 2024 10:36:07 -0400
> Okay I've installed 00553628558 into master,  I believe it does what
> we want and seems to fix the minimal reproducer I made from the
> original example.

Oh, nice, that was easy.
Thanks,


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Fri, 15 Mar 2024 16:24:02 GMT) Full text and rfc822 format available.

Message #59 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: Andrea Corallo <acorallo <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Fri, 15 Mar 2024 17:22:26 +0100
[Message part 1 (text/plain, inline)]

Il 15/03/24 14:52, Andrea Corallo wrote:
> Okay I've installed 00553628558 into master, I believe it does what we
> want and seems to fix the minimal reproducer I made from the original
> example.
>
> Gabriele could you check it solves the issue for you?
I'm sorry, but I'm not sure what to do to test the modification.
I have Emacs 29.2 installed via snap. I suppose I would need to
install the modified version by downloading it from the repo.
This is something I've never done before.
If necessary, I could try doing it on a virtual machine.
> Now thinking about, I think we should install it into 29 if it proves to
> be the right fix.
This would be desirable since the version provided by snap is indeed 29.

Thanks!

Gabriele
> Thanks!
>
>    Andrea
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Fri, 15 Mar 2024 17:00:02 GMT) Full text and rfc822 format available.

Message #62 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Fri, 15 Mar 2024 12:58:14 -0400
Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:

> Il 15/03/24 14:52, Andrea Corallo wrote:
>
>  Okay I've installed 00553628558 into master, I believe it does what we
> want and seems to fix the minimal reproducer I made from the original
> example.
>
> Gabriele could you check it solves the issue for you?
>
> I'm sorry, but I'm not sure what to do to test the modification.
> I have Emacs 29.2 installed via snap. I suppose I would need to
> install the modified version by downloading it from the repo. 
> This is something I've never done before.
> If necessary, I could try doing it on a virtual machine.

Something like this should do the job (you might need to install some
package):

$ git clone https://git.savannah.gnu.org/git/emacs.git
$ cd emacs && ./autogen.sh && ./configure --with-native-compilation && make -j16

Once done you can run this emacs without installing it with $ ./src/emacs

So if you wanted to use a VM not to install this particular Emacs it
might not be necessary.

>  Now thinking about, I think we should install it into 29 if it proves to
> be the right fix.
>
> This would be desirable since the version provided by snap is indeed 29.

Once we are more confident is not causing issues I'll do it.  Maybe we
can revist this in few weeks, hopefully sitting on master we should get
a report if something breaks.

> Thanks!
>
> Gabriele

Welcome :)

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Fri, 15 Mar 2024 17:25:02 GMT) Full text and rfc822 format available.

Message #65 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Andrea Corallo <acorallo <at> gnu.org>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Fri, 15 Mar 2024 13:24:13 -0400
> I'm sorry, but I'm not sure what to do to test the modification.
> I have Emacs 29.2 installed via snap. I suppose I would need to
> install the modified version by downloading it from the repo.
> This is something I've never done before.
> If necessary, I could try doing it on a virtual machine.

If you want a lightweight approximation to the real test, you could add
the following to the beginning of your init file:

    (with-eval-after-load 'comp-run
      (require 'cl-lib)
      (defun comp-subr-trampoline-install (subr-name)
        "Make SUBR-NAME effectively advice-able when called from native code."
        (when (memq subr-name comp-warn-primitives)
          (warn "Redefining `%s' might break native compilation of trampolines."
                subr-name))
        (let ((subr (symbol-function subr-name)))
          (unless (or (not (string= subr-name (subr-name subr))) ;; (bug#69573)
                      (null native-comp-enable-subr-trampolines)
                      (memq subr-name native-comp-never-optimize-functions)
                      (gethash subr-name comp-installed-trampolines-h))
            (cl-assert (subr-primitive-p subr))
            (when-let ((trampoline (or (comp-trampoline-search subr-name)
                                       (comp-trampoline-compile subr-name))))
              (comp--install-trampoline subr-name trampoline))))))

and then try and reproduce the problem.


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Sun, 17 Mar 2024 09:32:01 GMT) Full text and rfc822 format available.

Message #68 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Sun, 17 Mar 2024 10:30:35 +0100
[Message part 1 (text/plain, inline)]
Il 15/03/24 17:58, Andrea Corallo ha scritto:
> Something like this should do the job (you might need to install some
> package):
>
> $ git clonehttps://git.savannah.gnu.org/git/emacs.git
> $ cd emacs && ./autogen.sh && ./configure --with-native-compilation && make -j16
I was not able to build Emacs because of:

configure: error: ELisp native compiler was requested, but libgccjit was 
not found.
Please try installing libgccjit or a similar package.

(I installed libgccjit-10-dev)

Gabriele
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Sun, 17 Mar 2024 09:35:02 GMT) Full text and rfc822 format available.

Message #71 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Andrea Corallo <acorallo <at> gnu.org>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Sun, 17 Mar 2024 10:33:59 +0100
Il 15/03/24 18:24, Stefan Monnier ha scritto:
>> I'm sorry, but I'm not sure what to do to test the modification.
>> I have Emacs 29.2 installed via snap. I suppose I would need to
>> install the modified version by downloading it from the repo.
>> This is something I've never done before.
>> If necessary, I could try doing it on a virtual machine.
> If you want a lightweight approximation to the real test, you could add
> the following to the beginning of your init file:
>
>      (with-eval-after-load 'comp-run
>        (require 'cl-lib)
>        (defun comp-subr-trampoline-install (subr-name)
>          "Make SUBR-NAME effectively advice-able when called from native code."
>          (when (memq subr-name comp-warn-primitives)
>            (warn "Redefining `%s' might break native compilation of trampolines."
>                  subr-name))
>          (let ((subr (symbol-function subr-name)))
>            (unless (or (not (string= subr-name (subr-name subr))) ;; (bug#69573)
>                        (null native-comp-enable-subr-trampolines)
>                        (memq subr-name native-comp-never-optimize-functions)
>                        (gethash subr-name comp-installed-trampolines-h))
>              (cl-assert (subr-primitive-p subr))
>              (when-let ((trampoline (or (comp-trampoline-search subr-name)
>                                         (comp-trampoline-compile subr-name))))
>                (comp--install-trampoline subr-name trampoline))))))
>
> and then try and reproduce the problem.
>
>
>          Stefan
I tried to copy the code provided at the beginning of my .emacs file, 
but the issue persists.

Gabriele






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Mon, 18 Mar 2024 09:39:01 GMT) Full text and rfc822 format available.

Message #74 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Mon, 18 Mar 2024 05:35:11 -0400
Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:

> Il 15/03/24 18:24, Stefan Monnier ha scritto:
>>> I'm sorry, but I'm not sure what to do to test the modification.
>>> I have Emacs 29.2 installed via snap. I suppose I would need to
>>> install the modified version by downloading it from the repo.
>>> This is something I've never done before.
>>> If necessary, I could try doing it on a virtual machine.
>> If you want a lightweight approximation to the real test, you could add
>> the following to the beginning of your init file:
>>
>>      (with-eval-after-load 'comp-run
>>        (require 'cl-lib)
>>        (defun comp-subr-trampoline-install (subr-name)
>>          "Make SUBR-NAME effectively advice-able when called from native code."
>>          (when (memq subr-name comp-warn-primitives)
>>            (warn "Redefining `%s' might break native compilation of trampolines."
>>                  subr-name))
>>          (let ((subr (symbol-function subr-name)))
>>            (unless (or (not (string= subr-name (subr-name subr))) ;; (bug#69573)
>>                        (null native-comp-enable-subr-trampolines)
>>                        (memq subr-name native-comp-never-optimize-functions)
>>                        (gethash subr-name comp-installed-trampolines-h))
>>              (cl-assert (subr-primitive-p subr))
>>              (when-let ((trampoline (or (comp-trampoline-search subr-name)
>>                                         (comp-trampoline-compile subr-name))))
>>                (comp--install-trampoline subr-name trampoline))))))
>>
>> and then try and reproduce the problem.
>>
>>
>>          Stefan
> I tried to copy the code provided at the beginning of my .emacs file,
> but the issue persists.

I'm not sure comp-run is not already loaded when this gets evaluated,
removing "(with-eval-after-load 'comp-run" might do the job?  The real
test would be recompiling tho :)

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Mon, 18 Mar 2024 18:11:02 GMT) Full text and rfc822 format available.

Message #77 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
To: Andrea Corallo <acorallo <at> gnu.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Mon, 18 Mar 2024 18:28:00 +0100
[Message part 1 (text/plain, inline)]
Il 15/03/24 14:52, Andrea Corallo ha scritto:
> kay I've installed 00553628558 into master, I believe it does what we
> want and seems to fix the minimal reproducer I made from the original
> example.
>
> Gabriele could you check it solves the issue for you?
I confirm that the version compiled from master resolves my issue.

Thank you!

Gabriele
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#69573; Package emacs. (Mon, 18 Mar 2024 19:44:01 GMT) Full text and rfc822 format available.

Message #80 received at 69573 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 69573 <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Mon, 18 Mar 2024 15:42:54 -0400
Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:

> Il 15/03/24 14:52, Andrea Corallo ha scritto:
>
>  kay I've installed 00553628558 into master, I believe it does what we
> want and seems to fix the minimal reproducer I made from the original
> example.
>
> Gabriele could you check it solves the issue for you?
>
> I confirm that the version compiled from master resolves my issue.
>
> Thank you!
>
> Gabriele

Very cool.  I'll keep this bug open a bit just so we remeber to
re-evaluate the backport.

Thanks!

  Andrea




Reply sent to Andrea Corallo <acorallo <at> gnu.org>:
You have taken responsibility. (Tue, 26 Mar 2024 13:45:02 GMT) Full text and rfc822 format available.

Notification sent to Gabriele Nicolardi <gabriele <at> medialab.sissa.it>:
bug acknowledged by developer. (Tue, 26 Mar 2024 13:45:03 GMT) Full text and rfc822 format available.

Message #85 received at 69573-done <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Gabriele Nicolardi <gabriele <at> medialab.sissa.it>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 69573-done <at> debbugs.gnu.org
Subject: Re: bug#69573: Eager macro-expansion failure: (wrong-type-argument
 integer-or-marker-p nil)
Date: Tue, 26 Mar 2024 03:34:46 -0400
Andrea Corallo <acorallo <at> gnu.org> writes:

> Gabriele Nicolardi <gabriele <at> medialab.sissa.it> writes:
>
>> Il 15/03/24 14:52, Andrea Corallo ha scritto:
>>
>>  kay I've installed 00553628558 into master, I believe it does what we
>> want and seems to fix the minimal reproducer I made from the original
>> example.
>>
>> Gabriele could you check it solves the issue for you?
>>
>> I confirm that the version compiled from master resolves my issue.
>>
>> Thank you!
>>
>> Gabriele
>
> Very cool.  I'll keep this bug open a bit just so we remeber to
> re-evaluate the backport.

Okay backported the fix to emacs-29.  I'm closing this.

Thanks

  Andrea




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 24 Apr 2024 11:25:52 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 117 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.