From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Grant Rettke Newsgroups: gmane.emacs.help Subject: Re: Reporting when keymapping stomped... best approach Date: Thu, 12 Jun 2014 12:18:35 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1402593538 21779 80.91.229.3 (12 Jun 2014 17:18:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 12 Jun 2014 17:18:58 +0000 (UTC) Cc: Emacs Help To: Kevin Rodgers Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 12 19:18:51 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wv8eI-0003lG-8E for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Jun 2014 19:18:50 +0200 Original-Received: from localhost ([::1]:54971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv8eH-00071J-Rw for geh-help-gnu-emacs@m.gmane.org; Thu, 12 Jun 2014 13:18:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv8e5-00071B-GS for help-gnu-emacs@gnu.org; Thu, 12 Jun 2014 13:18:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wv8e4-000608-El for help-gnu-emacs@gnu.org; Thu, 12 Jun 2014 13:18:37 -0400 Original-Received: from mail-oa0-x22e.google.com ([2607:f8b0:4003:c02::22e]:45111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wv8e4-0005z9-90 for help-gnu-emacs@gnu.org; Thu, 12 Jun 2014 13:18:36 -0400 Original-Received: by mail-oa0-f46.google.com with SMTP id m1so1676606oag.33 for ; Thu, 12 Jun 2014 10:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=PLzp/Ffp52IZbFBOIie0fC8sdEzd+Bs0dRhpTzaHFEI=; b=UYnFkNMjMANULIJuLVD08Jy3TiRu/QRD9DQ6UTMyGejBb2+Yck7qDiswA9F5cRJ7h0 qPAb+u7rsxzWwpUzdLuupBcuARNVPhr7/sTxGmFMbZbZN7WSim2XSZqvkod0WfR0mZyB D0+NYFekazXL5JE5OdsoHdIB8PEOnce7299SMx1pD2gx/8mOIJSpgH4uJsljIJz7XXuq o7IejPp3wHQrQwtRk+50Z0rqZx6i6amsosM8MhXgp123w6beaFIOA4lTay2gSxe6mr0w 0oas1uSMYL/qMfTzhZ1txobLwy4Uzsj/H61mteE/sncM/Nbxoq1G9BtqCPcnwZgGtOii EXAA== X-Received: by 10.182.20.16 with SMTP id j16mr45126123obe.51.1402593515062; Thu, 12 Jun 2014 10:18:35 -0700 (PDT) Original-Received: by 10.183.4.70 with HTTP; Thu, 12 Jun 2014 10:18:35 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: nlXvya2QE754C51_wQ4TNz0eATI X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::22e X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:98182 Archived-At: Understood, thanks for explaining. Grant Rettke | AAAS, ACM, ASA, FSF, IEEE, SIAM, Sigma Xi gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/ =E2=80=9CWisdom begins in wonder.=E2=80=9D --Socrates ((=CE=BB (x) (x x)) (=CE=BB (x) (x x))) =E2=80=9CLife has become immeasurably better since I have been forced to st= op taking it seriously.=E2=80=9D --Thompson On Thu, Jun 12, 2014 at 1:50 AM, Kevin Rodgers wrote: > On 6/10/14 1:15 PM, Grant Rettke wrote: >> >> My goal is to issue a warning whenever a keymapping is stomped on my >> myself or anyone else. For example, say I replace self-insert for 1 >> like this: >> >> (global-set-key (kbd "1") 'scheme-mode) >> >> Then I want to look up in the global keymap space whether the desired >> key already exists, and if it does, then I want to warn the user what >> function was rebound to that keymap. Eg: >> >> (defadvice global-set-key (before check-keymapping activate) >> (let ((key (ad-get-arg 0)) >> (command (ad-get-arg 1))) >> (when command >> (warn (concat "Just stomped on a global keymapping bound to: " >> command))))) >> >> >> The only problem is that this doesn't work, as global-undo-tree starts >> complaining and I'm not sure where to start looking . Setting >> debug-on-error to true doesn't even reveal anything useful. >> >> Where might I start debugging further? > > > Stefan already provided the solution, but FYI I think the problem with yo= ur > original attempt is that you try to concat `command' (which is a symbol i= n > most cases) to a string. His solution works because he uses the %S forma= t > specifier. > > I don't know why setting debug-on-error didn't work as expected. > > -- > Kevin Rodgers > Denver, Colorado, USA > >