[Top][All Lists]

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

Re: Rebinding a key in a local variable

From: Eli Zaretskii
Subject: Re: Rebinding a key in a local variable
Date: 15 Feb 2004 08:02:27 +0200

> From: "Travis Spencer" <address@hidden>
> Newsgroups:
> Date: Sat, 14 Feb 2004 12:25:13 -0800
> I am trying to rebind the tab key in a local variable, but I can't figure
> out the syntax.

I think you need to use `eval', since global-set-key is a function,
not a variable.

> # Local Variables:
> # tab-stop-list: (0 4 40)
> # global-set-key: [tab] tab-to-tab-stop
> # End:
> This gives me the error message:
> File local-variables error: (error "Local variables entry is terminated
> incorrectly")

I think this is because global-set-key is not a variable.  Try this:

# eval: (global-set-key [tab] 'tab-to-tab-stop)

Btw, it's not a very good idea to use global-set-key here, since that
changes the binding of TAB in _all_ buffers and all modes, globally.
I'd use local-set-key, which at least limits that to the mode of the
buffer where you visit the file with these local variables.

If you _really_ want to rebind TAB globally, the place to do that is
in your ~/.emacs init file.

reply via email to

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