unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* activate input method
@ 2012-05-28 19:18 harven
  2012-05-29 17:49 ` Andreas Röhler
       [not found] ` <mailman.1873.1338313782.855.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: harven @ 2012-05-28 19:18 UTC (permalink / raw)
  To: help-gnu-emacs

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: activate input method
  2012-05-28 19:18 activate input method harven
@ 2012-05-29 17:49 ` Andreas Röhler
       [not found] ` <mailman.1873.1338313782.855.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Röhler @ 2012-05-29 17:49 UTC (permalink / raw)
  To: help-gnu-emacs

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?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: activate input method
       [not found] ` <mailman.1873.1338313782.855.help-gnu-emacs@gnu.org>
@ 2012-05-30 15:51   ` harven
  0 siblings, 0 replies; 3+ messages in thread
From: harven @ 2012-05-30 15:51 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-30 15:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-28 19:18 activate input method harven
2012-05-29 17:49 ` Andreas Röhler
     [not found] ` <mailman.1873.1338313782.855.help-gnu-emacs@gnu.org>
2012-05-30 15:51   ` harven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).