all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: harven <harven@free.fr>
To: help-gnu-emacs@gnu.org
Subject: Re: activate input method
Date: Wed, 30 May 2012 17:51:21 +0200	[thread overview]
Message-ID: <87d35lmzuu.fsf@ergodik.univ-brest.fr> (raw)
In-Reply-To: mailman.1873.1338313782.855.help-gnu-emacs@gnu.org

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


      parent reply	other threads:[~2012-05-30 15:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d35lmzuu.fsf@ergodik.univ-brest.fr \
    --to=harven@free.fr \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.