[Top][All Lists]

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

Re: Reporting when keymapping stomped... best approach

From: Grant Rettke
Subject: Re: Reporting when keymapping stomped... best approach
Date: Tue, 10 Jun 2014 18:56:41 -0500

Thanks so much.

I'll check also if there is something good for a "local-set-key" check.
Grant Rettke | AAAS, ACM, ASA, FSF, IEEE, SIAM, Sigma Xi
address@hidden |
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

On Tue, Jun 10, 2014 at 2:24 PM, Stefan Monnier
<address@hidden> wrote:
>> (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)))))
> This doesn't check whether the key was already bound.
> You'll probably prefer something like
>    (defadvice global-set-key (before check-keymapping activate)
>      (let* ((key (ad-get-arg 0))
>             (command (ad-get-arg 1))
>             (old (lookup-key global-map key)))
>        (when old
>          (message "Replacing %S with %S in global-map"
>                   old command))))
> and you'll probably also want to advise `define-key' similarly.
>         Stefan

reply via email to

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