all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* choose input method automatically
@ 2004-06-09 14:26 Simon Strobl
  2004-06-09 15:33 ` Kevin Rodgers
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Strobl @ 2004-06-09 14:26 UTC (permalink / raw)


Hello,

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?

Simon

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

* Re: choose input method automatically
  2004-06-09 14:26 choose input method automatically Simon Strobl
@ 2004-06-09 15:33 ` Kevin Rodgers
  2004-06-09 18:31   ` Michael Slass
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Rodgers @ 2004-06-09 15:33 UTC (permalink / raw)


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")

-- 
Kevin Rodgers

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

* Re: choose input method automatically
  2004-06-09 15:33 ` Kevin Rodgers
@ 2004-06-09 18:31   ` Michael Slass
  2004-06-13 10:46     ` Oliver Scholz
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Slass @ 2004-06-09 18:31 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> 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):

,----
|    The `eval' "variable," and certain actual variables, create a
| special risk; when you visit someone else's file, local variable
| specifications for these could affect your Emacs in arbitrary ways.
| Therefore, the option `enable-local-eval' controls whether Emacs
| processes `eval' variables, as well variables with names that end in
| `-hook', `-hooks', `-function' or `-functions', and certain other
| variables.  The three possibilities for the option's value are `t',
| `nil', and anything else, just as for `enable-local-variables'.  The
| default is `maybe', which is neither `t' nor `nil', so normally Emacs
| does ask for confirmation about file settings for these variables.
`----

-- 
Mike Slass

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

* Re: choose input method automatically
  2004-06-09 18:31   ` Michael Slass
@ 2004-06-13 10:46     ` Oliver Scholz
  2004-06-14  7:35       ` Simon Strobl
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Scholz @ 2004-06-13 10:46 UTC (permalink / raw)


Michael Slass <miknrene@drizzle.com> writes:

> Kevin Rodgers <ihs_4664@yahoo.com> 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é!

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

* Re: choose input method automatically
  2004-06-13 10:46     ` Oliver Scholz
@ 2004-06-14  7:35       ` Simon Strobl
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Strobl @ 2004-06-14  7:35 UTC (permalink / raw)


> (defvar my-input-method nil
> [...]

Thanks a lot. In order to set input-method *and* coding automatically,
I have put the following in the first line of my file:

% -*- coding: utf-8; my-input-method: u8tex; -*-

(For those who have the same problem: Replace % by the specific
comment character you need for your type of file.)

Having a coding line and a my-input-method line at the same time did
not work.

Thanks to all who participated in this thread.

Simon

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

end of thread, other threads:[~2004-06-14  7:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-09 14:26 choose input method automatically Simon Strobl
2004-06-09 15:33 ` Kevin Rodgers
2004-06-09 18:31   ` Michael Slass
2004-06-13 10:46     ` Oliver Scholz
2004-06-14  7:35       ` Simon Strobl

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.