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: Reporting when keymapping stomped... best approach Date: Tue, 10 Jun 2014 14:15:29 -0500 Message-ID: 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 1402427763 20205 80.91.229.3 (10 Jun 2014 19:16:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Jun 2014 19:16:03 +0000 (UTC) To: Emacs Help Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 10 21:15:58 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 1WuRWX-0002qK-UC for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Jun 2014 21:15:58 +0200 Original-Received: from localhost ([::1]:41887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuRWX-00033j-Eu for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Jun 2014 15:15:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuRW9-00032o-Bx for help-gnu-emacs@gnu.org; Tue, 10 Jun 2014 15:15:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WuRW6-00062s-1k for help-gnu-emacs@gnu.org; Tue, 10 Jun 2014 15:15:33 -0400 Original-Received: from mail-oa0-x22e.google.com ([2607:f8b0:4003:c02::22e]:50457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WuRW5-00062o-Oy for help-gnu-emacs@gnu.org; Tue, 10 Jun 2014 15:15:29 -0400 Original-Received: by mail-oa0-f46.google.com with SMTP id m1so374763oag.5 for ; Tue, 10 Jun 2014 12:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=O5KxGZ0gvwZ5AkM523yFMLI/c6bD6Y1JecyuCwqiQXo=; b=HW0MYYoCuc5je7xK2tyQN9X8FDWCyNxXP/S0QIms2ZmMhF7iUPIMNDGyaMofY8PIlH 4M1QhdzG3CsyTiKAIEEZznMV9Kw+SBvZ6ciMhVFbNm9bWJcIvKpKRS+A3Va+ev7J3nbU YykMJ/hXCThLZBti2XswVC+q1k2ArRotO/6qbCQLept9WHyR+drMXVBnqRNxwXfuabPQ HhMphNtHxXJBCG9/kp1PncVdBtcOcxf8x+WGrg1+4XwJyiZSYFNZln9E/s/VO4zbjZ2b smXJkel1rrMbdAhnDUzhMQlHWou8d0P6FDESiQnoHSy2YpfwecyCdru3SMvV8FNFSiMW bzHg== X-Received: by 10.60.34.40 with SMTP id w8mr17989193oei.60.1402427729250; Tue, 10 Jun 2014 12:15:29 -0700 (PDT) Original-Received: by 10.183.4.70 with HTTP; Tue, 10 Jun 2014 12:15:29 -0700 (PDT) X-Google-Sender-Auth: PLOdRSxhNhzXbY-Pta2udgCODo4 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:98126 Archived-At: Good afternoon, 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? Kind regards, 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