[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: prompt: "Select one of these safe coding systems"
From: |
Eli Zaretskii |
Subject: |
Re: prompt: "Select one of these safe coding systems" |
Date: |
Mon, 25 Nov 2002 08:02:54 +0200 (IST) |
On 24 Nov 2002, D. Goel wrote:
> [1] It seems I cannot get emacs to follow a system I want (utf-8) by
> default. It still tries other systems and then shows me utf-8 among
> the list of choices. What am i doing wrong?
How did you try to achieve that? The right way is to use
prefer-coding-system, I think.
> [2] If emacs cannot "safely" encode, how do i ask it to please not
> prompt me, but simply select the first from the "safe" "alternatives"
> shows me?
IIRC, you can't. Wrong encoding is deemed a disaster (because it could
lose information and corrupt your precious files), so Emacs always prompts.
The only exception is when the buffer's coding-system is undecided and
the buffer can be encoded using the language environment's default
encoding. For example, if you start with a pure-ASCII text and then add
Latin-1 characters to it, and your language environment is Latin-1, then
Emacs will silently use Latin-1 encoding when you save the text.
> [3] Any other hints or workarounds, considering this situation?
> I really want to get rid of this prompt :(
Just don't type characters that cannot be encoded with the buffer's
file-coding-system ;-)
> esp. since the prompt
> shows up for not me but for an infobot, which is supposed to be run
> noninteractively.
Non-interactive Lisp programs can bind coding-system-for-write to
something appropriate before they invoke functions that write to files.
> I don't care too much how it stores any
> international characters that may have shown up, as long as it stores
> the 99.9% english part just fine---i just want emacs to select
> somethigng and just do it.
If the encoding of non-ASCII characters _really_ doesn't matter (but
please think carefully about this and make a few experiments before you
decide, since the results might surprise you), then bind
coding-system-for-write to raw-text.