all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 6690@debbugs.gnu.org
Subject: bug#6690: 24.0.50; tmm-get-keymap is broken
Date: Mon, 02 Aug 2010 01:43:41 +0200	[thread overview]
Message-ID: <jwveieh7vgi.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <B32389C2C855465A94C6F051108EBF11@us.oracle.com> (Drew Adams's message of "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))))))
 
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





  reply	other threads:[~2010-08-01 23:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21 15:12 bug#6690: 24.0.50; tmm-get-keymap is broken Drew Adams
2010-08-01 23:43 ` Stefan Monnier [this message]
2014-02-03 23:45   ` Lars Ingebrigtsen
2014-02-04  3:00     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwveieh7vgi.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=6690@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.