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

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

Re: Adding Key bindings


From: Paulo J. Matos
Subject: Re: Adding Key bindings
Date: Sat, 22 Jul 2006 02:36:06 +0100

On 21/07/06, Kevin Rodgers <address@hidden> wrote:
Paulo J. Matos wrote:
> I did:
> (add-hook 'c++-mode-hook
>       '(lambda ()
>          (define-key c++-mode-map "\011" 'semantic-ia-complete-symbol)))
>
> However, this rebinds TAB to semantic-ia-complete-symbol and it will
> not indent anymore. I don't want previous actions to disappear, I want
> to add semantic-ia-complete-symbol action to the TAB key. How can I
> mend this?

How about:

(defun c++-complete-or-indent ()
   (interactive)
   "Try to complete the current symbol at point, otherwise indent."
   ;; Kludge this because semantic-ia-complete-symbol really doesn't
   ;; return anything useful:
   (when (equal (semantic-ia-complete-symbol (point))
               "No smart completions found.")
     (c-indent-command current-prefix-arg)))

(add-hook 'c++-mode-hook
          (lambda ()
            (local-set-key "\t" c++-complete-or-indent)))


Loved it! Thanks, need to learn more about Emacs Lisp! :-)

--
Kevin



_______________________________________________
help-gnu-emacs mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs



--
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group




reply via email to

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