all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
@ 2024-03-05 23:53 Gabriele Nicolardi
  2024-03-06  0:31 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-05 23:53 UTC (permalink / raw)
  To: 69573

[-- Attachment #1: Type: text/plain, Size: 2554 bytes --]

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

​

[-- Attachment #2: Type: text/html, Size: 12408 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-05 23:53 bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil) Gabriele Nicolardi
@ 2024-03-06  0:31 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-06  5:16   ` Gabriele Nicolardi
  2024-03-06  5:42   ` Gabriele Nicolardi
  0 siblings, 2 replies; 25+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-06  0:31 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: 69573

Gabriele Nicolardi <gabriele@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.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-06  0:31 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-06  5:16   ` Gabriele Nicolardi
  2024-03-07  2:52     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-06  5:42   ` Gabriele Nicolardi
  1 sibling, 1 reply; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-06  5:16 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 69573

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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-06  0:31 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-06  5:16   ` Gabriele Nicolardi
@ 2024-03-06  5:42   ` Gabriele Nicolardi
  2024-03-07  3:15     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-06  5:42 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 69573

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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-06  5:16   ` Gabriele Nicolardi
@ 2024-03-07  2:52     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-07  5:55       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 25+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-07  2:52 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: 69573

Gabriele Nicolardi <gabriele@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.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-06  5:42   ` Gabriele Nicolardi
@ 2024-03-07  3:15     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 25+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-07  3:15 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: 69573

Gabriele Nicolardi <gabriele@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.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-07  2:52     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-07  5:55       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-07 16:26         ` Gabriele Nicolardi
  0 siblings, 1 reply; 25+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-07  5:55 UTC (permalink / raw)
  To: 69573; +Cc: gabriele, Andrea Corallo

Michael Heerdegen via "Bug reports for GNU Emacs, the Swiss army knife
of text editors" <bug-gnu-emacs@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.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-07  5:55       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-07 16:26         ` Gabriele Nicolardi
  2024-03-09  4:30           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-09  4:33           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-07 16:26 UTC (permalink / raw)
  To: michael_heerdegen, 69573

[-- Attachment #1: Type: text/plain, Size: 2021 bytes --]


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

[-- Attachment #2: Type: text/html, Size: 3428 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-07 16:26         ` Gabriele Nicolardi
@ 2024-03-09  4:30           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-09 14:47             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-09  4:33           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 25+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-09  4:30 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: 69573, Stefan Monnier

Gabriele Nicolardi <gabriele@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-07 16:26         ` Gabriele Nicolardi
  2024-03-09  4:30           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-09  4:33           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-09  7:14             ` Gabriele Nicolardi
  1 sibling, 1 reply; 25+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-09  4:33 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: 69573

Gabriele Nicolardi <gabriele@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.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-09  4:33           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-09  7:14             ` Gabriele Nicolardi
  0 siblings, 0 replies; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-09  7:14 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 69573

[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 795 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-09  4:30           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-09 14:47             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-09 21:41               ` Andrea Corallo
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-09 14:47 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: Michael Heerdegen, Gabriele Nicolardi, 69573

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






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-09 14:47             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-09 21:41               ` Andrea Corallo
  2024-03-09 21:48                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 25+ messages in thread
From: Andrea Corallo @ 2024-03-09 21:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, Gabriele Nicolardi, 69573

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-09 21:41               ` Andrea Corallo
@ 2024-03-09 21:48                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-15 13:52                   ` Andrea Corallo
  0 siblings, 1 reply; 25+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-09 21:48 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: Michael Heerdegen, Gabriele Nicolardi, 69573

> 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






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-09 21:48                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-15 13:52                   ` Andrea Corallo
  2024-03-15 14:36                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
                                       ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Andrea Corallo @ 2024-03-15 13:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, Gabriele Nicolardi, 69573

Stefan Monnier <monnier@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-15 13:52                   ` Andrea Corallo
@ 2024-03-15 14:36                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-15 16:22                     ` Gabriele Nicolardi
  2024-03-18 17:28                     ` Gabriele Nicolardi
  2 siblings, 0 replies; 25+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-15 14:36 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: Michael Heerdegen, Gabriele Nicolardi, 69573

> 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






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-15 13:52                   ` Andrea Corallo
  2024-03-15 14:36                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-15 16:22                     ` Gabriele Nicolardi
  2024-03-15 16:58                       ` Andrea Corallo
  2024-03-15 17:24                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-18 17:28                     ` Gabriele Nicolardi
  2 siblings, 2 replies; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-15 16:22 UTC (permalink / raw)
  To: Andrea Corallo, Stefan Monnier; +Cc: Michael Heerdegen, 69573

[-- Attachment #1: Type: text/plain, Size: 758 bytes --]



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

[-- Attachment #2: Type: text/html, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-15 16:22                     ` Gabriele Nicolardi
@ 2024-03-15 16:58                       ` Andrea Corallo
  2024-03-17  9:30                         ` Gabriele Nicolardi
  2024-03-15 17:24                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 25+ messages in thread
From: Andrea Corallo @ 2024-03-15 16:58 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Michael Heerdegen, Stefan Monnier, 69573

Gabriele Nicolardi <gabriele@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-15 16:22                     ` Gabriele Nicolardi
  2024-03-15 16:58                       ` Andrea Corallo
@ 2024-03-15 17:24                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-17  9:33                         ` Gabriele Nicolardi
  1 sibling, 1 reply; 25+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-03-15 17:24 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Michael Heerdegen, Andrea Corallo, 69573

> 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






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-15 16:58                       ` Andrea Corallo
@ 2024-03-17  9:30                         ` Gabriele Nicolardi
  0 siblings, 0 replies; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-17  9:30 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: Michael Heerdegen, Stefan Monnier, 69573

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 959 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-15 17:24                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-03-17  9:33                         ` Gabriele Nicolardi
  2024-03-18  9:35                           ` Andrea Corallo
  0 siblings, 1 reply; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-17  9:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Michael Heerdegen, Andrea Corallo, 69573


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







^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-17  9:33                         ` Gabriele Nicolardi
@ 2024-03-18  9:35                           ` Andrea Corallo
  0 siblings, 0 replies; 25+ messages in thread
From: Andrea Corallo @ 2024-03-18  9:35 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Michael Heerdegen, Stefan Monnier, 69573

Gabriele Nicolardi <gabriele@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-15 13:52                   ` Andrea Corallo
  2024-03-15 14:36                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-03-15 16:22                     ` Gabriele Nicolardi
@ 2024-03-18 17:28                     ` Gabriele Nicolardi
  2024-03-18 19:42                       ` Andrea Corallo
  2 siblings, 1 reply; 25+ messages in thread
From: Gabriele Nicolardi @ 2024-03-18 17:28 UTC (permalink / raw)
  To: Andrea Corallo, Stefan Monnier; +Cc: Michael Heerdegen, 69573

[-- Attachment #1: Type: text/plain, Size: 347 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 637 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-18 17:28                     ` Gabriele Nicolardi
@ 2024-03-18 19:42                       ` Andrea Corallo
  2024-03-26  7:34                         ` Andrea Corallo
  0 siblings, 1 reply; 25+ messages in thread
From: Andrea Corallo @ 2024-03-18 19:42 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Michael Heerdegen, Stefan Monnier, 69573

Gabriele Nicolardi <gabriele@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil)
  2024-03-18 19:42                       ` Andrea Corallo
@ 2024-03-26  7:34                         ` Andrea Corallo
  0 siblings, 0 replies; 25+ messages in thread
From: Andrea Corallo @ 2024-03-26  7:34 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Michael Heerdegen, Stefan Monnier, 69573-done

Andrea Corallo <acorallo@gnu.org> writes:

> Gabriele Nicolardi <gabriele@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





^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2024-03-26  7:34 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05 23:53 bug#69573: Eager macro-expansion failure: (wrong-type-argument integer-or-marker-p nil) Gabriele Nicolardi
2024-03-06  0:31 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-06  5:16   ` Gabriele Nicolardi
2024-03-07  2:52     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07  5:55       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-07 16:26         ` Gabriele Nicolardi
2024-03-09  4:30           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-09 14:47             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-09 21:41               ` Andrea Corallo
2024-03-09 21:48                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-15 13:52                   ` Andrea Corallo
2024-03-15 14:36                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-15 16:22                     ` Gabriele Nicolardi
2024-03-15 16:58                       ` Andrea Corallo
2024-03-17  9:30                         ` Gabriele Nicolardi
2024-03-15 17:24                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-17  9:33                         ` Gabriele Nicolardi
2024-03-18  9:35                           ` Andrea Corallo
2024-03-18 17:28                     ` Gabriele Nicolardi
2024-03-18 19:42                       ` Andrea Corallo
2024-03-26  7:34                         ` Andrea Corallo
2024-03-09  4:33           ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-09  7:14             ` Gabriele Nicolardi
2024-03-06  5:42   ` Gabriele Nicolardi
2024-03-07  3:15     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.