From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: Re: choose input method automatically Date: Sun, 13 Jun 2004 12:46:29 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <13883bbe.0406090626.409ec60e@posting.google.com> <40C72DE5.8080304@yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1088535786 18142 80.91.224.253 (29 Jun 2004 19:03:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 Jun 2004 19:03:06 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 29 21:02:59 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BfNsg-00046h-00 for ; Tue, 29 Jun 2004 21:02:59 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BfNuM-00085x-Py for geh-help-gnu-emacs@m.gmane.org; Tue, 29 Jun 2004 15:04:42 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 56 Original-X-Trace: news.uni-berlin.de 1vhaUMuoUsH7GPOiZgXMbAvWdf5qTf6CtImmUpZzszXIOWr9w= X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6; Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:pakvVEC31l/h8B6qJSbONKhWPGM= Original-Xref: shelby.stanford.edu gnu.emacs.help:123757 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19117 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19117 Michael Slass writes: > Kevin Rodgers writes: > >>Simon Strobl wrote: >> > if a file starts with >> > >> > -*- coding: utf-8;-*- >> > >> > emacs will automatically set the coding to utf-8. Is there something >> > analogous for the input method? >> >>I would try adding this in -*-...-*-: >> >>eval: (set-input-method "foo") >> > > There's a gotcha with that --- if you don't want emacs forcing you to > confirm the local eval each time you read one of these files, you'll > need to frob enable-local-eval, as described in the "File Local > Variables" section of the emacs manual (excerpted below): [...] If you want to avoid both (confirming each time as well as frobbing enable-local-eval) you could set some variable of your own in the local variables section (everything below is untested) … -*- my-input-method: lirum-larum -*- … and then put something like this into your .emacs: (defvar my-input-method nil "Preferred input method local to a file. This variable is meant to be set in the local variables section.") (make-variable-buffer-local 'my-input-method) ;; When visiting a file, check whether `my-input-method' is non-nil ;; and set the current input method accordingly. (add-hook 'find-file-hooks (lambda () (when my-input-method ;; I seem to recall that the argument to ;; `set-input-method' is supposed to be a string, but I ;; can't check right now. (set-input-method (symbol-name my-input-method))))) I think this method would also be useful for setting up file-specific indentation styles, btw. Oliver -- 26 Prairial an 212 de la Révolution Liberté, Egalité, Fraternité!