unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51527: 29.0.50; (wrong-type-argument symbolp 1) lookup-key((keymap) [menu-bar buffer 1])
@ 2021-10-31  7:22 Dieter Deyke
  2021-10-31 13:22 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Dieter Deyke @ 2021-10-31  7:22 UTC (permalink / raw)
  To: 51527


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))
  #f(compiled-function (char defn) #<bytecode -0x109d1dd74c334677>)(1 ("Most recently used (1)" keymap "Most recently used (1)" ("*Messages*" "*% *Messages*" . msb--select-buffer)))
  map-keymap(#f(compiled-function (char defn) #<bytecode -0x109d1dd74c334677>) (keymap "Select Buffer" (1 "Most recently used (1)" keymap "Most recently used (1)" ("*Messages*" "*% *Messages*" . msb--select-buffer)) (separator "--") (2 "Other non-file buffers (2)" keymap "Other non-file buffers (2)" ("*Messages*" "*% *Messages*" . msb--select-buffer) ("*scratch*" "   *scratch*" . msb--select-buffer)) (separator "--") (toggle "*Files by directory*" . msb--toggle-menu-type)))
  substitute-key-definition(beginning-of-line allout-beginning-of-line (keymap) (keymap "Select Buffer" (1 "Most recently used (1)" keymap "Most recently used (1)" ("*Messages*" "*% *Messages*" . msb--select-buffer)) (separator "--") (2 "Other non-file buffers (2)" keymap "Other non-file buffers (2)" ("*Messages*" "*% *Messages*" . msb--select-buffer) ("*scratch*" "   *scratch*" . msb--select-buffer)) (separator "--") (toggle "*Files by directory*" . msb--toggle-menu-type)) [menu-bar buffer])
  substitute-key-definition-key(("Buffers" keymap "Select Buffer" (1 "Most recently used (1)" keymap "Most recently used (1)" ("*Messages*" "*% *Messages*" . msb--select-buffer)) (separator "--") (2 "Other non-file buffers (2)" keymap "Other non-file buffers (2)" ("*Messages*" "*% *Messages*" . msb--select-buffer) ("*scratch*" "   *scratch*" . msb--select-buffer)) (separator "--") (toggle "*Files by directory*" . msb--toggle-menu-type)) beginning-of-line allout-beginning-of-line [menu-bar buffer] (keymap))
  #f(compiled-function (char defn) #<bytecode -0x109d1de21c365477>)(buffer ("Buffers" keymap "Select Buffer" (1 "Most recently used (1)" keymap "Most recently used (1)" ("*Messages*" "*% *Messages*" . msb--select-buffer)) (separator "--") (2 "Other non-file buffers (2)" keymap "Other non-file buffers (2)" ("*Messages*" "*% *Messages*" . msb--select-buffer) ("*scratch*" "   *scratch*" . msb--select-buffer)) (separator "--") (toggle "*Files by directory*" . msb--toggle-menu-type)))
  map-keymap(#f(compiled-function (char defn) #<bytecode -0x109d1de21c365477>) (keymap ... ... ... ... ... ... ... "menu-bar"))
  substitute-key-definition(beginning-of-line allout-beginning-of-line (keymap) (keymap ... ... ... ... ... ... ... "menu-bar") [menu-bar])
  substitute-key-definition-key((keymap ... ... ... ... ... ... ... "menu-bar") beginning-of-line allout-beginning-of-line [menu-bar] (keymap))
  #f(compiled-function (char defn) #<bytecode -0x109d1de6574bd777>)(menu-bar (keymap ... ... ... ... ... ... ... "menu-bar"))
  map-keymap(#f(compiled-function (char defn) #<bytecode -0x109d1de6574bd777>) (keymap #^[nil nil keymap 
#^^[3 0 set-mark-command move-beginning-of-line backward-char mode-specific-command-prefix delete-char move-end-of-line forward-char keyboard-quit help-command indent-for-tab-command electric-newline-and-maybe-indent kill-line recenter-top-bottom ...] #^^[1 0 #^^[2 0 
#^^[3 0 set-mark-command move-beginning-of-line backward-char mode-specific-command-prefix delete-char move-end-of-line forward-char keyboard-quit help-command indent-for-tab-command electric-newline-and-maybe-indent kill-line recenter-top-bottom ...] self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command ...] self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command ...] self-insert-command self-insert-command self-insert-comman
 d self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command ...] ... ... ... ... ... ... ... ... ... ... ... ... ...))
  substitute-key-definition(beginning-of-line allout-beginning-of-line (keymap) (keymap #^[nil nil keymap 
#^^[3 0 set-mark-command move-beginning-of-line backward-char mode-specific-command-prefix delete-char move-end-of-line forward-char keyboard-quit help-command indent-for-tab-command electric-newline-and-maybe-indent kill-line recenter-top-bottom ...] #^^[1 0 #^^[2 0 
#^^[3 0 set-mark-command move-beginning-of-line backward-char mode-specific-command-prefix delete-char move-end-of-line forward-char keyboard-quit help-command indent-for-tab-command electric-newline-and-maybe-indent kill-line recenter-top-bottom ...] self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command ...] self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command ...] self-insert-command self-insert-command self-insert-comman
 d self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command self-insert-command ...] ... ... ... ... ... ... ... ... ... ... ... ... ...))
  allout-compose-and-institute-keymap()
  byte-code("\300 \210\301\302\303\304\305DD\306\307\310\311\312\313\300&\11\210\314\315\316\317\307\320%\210\301\321\303\304\322DD\323\324\325\307\315\311\312\313\300&\13\210\301\326\303..." [allout-compose-and-institute-keymap custom-declare-variable allout-command-prefix funcall function #f(compiled-function () #<bytecode 0x1f4000162f154>) "Key sequence to be used as prefix for outline mode..." :type string :group allout-keybindings :set define-widget allout-keybindings-binding lazy "Structure of allout keybindings customization item..." (repeat (list (string :tag "Key" :value "[(meta control shift ?f)]") (function :tag "Function name" :value allout-forward-current-level))) allout-prefixed-keybindings #f(compiled-function () #<bytecode 0x1f400016fe914>) "Allout-mode key bindings that ar
 e prefixed with `a..." :version "24.1" allout-unprefixed-keybindings #f(compiled-function () #<bytecode 0x1f400016fe914>) "Allout-mode functions bound to keys without any ad..."] 12)
  require(allout)
  eval-buffer(#<buffer  *load*-108979> nil "/home/deyke/.emacs.d/elisp/emacsrc.el" nil t)  ; Reading at buffer position 15036
  load-with-code-conversion("/home/deyke/.emacs.d/elisp/emacsrc.el" "/home/deyke/.emacs.d/elisp/emacsrc.el" nil nil)
  load("emacsrc")
  load-library("emacsrc")
  eval-buffer(#<buffer  *load*> nil "/home/deyke/.emacs.d/init.el" nil t)  ; Reading at buffer position 446
  load-with-code-conversion("/home/deyke/.emacs.d/init.el" "/home/deyke/.emacs.d/init.el" t t)
  load("/home/deyke/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1ab71f8309045ed0>) #f(compiled-function () #<bytecode -0x1f3c686ddc0ca9b5>) t)
  command-line()
  normal-top-level()

It fails even after deleting all .elc files and deleting .session.

I do not know how to narrow this done.


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)
 of 2021-10-22 built on deyke2
Repository revision: 357d273d2e312fca7b187dca45585cbdbf4c6469
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --prefix=/usr/local/emacs'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Info

Minor modes in effect:
  global-flycheck-mode: t
  delete-selection-mode: t
  cua-mode: t
  msb-mode: t
  icomplete-mode: t
  which-function-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/deyke/.emacs.d/elpa/transient-20211029.1405/transient hides /usr/local/emacs/share/emacs/29.0.50/lisp/transient

Features:
(shadow emacsbug url-http url-gw url-auth gnus-gravatar gnus-picon sort
gnus-cite smiley w3m-form w3m timezone w3m-hist w3m-fb bookmark-w3m
w3m-ems w3m-favicon w3m-image tab-line w3m-proc w3m-util mm-archive
mail-extr gnus-bcklg gnus-ml disp-table nndraft nnmh gnus-agent
gnus-srvr gnus-score score-mode nnvirtual nnfolder qp gnus-cache gnutls
network-stream nsm gravatar dns url-cache spam-stat smtpmail sendmail
nnrss nnml gnus-topic gnus-msg gnus-async nntp flycheck dash session
infodoc-theme appt view mule-util solar cal-dst holidays hol-loaddefs
vc-fossil org-duration diary-lib diary-loaddefs cal-iso vc-git diff-mode
vc-dispatcher org-element avl-tree generator ol-eww eww xdg url-queue
mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search
eieio-opt speedbar ezimage dframe ol-docview doc-view jka-compr
image-mode exif ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi cl-extra
help-mode face-remap generic-x org-contacts org-capture org-agenda
org-refile gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum
shr kinsoku svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range message rmc puny rfc822 mml mml-sec epa derived epg rfc6068
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader gnus-win gnus nnheader wid-edit gnus-util rmail
rmail-loaddefs rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
text-property-search org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete pcomplete comint
ansi-color org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex ol rx org-keys
oc org-compat advice org-macs org-loaddefs format-spec find-func
cal-menu calendar cal-loaddefs cl rcirc parse-time iso8601 time-date
ring netrc emms-volume easy-mmode emms-volume-sndioctl
emms-volume-mixerctl emms-volume-pulse emms-volume-amixer
emms-metaplaylist-mode emms-playlist-mode emms-player-vlc
emms-player-mpv emms-playing-time emms-info emms-later-do
emms-player-mplayer emms-player-simple emms-source-playlist
emms-source-file thingatpt locate emms-setup emms emms-compat bongo
lastfm-submit pcase volume allout esh-mode esh-cmd esh-ext esh-opt
esh-proc esh-io esh-arg esh-module esh-groups esh-util server delsel
cua-base msb icomplete mic-paren german-holidays dired dired-loaddefs
which-func imenu time w3m-load info package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json map url-vars seq
gv subr-x byte-opt bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 425885 41475)
 (symbols 48 62982 19)
 (strings 32 177549 14837)
 (string-bytes 1 6186011)
 (vectors 16 76257)
 (vector-slots 8 1793185 201963)
 (floats 8 3527 50415)
 (intervals 56 1268 124)
 (buffers 992 29))

-- 
Dieter Deyke
mailto:dieter.deyke@gmail.com
Get my Gnupg key:
gpg --keyserver keys.gnupg.net --recv-keys B116EA20





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

* bug#51527: 29.0.50; (wrong-type-argument symbolp 1) lookup-key((keymap) [menu-bar buffer 1])
  2021-10-31  7:22 bug#51527: 29.0.50; (wrong-type-argument symbolp 1) lookup-key((keymap) [menu-bar buffer 1]) Dieter Deyke
@ 2021-10-31 13:22 ` Eli Zaretskii
  2021-10-31 13:56   ` Dieter Deyke
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2021-10-31 13:22 UTC (permalink / raw)
  To: Dieter Deyke; +Cc: 51527

> From: Dieter Deyke <dieter.deyke@gmail.com>
> 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.  */





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

* bug#51527: 29.0.50; (wrong-type-argument symbolp 1) lookup-key((keymap) [menu-bar buffer 1])
  2021-10-31 13:22 ` Eli Zaretskii
@ 2021-10-31 13:56   ` Dieter Deyke
  2021-10-31 14:21     ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Dieter Deyke @ 2021-10-31 13:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 51527

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Dieter Deyke <dieter.deyke@gmail.com>
>> 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.  */
>

Yes, the patch fixed it.

Thank you, Eli.
-- 
Dieter Deyke
mailto:dieter.deyke@gmail.com
Get my Gnupg key:
gpg --keyserver keys.gnupg.net --recv-keys B116EA20





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

* bug#51527: 29.0.50; (wrong-type-argument symbolp 1) lookup-key((keymap) [menu-bar buffer 1])
  2021-10-31 13:56   ` Dieter Deyke
@ 2021-10-31 14:21     ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-10-31 14:21 UTC (permalink / raw)
  To: Dieter Deyke; +Cc: 51527-done

> From: Dieter Deyke <dieter.deyke@gmail.com>
> Cc: 51527@debbugs.gnu.org
> Date: Sun, 31 Oct 2021 14:56:54 +0100
> 
> > 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.  */
> >
> 
> Yes, the patch fixed it.

Thanks, installed.  A  variant of the fix was also installed on the
release branch.

Closing.





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

end of thread, other threads:[~2021-10-31 14:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-31  7:22 bug#51527: 29.0.50; (wrong-type-argument symbolp 1) lookup-key((keymap) [menu-bar buffer 1]) Dieter Deyke
2021-10-31 13:22 ` Eli Zaretskii
2021-10-31 13:56   ` Dieter Deyke
2021-10-31 14:21     ` Eli Zaretskii

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