* Problem with key binding
@ 2005-01-23 20:55 Mark A. Nicolosi
2005-01-23 22:30 ` David Hansen
0 siblings, 1 reply; 4+ messages in thread
From: Mark A. Nicolosi @ 2005-01-23 20:55 UTC (permalink / raw)
Hi,
I found a function on the Emacs wiki that auto-completes a symbol (using
dabbrev) if the point is middle or end of a line otherwise it indents
that line.
The function works fine when I run it manually, however I can't get it
work when binding it to <TAB>. Here's what I'm using:
(defun my-c-mode-hook ()
;; <SNIP>
(local-set-key (kbd "\t") 'indent-or-complete)
;; <SNIP>
)
(add-hook 'c-mode-hook 'my-c-mode-hook)
I know the my-c-mode-hook function is running, because other stuff in
there is working. This part is really strange: If run local-set-key
press tab and then enter ident-or-complete it works. What the heck?
TIA
--
Mark A. Nicolosi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with key binding
2005-01-23 20:55 Problem with key binding Mark A. Nicolosi
@ 2005-01-23 22:30 ` David Hansen
2005-01-24 0:02 ` August
2005-01-24 0:04 ` Mark A. Nicolosi
0 siblings, 2 replies; 4+ messages in thread
From: David Hansen @ 2005-01-23 22:30 UTC (permalink / raw)
On Sun, 23 Jan 2005 20:55:14 GMT Mark A. Nicolosi wrote:
> (defun my-c-mode-hook ()
> ;; <SNIP>
> (local-set-key (kbd "\t") 'indent-or-complete)
> ;; <SNIP>
> )
> (add-hook 'c-mode-hook 'my-c-mode-hook)
(kbd "\t") gives "" here. Try "\t" or (kbd "TAB").
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with key binding
2005-01-23 22:30 ` David Hansen
@ 2005-01-24 0:02 ` August
2005-01-24 0:04 ` Mark A. Nicolosi
1 sibling, 0 replies; 4+ messages in thread
From: August @ 2005-01-24 0:02 UTC (permalink / raw)
On sön, 2005-01-23 at 23:30 +0100, David Hansen wrote:
> On Sun, 23 Jan 2005 20:55:14 GMT Mark A. Nicolosi wrote:
>
> > (defun my-c-mode-hook ()
> > ;; <SNIP>
> > (local-set-key (kbd "\t") 'indent-or-complete)
> > ;; <SNIP>
> > )
> > (add-hook 'c-mode-hook 'my-c-mode-hook)
>
> (kbd "\t") gives "" here. Try "\t" or (kbd "TAB").
I always use the bracket notation for keyboard input as I find it to be
the most readable alternative:
(local-set-key [tab] ...)
--
August
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with key binding
2005-01-23 22:30 ` David Hansen
2005-01-24 0:02 ` August
@ 2005-01-24 0:04 ` Mark A. Nicolosi
1 sibling, 0 replies; 4+ messages in thread
From: Mark A. Nicolosi @ 2005-01-24 0:04 UTC (permalink / raw)
David Hansen wrote:
> On Sun, 23 Jan 2005 20:55:14 GMT Mark A. Nicolosi wrote:
>
>
>>(defun my-c-mode-hook ()
>> ;; <SNIP>
>> (local-set-key (kbd "\t") 'indent-or-complete)
>> ;; <SNIP>
>> )
>>(add-hook 'c-mode-hook 'my-c-mode-hook)
>
>
> (kbd "\t") gives "" here. Try "\t" or (kbd "TAB").
Thanks, I've got it working now.
--
Mark A. Nicolosi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-01-24 0:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-23 20:55 Problem with key binding Mark A. Nicolosi
2005-01-23 22:30 ` David Hansen
2005-01-24 0:02 ` August
2005-01-24 0:04 ` Mark A. Nicolosi
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).