* automating language environment settings
@ 2002-09-04 13:41 Crni Gorac
2002-09-04 13:58 ` Peter Wu
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Crni Gorac @ 2002-09-04 13:41 UTC (permalink / raw)
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. 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. However, while everything else works fine, emacs seems to be
unable to change language environment using above procedure. Any
suggestion here?
Thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automating language environment settings
2002-09-04 13:41 automating language environment settings Crni Gorac
@ 2002-09-04 13:58 ` Peter Wu
2002-09-04 18:09 ` Crni Gorac
2002-09-04 18:43 ` Jesper Harder
2002-09-04 19:06 ` Matthias Meulien
2 siblings, 1 reply; 8+ messages in thread
From: Peter Wu @ 2002-09-04 13:58 UTC (permalink / raw)
cgorac@yahoo.com (Crni Gorac) writes:
> 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. 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. However, while everything else works fine, emacs seems to be
> unable to change language environment using above procedure. Any
> suggestion here?
I use Chinese in Emacs.
(set-language-environment "Chinese-GB")
--
Powered by FreeBSD!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automating language environment settings
2002-09-04 13:58 ` Peter Wu
@ 2002-09-04 18:09 ` Crni Gorac
0 siblings, 0 replies; 8+ messages in thread
From: Crni Gorac @ 2002-09-04 18:09 UTC (permalink / raw)
Peter Wu <peterwu@hotmail.com> wrote in message news:<86k7m1svor.fsf@yy-sis-yy.2662-D1H>...
> cgorac@yahoo.com (Crni Gorac) writes:
>
> > 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. 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. However, while everything else works fine, emacs seems to be
> > unable to change language environment using above procedure. Any
> > suggestion here?
>
> I use Chinese in Emacs.
>
> (set-language-environment "Chinese-GB")
I can use Latin-2 too, the problem is that I don't want it to be
default (I guess you have above in your .emacs) but to start it up
automatically per file basis.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automating language environment settings
2002-09-04 13:41 automating language environment settings Crni Gorac
2002-09-04 13:58 ` Peter Wu
@ 2002-09-04 18:43 ` Jesper Harder
2002-09-04 19:06 ` Matthias Meulien
2 siblings, 0 replies; 8+ messages in thread
From: Jesper Harder @ 2002-09-04 18:43 UTC (permalink / raw)
cgorac@yahoo.com (Crni Gorac) writes:
> 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. 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;
Hmm, you could set the coding and input method using local variables in
the file. Like this:
-*- coding: latin-2; -*-
Foo bar
Local Variables:
eval: (set-input-method 'latin-2-prefix)
End:
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automating language environment settings
2002-09-04 13:41 automating language environment settings Crni Gorac
2002-09-04 13:58 ` Peter Wu
2002-09-04 18:43 ` Jesper Harder
@ 2002-09-04 19:06 ` Matthias Meulien
2002-09-05 14:26 ` Crni Gorac
2 siblings, 1 reply; 8+ messages in thread
From: Matthias Meulien @ 2002-09-04 19:06 UTC (permalink / raw)
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automating language environment settings
2002-09-04 19:06 ` Matthias Meulien
@ 2002-09-05 14:26 ` Crni Gorac
2002-09-06 14:39 ` Matthias MEULIEN
0 siblings, 1 reply; 8+ messages in thread
From: Crni Gorac @ 2002-09-05 14:26 UTC (permalink / raw)
Matthias Meulien <meulien@club.lemonde.fr> wrote in message news:<m2n0qxlgle.fsf@clarinde.localdomain>...
> > 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?
This is exactly what I have to avoid. I know about all of above
mentionned but I'd like not to have to type `C-x RET l' sequence each
time when I open Latin-2 encoded file in order to be able to edit it.
I'd like to have files let know emacs to change language environment
to Latin-2 each time when opened.
Thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automating language environment settings
2002-09-05 14:26 ` Crni Gorac
@ 2002-09-06 14:39 ` Matthias MEULIEN
2002-09-08 17:42 ` Crni Gorac
0 siblings, 1 reply; 8+ messages in thread
From: Matthias MEULIEN @ 2002-09-06 14:39 UTC (permalink / raw)
cgorac@yahoo.com (Crni Gorac) wrote:
> (...) This is exactly what I have to avoid. I know about all of
> above mentionned but I'd like not to have to type `C-x RET l'
> sequence each time when I open Latin-2 encoded file in order to be
> able to edit it. I'd like to have files let know emacs to change
> language environment to Latin-2 each time when opened.
The following does what you want ?
(add-hook 'find-file-hooks
'(lambda ()
(if (equal buffer-file-coding-system 'iso-latin-2)
(set-language-environment "Latin-2"))))
--
Matthias
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: automating language environment settings
2002-09-06 14:39 ` Matthias MEULIEN
@ 2002-09-08 17:42 ` Crni Gorac
0 siblings, 0 replies; 8+ messages in thread
From: Crni Gorac @ 2002-09-08 17:42 UTC (permalink / raw)
Matthias MEULIEN <meulien@club.lemonde.fr> wrote in message news:<yg7vg5jgp23.fsf@fermat.math.uvsq.fr>...
> cgorac@yahoo.com (Crni Gorac) wrote:
>
> > (...) This is exactly what I have to avoid. I know about all of
> > above mentionned but I'd like not to have to type `C-x RET l'
> > sequence each time when I open Latin-2 encoded file in order to be
> > able to edit it. I'd like to have files let know emacs to change
> > language environment to Latin-2 each time when opened.
>
> The following does what you want ?
>
> (add-hook 'find-file-hooks
> '(lambda ()
> (if (equal buffer-file-coding-system 'iso-latin-2)
> (set-language-environment "Latin-2"))))
That was exactly what I was looking for. Thank you very much.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-09-08 17:42 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-04 13:41 automating language environment settings Crni Gorac
2002-09-04 13:58 ` Peter Wu
2002-09-04 18:09 ` Crni Gorac
2002-09-04 18:43 ` Jesper Harder
2002-09-04 19:06 ` Matthias Meulien
2002-09-05 14:26 ` Crni Gorac
2002-09-06 14:39 ` Matthias MEULIEN
2002-09-08 17:42 ` Crni Gorac
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.