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: Wed, 26 Jul 2006 23:35:14 +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)))


Hi all,

There's a problem with this code which I'm not being able to solve.
When you are on an empty line, there's no autocompletion but the
cursor is not indented to the correct position either. Any way to
solve this?

Thanks,

Paulo Matos

--
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]