unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Rebinding a key in a local variable
@ 2004-02-14 20:25 Travis Spencer
  2004-02-15  6:02 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Travis Spencer @ 2004-02-14 20:25 UTC (permalink / raw)


Hello,

I am trying to rebind the tab key in a local variable, but I can't figure
out the syntax.  I would like the tab key to call the tab-to-tab-stop
function, so I don't have to use M-i.  Here is what I have at the moment:

# 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")

When I remove the global-set-key variable the error message isn't given.

Any help would be *much* appreciated.

-- 

Regards,

Travis Spencer
Portland, OR. USA

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Rebinding a key in a local variable
  2004-02-14 20:25 Rebinding a key in a local variable Travis Spencer
@ 2004-02-15  6:02 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2004-02-15  6:02 UTC (permalink / raw)


> From: "Travis Spencer" <travislspencer@hotmail.com>
> Newsgroups: gnu.emacs.help
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-15  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-14 20:25 Rebinding a key in a local variable Travis Spencer
2004-02-15  6:02 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).