help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: global-set-key, error: Invalid modifier in string


From: Emilio Lopes
Subject: Re: global-set-key, error: Invalid modifier in string
Date: Fri, 17 Aug 2007 20:16:32 +0200
User-agent: Emacs Gnus

John  writes:

> On Aug 17, 6:13 am, bojohan+n...@dd.chalmers.se (Johan Bockgård)
> wrote:
>> Strings can't contain non-ASCII control characters. Use (kbd "C-.") or
>> [?\C-.] etc instead.

> I'm not familiar with the differences between ascii and non-ascii ctrl
> characters, but using kbd fixed the problem. :)

I have this macro at the top of my ~/.emacs so that I don't have to
think about this mess anymore:

    (defmacro global-defkey (key def)
      "*Bind KEY globally to DEF.
    KEY should be a string constant in the format used for
    saving keyboard macros (cf. `insert-kbd-macro')."
      `(global-set-key (kbd ,key) ,def))

Use it as in:

    (global-defkey "C-M-<backspace>" 'backward-kill-sexp)

-- 
Emílio C. Lopes
Munich, Germany


reply via email to

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