all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: acm@muc.de, Eli Zaretskii <eliz@gnu.org>,
	57179@debbugs.gnu.org,
	Andrea Greselin <greselin.andrea@gmail.com>
Subject: bug#57179: 29.0.50: 'wrong-number-of-arguments' for function of two arguments called from 'window-scroll-functions'
Date: Sun, 14 Aug 2022 13:22:36 +0000	[thread overview]
Message-ID: <Yvj3HAWLcnhTZVg3@ACM> (raw)
In-Reply-To: <87o7wnoewc.fsf@web.de>

Hello, Michael and Andrea.

On Sun, Aug 14, 2022 at 02:19:31 +0200, Michael Heerdegen wrote:
> Michael Heerdegen <michael_heerdegen@web.de> writes:

> > Please tell whether this information suffices and you already have some
> > idea or if I should try to create a recipe.  I guess this must be
> > related to a recent change from within the last few days.

> Reverting a part of

> 48215c41d1 New debugging facility: backtraces from errors in Lisp called
> from redisplay (Alan Mackenzie <acm@muc.de> 2022-08-11)

> like this:


> From ffb7c3d558b599bcc84f1bf4fb4388569892d927 Mon Sep 17 00:00:00 2001
> From: Michael Heerdegen <michael_heerdegen@web.de>
> Date: Sun, 14 Aug 2022 02:14:58 +0200
> Subject: [PATCH] Test for #57179
> 
> ---
>  src/xdisp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/xdisp.c b/src/xdisp.c
> index 719b131baa..47eaddabce 100644
> --- a/src/xdisp.c
> +++ b/src/xdisp.c
> @@ -18221,8 +18221,8 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
>      {
>        specpdl_ref count = SPECPDL_INDEX ();
>        specbind (Qinhibit_quit, Qt);
> -      safe_run_hooks_2
> -	(Qwindow_scroll_functions, window, make_fixnum (CHARPOS (startp)));
> +      run_hook_with_args_2 (Qwindow_scroll_functions, window,
> +			    make_fixnum (CHARPOS (startp)));
>        unbind_to (count, Qnil);
>        SET_TEXT_POS_FROM_MARKER (startp, w->start);
>        /* In case the hook functions switch buffers.  */
> --
> 2.30.2
> 


> seems to fix my incarnation of this problem.  Can it be that?  CC'ing
> Alan (the author).

Yes, this was indeed the problem.  Can I ask you please, instead of
applying your patch (above) to try out the following patch, which works
for me.

Thanks!



diff --git a/src/keyboard.c b/src/keyboard.c
index 8a2b7d58c4..1d7125a0a3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1832,8 +1832,16 @@ adjust_point_for_property (ptrdiff_t last_pt, bool modified)
 static Lisp_Object
 safe_run_hooks_1 (ptrdiff_t nargs, Lisp_Object *args)
 {
-  eassert (nargs == 2);
-  return call0 (args[1]);
+  eassert (nargs >= 2 && nargs <= 4);
+  switch (nargs)
+    {
+    case 2:
+      return call0 (args[1]);
+    case 3:
+      return call1 (args[1], args[2]);
+    default:
+      return call2 (args[1], args[2], args[3]);
+    }
 }
 
 /* Subroutine for safe_run_hooks: handle an error by clearing out the function
@@ -1878,11 +1886,27 @@ safe_run_hooks_error (Lisp_Object error, ptrdiff_t nargs, Lisp_Object *args)
 static Lisp_Object
 safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Object *args)
 {
-  eassert (nargs == 2);
+  eassert (nargs >= 2 && nargs <= 4);
   /* Yes, run_hook_with_args works with args in the other order.  */
-  internal_condition_case_n (safe_run_hooks_1,
-			     2, ((Lisp_Object []) {args[1], args[0]}),
-			     Qt, safe_run_hooks_error);
+  switch (nargs)
+    {
+    case 2:
+      internal_condition_case_n (safe_run_hooks_1,
+				 2, ((Lisp_Object []) {args[1], args[0]}),
+				 Qt, safe_run_hooks_error);
+      break;
+    case 3:
+      internal_condition_case_n (safe_run_hooks_1,
+				 3, ((Lisp_Object []) {args[1], args[0], args[2]}),
+				 Qt, safe_run_hooks_error);
+      break;
+    default:
+      internal_condition_case_n (safe_run_hooks_1,
+				 4, ((Lisp_Object [])
+				     {args[1], args[0], args[2], args[3]}),
+				 Qt, safe_run_hooks_error);
+      break;
+    }
   return Qnil;
 }
 


> TIA,

> Michael.

-- 
Alan Mackenzie (Nuremberg, Germany).





  parent reply	other threads:[~2022-08-14 13:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-13 16:17 bug#57179: 29.0.50: 'wrong-number-of-arguments' for function of two arguments called from 'window-scroll-functions' Andrea Greselin
2022-08-13 17:30 ` Eli Zaretskii
2022-08-13 20:50   ` Michael Heerdegen
2022-08-14  0:19     ` Michael Heerdegen
2022-08-14  7:18       ` Eli Zaretskii
2022-08-14 13:22       ` Alan Mackenzie [this message]
2022-08-14 23:00         ` Michael Heerdegen
2022-08-15  9:42         ` Andrea Greselin
2022-08-15 12:24     ` Alan Mackenzie
2022-08-13 23:07   ` Andrea Greselin

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

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

  git send-email \
    --in-reply-to=Yvj3HAWLcnhTZVg3@ACM \
    --to=acm@muc.de \
    --cc=57179@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=greselin.andrea@gmail.com \
    --cc=michael_heerdegen@web.de \
    /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 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.