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

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

Re: Adding Key bindings


From: Kevin Rodgers
Subject: Re: Adding Key bindings
Date: Fri, 21 Jul 2006 09:56:20 -0600
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

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

--
Kevin





reply via email to

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