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

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

Re: activate input method


From: harven
Subject: Re: activate input method
Date: Wed, 30 May 2012 17:51:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> Am 28.05.2012 21:18, schrieb harven:
>> 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.
>>
>
> if all buffer are in same mode, maybe bind it at the resp. mode-hook?

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


reply via email to

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