GNU bug report logs - #6690
24.0.50; tmm-get-keymap is broken

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Wed, 21 Jul 2010 15:25:02 UTC

Severity: normal

Tags: moreinfo

Found in version 24.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6690 in the body.
You can then email your comments to 6690 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6690; Package emacs. (Wed, 21 Jul 2010 15:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 21 Jul 2010 15:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.0.50; tmm-get-keymap is broken
Date: Wed, 21 Jul 2010 08:12:02 -0700
emacs -Q
 
In several of the `cond' branches the variable `str' is not defined, so
it is nil from the `let' default initialization.
 
Then this code raises an error "Wrong type argument: stringp, nil",
since `str' is not a string:
 
(unless (eq km 'ignore)
          (let ((binding (where-is-internal km nil t)))
            (when binding
              (setq binding (key-description binding))
              ;; Try to align the keybindings.
              (let ((colwidth (min 30 (- (/ (window-width) 2) 10))))
 
;; STR is nil - so cannot use `string-width' or `concat'.
 
                (setq str
                      (concat str
                              (make-string (max 2 (- colwidth
                                                     (string-width str)
                                                     (string-width binding)))
                                           ?\s)
                              binding))))))
 

In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2010-07-19 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4) --no-opt --cflags -Ic:/xpm/include'
 





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6690; Package emacs. (Sun, 01 Aug 2010 23:44:01 GMT) Full text and rfc822 format available.

Message #8 received at 6690 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 6690 <at> debbugs.gnu.org
Subject: Re: bug#6690: 24.0.50; tmm-get-keymap is broken
Date: Mon, 02 Aug 2010 01:43:41 +0200
> emacs -Q
> In several of the `cond' branches the variable `str' is not defined, so
> it is nil from the `let' default initialization.
 
> Then this code raises an error "Wrong type argument: stringp, nil",
> since `str' is not a string:
 
> (unless (eq km 'ignore)
>           (let ((binding (where-is-internal km nil t)))
>             (when binding
>               (setq binding (key-description binding))
>               ;; Try to align the keybindings.
>               (let ((colwidth (min 30 (- (/ (window-width) 2) 10))))
 
> ;; STR is nil - so cannot use `string-width' or `concat'.
 
>                 (setq str
>                       (concat str
>                               (make-string (max 2 (- colwidth
>                                                      (string-width str)
>                                                      (string-width binding)))
>                                            ?\s)
>                               binding))))))
 
Thanks for the report.  Indeed, the code is brittle in this regard.
I could easily work around the problem by checking `str' before taking
its width (concat should work just fine with nil), but before I do that,
I'd like to make sure the result (which would basically treat a nil as
equivalent to "") is right, so could you give some example where the
problem gets triggered (in all "reasonable" cases I can think of, str
ends up being non-nil since otherwise it means the menu entry would
have a valid command and a valid shortcut, but no name).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6690; Package emacs. (Mon, 03 Feb 2014 23:47:01 GMT) Full text and rfc822 format available.

Message #11 received at 6690 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 6690 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#6690: 24.0.50; tmm-get-keymap is broken
Date: Mon, 03 Feb 2014 15:45:11 -0800
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> I'd like to make sure the result (which would basically treat a nil as
> equivalent to "") is right, so could you give some example where the
> problem gets triggered (in all "reasonable" cases I can think of, str
> ends up being non-nil since otherwise it means the menu entry would
> have a valid command and a valid shortcut, but no name).

More information was requested three years ago, but no further progress
has been made.  Is this bug still present in Emacs 24.3?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6690; Package emacs. (Tue, 04 Feb 2014 03:01:01 GMT) Full text and rfc822 format available.

Message #14 received at 6690 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Stefan Monnier
 <monnier <at> iro.umontreal.ca>
Cc: 6690 <at> debbugs.gnu.org
Subject: RE: bug#6690: 24.0.50; tmm-get-keymap is broken
Date: Mon, 3 Feb 2014 19:00:34 -0800 (PST)
> More information was requested three years ago, but no further
> progress has been made.  Is this bug still present in
> Emacs 24.3?

More precisely, Stefan said:

> Indeed, the code is brittle in this regard.
> I could easily work around the problem by checking `str'
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> before taking its width (concat should work just fine with nil),
> but before I do that, I'd like to make sure the result (which
> would basically treat a nil as equivalent to "") is right...

I have no way to determine that more that he does (and did).

Sorry, it's been 3 years and I don't have anything more to offer
about this.  If you don't want to make the code less brittle and
fix the case where the value is nil, so be it.

Personally, I don't use tmm anyway.  It's possible that I
happened to notice this problem when looking at the code.
Or perhaps I ran into it while experimenting with the code.
I really don't know.




bug closed, send any further explanations to 6690 <at> debbugs.gnu.org and "Drew Adams" <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 25 Dec 2015 23:06:04 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 23 Jan 2016 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 148 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.