unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Michael Heerdegen <michael_heerdegen@web.de>,
	Lars Ingebrigtsen <larsi@gnus.org>
Cc: acm@muc.de, 54079@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#54079: 29.0.50; Method dispatching eratically fails
Date: Sat, 5 Mar 2022 16:37:16 +0000	[thread overview]
Message-ID: <YiORvNiig91Wu3Cf@ACM> (raw)
In-Reply-To: <875youbhbu.fsf@web.de>

Hello, Michael.

On Fri, Mar 04, 2022 at 03:08:05 +0100, Michael Heerdegen wrote:
> Michael Heerdegen <michael_heerdegen@web.de> writes:

> > This short recipe gives me the same error in emacs -Q:
> >
> > (byte-compile-file
> >  "/home/micha/software/emacs/lisp/emacs-lisp/cl-generic.el")
> > (require 'gnus-search)

> Small addition: it seems that all issues mentioned disappear when I
> avoid any byte compilation in my session.  Compilation of `defstruct's
> seems to be the culprit (hypothesis).

> Would be good to fix this problem not too late.  I think it will
> irritate or distract other people, too.

I think this problem can only happen for defuns/defvars/defconts inside
eval-when-compile or eval-and-compile.

Would you try out the following patch, please, which I believe fixes the
bug.

Thanks!



diff --git a/src/data.c b/src/data.c
index 1526cc0c73..0854b4efb4 100644
--- a/src/data.c
+++ b/src/data.c
@@ -942,6 +942,13 @@ The return value is undefined.  */)
   (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
 {
   CHECK_SYMBOL (symbol);
+  /* If we're in a byte compilation, ensure the definition's symbols
+     are stripped of their positions. */
+  if (symbols_with_pos_enabled
+      && SYMBOL_WITH_POS_P (symbol)
+      && Ffboundp (Qbyte_run_strip_symbol_positions))
+    call1 (Qbyte_run_strip_symbol_positions, definition);
+
   if (!NILP (Vpurify_flag)
       /* If `definition' is a keymap, immutable (and copying) is wrong.  */
       && !KEYMAPP (definition))
@@ -4352,6 +4359,8 @@ This variable cannot be set; trying to do so will signal an error.  */);
 Bind this to non-nil in applications such as the byte compiler.  */);
   symbols_with_pos_enabled = false;
 
+  DEFSYM (Qbyte_run_strip_symbol_positions, "byte-run-strip-symbol-positions");
+
   DEFSYM (Qwatchers, "watchers");
   DEFSYM (Qmakunbound, "makunbound");
   DEFSYM (Qunlet, "unlet");
diff --git a/src/eval.c b/src/eval.c
index 294d79e67a..1b1fde3a20 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -794,6 +794,12 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
       if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail))))
 	error ("Too many arguments");
       Lisp_Object exp = XCAR (tail);
+      /* If we're in a byte compilation, ensure the definition's
+	 symbols are stripped of their positions. */
+      if (symbols_with_pos_enabled
+	  && SYMBOL_WITH_POS_P (sym)
+	  && Ffboundp (Qbyte_run_strip_symbol_positions))
+	call1 (Qbyte_run_strip_symbol_positions, exp);
 
       tem = Fdefault_boundp (sym);
       tail = XCDR (tail);
@@ -861,6 +867,14 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
     }
 
   Finternal__define_uninitialized_variable (sym, docstring);
+
+  /* If we're in a byte compilation, ensure the definition's symbols
+     are stripped of their positions. */
+  if (symbols_with_pos_enabled
+      && SYMBOL_WITH_POS_P (sym)
+      && Ffboundp (Qbyte_run_strip_symbol_positions))
+    call1 (Qbyte_run_strip_symbol_positions, XCAR (XCDR (args)));
+
   tem = eval_sub (XCAR (XCDR (args)));
   if (!NILP (Vpurify_flag))
     tem = Fpurecopy (tem);


> Michael.


-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2022-03-05 16:37 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21  0:12 bug#54079: 29.0.50; Method dispatching eratically fails Michael Heerdegen
2022-02-21  1:14 ` Michael Heerdegen
2022-03-04 16:12   ` Lars Ingebrigtsen
2022-02-21  3:16 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-02-21  4:21   ` Michael Heerdegen
2022-02-22 23:55     ` Michael Heerdegen
2022-02-23  0:27       ` Michael Heerdegen
2022-02-23  0:47         ` Michael Heerdegen
2022-03-04  2:08           ` Michael Heerdegen
2022-03-04 19:11             ` Alan Mackenzie
2022-03-05 16:37             ` Alan Mackenzie [this message]
2022-03-05 17:57               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-05 19:00                 ` Alan Mackenzie
2022-03-05 23:01                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-05 18:19               ` Eli Zaretskii
2022-03-05 19:07                 ` Alan Mackenzie
2022-03-06  2:19               ` Michael Heerdegen
2022-03-08 19:28                 ` Alan Mackenzie
2022-03-08 19:53                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-08 20:48                     ` Alan Mackenzie
2022-03-08 21:03                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-09 17:42                         ` Alan Mackenzie
2022-03-09 18:06                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-09 20:32                             ` Alan Mackenzie
2022-03-09 22:04                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-11 22:01                                 ` Alan Mackenzie
2022-03-12  4:23                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-13 16:49                                     ` Alan Mackenzie
2022-03-14 12:10                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-03-09  4:10                   ` Michael Heerdegen
2022-03-09 17:29                     ` Alan Mackenzie
2022-03-16  1:44                       ` Michael Heerdegen
2022-03-16 11:52                         ` Alan Mackenzie
2022-03-16 19:22                           ` Michael Heerdegen
2022-03-17  2:58                           ` Michael Heerdegen
2022-03-16 19:29                         ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YiORvNiig91Wu3Cf@ACM \
    --to=acm@muc.de \
    --cc=54079@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).