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

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

Re: automating language environment settings


From: Matthias Meulien
Subject: Re: automating language environment settings
Date: 04 Sep 2002 21:06:37 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

> From time to time, I'm using emacs to edit documents written using ISO
> 8859-2 charset. Thus, I have first to set language environment to
> "Latin-2", then to open text file and finally to select "latin-2-prefix"
> as input method. 

You can activate the "latin-2-prefix" input method automatically when
changing of language environment with the following hooks; it also sets
the default input method for the latin-1 language environment:

(add-hook 'set-language-environment-hook
            '(lambda ()
               (let ((lang current-language-environment))
                 (cond ((equal lang "Latin-2")
                        (set-terminal-coding-system 'latin-2)
                        (activate-input-method "latin-2-prefix"))
                       ((equal lang "Latin-1")
                        (set-terminal-coding-system 'latin-1)
                        (setq default-input-method "french-prefix"))))))

(add-hook 'exit-language-environment-hook
            '(lambda ()
               (set-terminal-coding-system nil)))

Note that the terminal settings are useful when you work on a character 
terminal.

> So I was thinking about automating above process by creating
> corresponding emacs mode and then to reference this mode from first
> line of related documents; if everything setup properly, emacs
> should be able to apply all necessary settings upon opening
> document. (...)

Read about local variables in the info manual. 

Don't you think that the `C-x RET l' key sequence is enough?
-- 
Matthias


reply via email to

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