I define one function in my .emacs, I want to activate ECB and goto to directory when I enter f12, but it does not work
(defun my-toggle-ecb ()
(ecb-activate)
(ecb-goto-window-directories)
)
(global-set-key (kbd "<f12>") 'my-toggle-ecb)
Join Stack Overflow to learn, share knowledge, and build your career.
I define one function in my .emacs, I want to activate ECB and goto to directory when I enter f12, but it does not work
(defun my-toggle-ecb ()
(ecb-activate)
(ecb-goto-window-directories)
)
(global-set-key (kbd "<f12>") 'my-toggle-ecb)
Yea, that's one of Emacs' odder quirks. Unless you declare that a function is interactive, there's no way way to call it directly. Luckily it's easy:
(defun my-toggle-ecb ()
(interactive)
(ecb-activate)
(ecb-goto-window-directories))
Your keybinding remains the same. Have fun!
C-h f interactive RET
for more details, and how interactive
is used to obtain arguments from the user (or otherwise).
– phils
Feb 13 '12 at 6:01