[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reporting when keymapping stomped... best approach

From: Kevin Rodgers
Subject: Re: Reporting when keymapping stomped... best approach
Date: Thu, 12 Jun 2014 00:50:20 -0600
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv: Gecko/20120306 Thunderbird/3.1.20

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: "

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 your original attempt is that you try to concat `command' (which is a symbol in most cases) to a string. His solution works because he uses the %S format specifier.

I don't know why setting debug-on-error didn't work as expected.

Kevin Rodgers
Denver, Colorado, USA

reply via email to

[Prev in Thread] Current Thread [Next in Thread]