From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#51527: 29.0.50; (wrong-type-argument symbolp 1) lookup-key((keymap) [menu-bar buffer 1]) Date: Sun, 31 Oct 2021 15:22:14 +0200 Message-ID: <834k8xnxbt.fsf@gnu.org> References: <87tugxodyn.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12539"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51527@debbugs.gnu.org To: Dieter Deyke Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 31 14:23:11 2021 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 1mhAnn-00037A-0Z for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Oct 2021 14:23:11 +0100 Original-Received: from localhost ([::1]:60128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhAnl-0002t1-FR for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 Oct 2021 09:23:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhAne-0002sf-Vz for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2021 09:23:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47691) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mhAne-00037j-NL for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2021 09:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mhAne-0008Uz-DP for bug-gnu-emacs@gnu.org; Sun, 31 Oct 2021 09:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Oct 2021 13:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51527 X-GNU-PR-Package: emacs Original-Received: via spool by 51527-submit@debbugs.gnu.org id=B51527.163568655132619 (code B ref 51527); Sun, 31 Oct 2021 13:23:02 +0000 Original-Received: (at 51527) by debbugs.gnu.org; 31 Oct 2021 13:22:31 +0000 Original-Received: from localhost ([127.0.0.1]:59237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhAn9-0008U1-4B for submit@debbugs.gnu.org; Sun, 31 Oct 2021 09:22:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhAn7-0008Tp-7D for 51527@debbugs.gnu.org; Sun, 31 Oct 2021 09:22:29 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:53494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhAn1-00031z-Uv; Sun, 31 Oct 2021 09:22:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=cP+WomvfM7qjYo5s56r/h1B1v+89NabLdiZgypWDFNo=; b=eosZsWLR2kVZ LqPRtHnSEljze49CSO7LyHr7wdZc07YPnUOFcA/0UajAWZOp1hKi3jE1MUwXT3/TOVNGvgMf7YX4o 3d3IHgKZooDmaE85DMxYpV6XqT82APCmmRoLczubc8uIZVmsdJ0k4jzFoXvb1GPcJMJxdp3SQrIxA TUif0zj3H/tOinPIMVUFWockVwjCmwyxUwPxmX0djAzxSYOfaw01DGphzovXPNEXW3c8qlZehTsUd fr1HZSqfWH7KyeK21PvuErFvItYHx2Mcv2ynP//fXVvK9LPbxXMwuyp7b19OkMS5ruK303PTgmO1Z LxQ3Pgj7g9UOue4OaZafxw==; Original-Received: from [87.69.77.57] (port=1121 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhAn1-0007W3-6k; Sun, 31 Oct 2021 09:22:23 -0400 In-Reply-To: <87tugxodyn.fsf@gmail.com> (message from Dieter Deyke on Sun, 31 Oct 2021 08:22:56 +0100) 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:218681 Archived-At: > From: Dieter Deyke > Date: Sun, 31 Oct 2021 08:22:56 +0100 > > > Using emacs -Q (build from git master) works fine. Starting it with my > customizations fails: > > Debugger entered--Lisp error: (wrong-type-argument symbolp 1) > lookup-key((keymap) [menu-bar buffer 1]) > substitute-key-definition-key(("Most recently used (1)" keymap "Most recently used (1)" ("*Messages*" "*% *Messages*" . msb--select-buffer)) beginning-of-line allout-beginning-of-line [menu-bar buffer 1] (keymap)) Thanks. Does the patch below fix this? diff --git a/src/keymap.c b/src/keymap.c index 5ff13ba..4d8944d 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1314,36 +1314,44 @@ DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0, "foo-bar-baz". */ for (int i = 0; i < key_len; i++) { - Lisp_Object key_item = Fsymbol_name (AREF (key, i)); - Lisp_Object new_item; - if (!STRING_MULTIBYTE (key_item)) - new_item = Fdowncase (key_item); + Lisp_Object item = AREF (key, i); + if (!SYMBOLP (item)) + ASET (new_key, i, item); else { - USE_SAFE_ALLOCA; - ptrdiff_t size = SCHARS (key_item), n; - if (INT_MULTIPLY_WRAPV (size, MAX_MULTIBYTE_LENGTH, &n)) - n = PTRDIFF_MAX; - unsigned char *dst = SAFE_ALLOCA (n); - unsigned char *p = dst; - ptrdiff_t j_char = 0, j_byte = 0; - - while (j_char < size) + Lisp_Object key_item = Fsymbol_name (item); + Lisp_Object new_item; + if (!STRING_MULTIBYTE (key_item)) + new_item = Fdowncase (key_item); + else { - int ch = fetch_string_char_advance (key_item, &j_char, &j_byte); - Lisp_Object ch_conv = CHAR_TABLE_REF (tables[tbl_num], ch); - if (!NILP (ch_conv)) - CHAR_STRING (XFIXNUM (ch_conv), p); - else - CHAR_STRING (ch, p); - p = dst + j_byte; + USE_SAFE_ALLOCA; + ptrdiff_t size = SCHARS (key_item), n; + if (INT_MULTIPLY_WRAPV (size, MAX_MULTIBYTE_LENGTH, &n)) + n = PTRDIFF_MAX; + unsigned char *dst = SAFE_ALLOCA (n); + unsigned char *p = dst; + ptrdiff_t j_char = 0, j_byte = 0; + + while (j_char < size) + { + int ch = fetch_string_char_advance (key_item, + &j_char, &j_byte); + Lisp_Object ch_conv = CHAR_TABLE_REF (tables[tbl_num], + ch); + if (!NILP (ch_conv)) + CHAR_STRING (XFIXNUM (ch_conv), p); + else + CHAR_STRING (ch, p); + p = dst + j_byte; + } + new_item = make_multibyte_string ((char *) dst, + SCHARS (key_item), + SBYTES (key_item)); + SAFE_FREE (); } - new_item = make_multibyte_string ((char *) dst, - SCHARS (key_item), - SBYTES (key_item)); - SAFE_FREE (); + ASET (new_key, i, Fintern (new_item, Qnil)); } - ASET (new_key, i, Fintern (new_item, Qnil)); } /* Check for match. */ @@ -1356,6 +1364,9 @@ DEFUN ("lookup-key", Flookup_key, Slookup_key, 2, 3, 0, "foo-bar-baz". */ for (int i = 0; i < key_len; i++) { + if (!SYMBOLP (AREF (new_key, i))) + continue; + Lisp_Object lc_key = Fsymbol_name (AREF (new_key, i)); /* If there are no spaces in this symbol, just skip it. */