Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

activate input method

15 views
Skip to first unread message

harven

unread,
May 28, 2012, 3:18:08 PM5/28/12
to
I am using this code to automatically activate the default input method
when a file is created.

(add-hook 'find-file-hook
(lambda () (activate-input-method default-input-method)))

But it does not handle buffers that are not related to a file, e.g.
buffers created using the switch-to-buffer command.
Is there a way to activate the input method for these newly created buffers ?

Thanks.

Andreas Röhler

unread,
May 29, 2012, 1:49:27 PM5/29/12
to help-gn...@gnu.org
if all buffer are in same mode, maybe bind it at the resp. mode-hook?


harven

unread,
May 30, 2012, 11:51:21 AM5/30/12
to
But then there is no hook that works for all modes ?
I haven't seen a create-buffer-hook either.
I finally tried this and it seems to work for all newly created buffers.

(defadvice switch-to-buffer (around activate-input-method first
(buffer-or-name) activate)
(let ((buffer-exists (get-buffer buffer-or-name)))
ad-do-it
(unless buffer-exists (activate-input-method default-input-method))))

Thanks for your answer,
--
Harven
0 new messages