From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#6690: 24.0.50; tmm-get-keymap is broken Date: Mon, 02 Aug 2010 01:43:41 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1280707693 16008 80.91.229.12 (2 Aug 2010 00:08:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 Aug 2010 00:08:13 +0000 (UTC) Cc: 6690@debbugs.gnu.org To: "Drew Adams" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 02 02:08:12 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OfiZf-0003Uq-9k for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Aug 2010 02:08:11 +0200 Original-Received: from localhost ([127.0.0.1]:53618 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OfiZe-0004BL-L1 for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Aug 2010 20:08:10 -0400 Original-Received: from [140.186.70.92] (port=34686 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OfiZU-0004AA-54 for bug-gnu-emacs@gnu.org; Sun, 01 Aug 2010 20:08:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OfiZS-0006fv-Sa for bug-gnu-emacs@gnu.org; Sun, 01 Aug 2010 20:07:59 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36503) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfiZS-0006fo-QC for bug-gnu-emacs@gnu.org; Sun, 01 Aug 2010 20:07:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OfiCH-0006K4-Lb; Sun, 01 Aug 2010 19:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Aug 2010 23:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6690 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6690-submit@debbugs.gnu.org id=B6690.128070620324293 (code B ref 6690); Sun, 01 Aug 2010 23:44:01 +0000 Original-Received: (at 6690) by debbugs.gnu.org; 1 Aug 2010 23:43:23 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfiBf-0006Jm-8L for submit@debbugs.gnu.org; Sun, 01 Aug 2010 19:43:23 -0400 Original-Received: from impaqm3.telefonica.net ([213.4.138.3]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OfiBd-0006Jh-Cc for 6690@debbugs.gnu.org; Sun, 01 Aug 2010 19:43:22 -0400 Original-Received: from IMPmailhost6.adm.correo ([10.20.102.127]) by IMPaqm3.telefonica.net with bizsmtp id p9yG1e00H2kvMAa3PBjifL; Mon, 02 Aug 2010 01:43:42 +0200 Original-Received: from ceviche.home ([83.61.38.247]) by IMPmailhost6.adm.correo with BIZ IMP id pBjh1e0075KwfZf1mBjh57; Mon, 02 Aug 2010 01:43:42 +0200 X-Brightmail-Tracker: AAAAAA== X-TE-authinfo: authemail="monnier$movistar.es" |auth_email="monnier@movistar.es" X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01" Original-Received: by ceviche.home (Postfix, from userid 20848) id 1E37366125; Mon, 2 Aug 2010 01:43:41 +0200 (CEST) In-Reply-To: (Drew Adams's message of "Wed, 21 Jul 2010 08:12:02 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 01 Aug 2010 19:44:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:39118 Archived-At: > 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