From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <83y1vskq5e.fsf@gnu.org> <87sflzook8.fsf@web.de> <87o7wnoewc.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20237"; mail-complaints-to="usenet@ciao.gmane.io" Cc: acm@muc.de, Eli Zaretskii , 57179@debbugs.gnu.org, Andrea Greselin To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 14 15:23:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oNDaB-0004zh-3S for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 15:23:11 +0200 Original-Received: from localhost ([::1]:45308 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oNDa9-0000Eb-J8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 14 Aug 2022 09:23:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oNDa2-0000ED-Qd for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 09:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46473) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oNDa2-0002yy-Hx for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 09:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oNDa2-0004Ay-DQ for bug-gnu-emacs@gnu.org; Sun, 14 Aug 2022 09:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Aug 2022 13:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57179 X-GNU-PR-Package: emacs Original-Received: via spool by 57179-submit@debbugs.gnu.org id=B57179.166048336616016 (code B ref 57179); Sun, 14 Aug 2022 13:23:02 +0000 Original-Received: (at 57179) by debbugs.gnu.org; 14 Aug 2022 13:22:46 +0000 Original-Received: from localhost ([127.0.0.1]:36219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oNDZm-0004AE-9a for submit@debbugs.gnu.org; Sun, 14 Aug 2022 09:22:46 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:55710 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1oNDZj-00049p-VC for 57179@debbugs.gnu.org; Sun, 14 Aug 2022 09:22:44 -0400 Original-Received: (qmail 13078 invoked by uid 3782); 14 Aug 2022 13:22:38 -0000 Original-Received: from acm.muc.de (p4fe15ca3.dip0.t-ipconnect.de [79.225.92.163]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 14 Aug 2022 15:22:37 +0200 Original-Received: (qmail 20239 invoked by uid 1000); 14 Aug 2022 13:22:36 -0000 Content-Disposition: inline In-Reply-To: <87o7wnoewc.fsf@web.de> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:239649 Archived-At: Hello, Michael and Andrea. On Sun, Aug 14, 2022 at 02:19:31 +0200, Michael Heerdegen wrote: > Michael Heerdegen 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 2022-08-11) > like this: > From ffb7c3d558b599bcc84f1bf4fb4388569892d927 Mon Sep 17 00:00:00 2001 > From: Michael Heerdegen > 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).