Subject: Re: bug#7788: 23.2.91; tmm-menubar command broken: Wrong type argument: stringp, nil

From: Stefan Monnier <[email-masked]>
Date: Mon, 10 Jan 2011 21:31:14 -0500

close 7721
thanks

> Sometimes tmm-menubar command doesn't work because it stops with error
[...]
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   string-width(nil)
>   (- colwidth (string-width str) (string-width binding))

Thanks a lot for the backtrace.  I think it is a symptom of an invalid
entry in one of the keymaps, but indeed it's also a bug in tmm.el.
I've installed the patch below into the emacs-23 branch which should
fix it.

        Stefan

=== modified file 'lisp/tmm.el'
--- lisp/tmm.el	2011-01-02 23:50:46 +0000
+++ lisp/tmm.el	2011-01-11 02:27:23 +0000
@@ -497,7 +495,7 @@
 	       (if (or in-x-menu (stringp (car-safe elt)))
 		   (setq str event event nil km elt)
 		 (setq str event event nil km (cons 'keymap elt)))))
-        (unless (eq km 'ignore)
+        (unless (or (eq km 'ignore) (null str))
           (let ((binding (where-is-internal km nil t)))
             (when binding
               (setq binding (key-description binding))