[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: configuring coding systems for loading/saving
From: |
Kevin Rodgers |
Subject: |
Re: configuring coding systems for loading/saving |
Date: |
Thu, 06 May 2010 17:23:21 -0600 |
User-agent: |
Thunderbird 2.0.0.24 (Macintosh/20100228) |
David Madore wrote:
I also tried this:
(setq select-safe-coding-system-accept-default-p
'(lambda (coding) (string= coding buffer-file-coding-system)))
which I think should do more or less what I want (accept an encoding
as safe only if it matches exactly the buffer-file-coding-system), but
it fails for a stupid reason: coding is typically something like
"iso-8859-1" whereas buffer-file-coding-system is typically something
like "iso-8859-1-unix" - and I don't know how to test more
intelligently than with string-equal.
How about:
(equal (coding-system-get coding 'mime-charset)
(coding-system-get buffer-file-coding-system 'mime-charset)
or
(equal (coding-system-change-eol-conversion coding 'unix)
(coding-system-change-eol-conversion buffer-file-coding-system 'unix))
Can someone explain why
(coding-system-change-eol-conversion 'iso-8859-1 nil)
⇒ iso-8859-1
(coding-system-change-eol-conversion 'iso-8859-1-unix nil)
⇒ iso-latin-1
Also, I'm afraid overriding
select-safe-coding-system-accept-default-p could have unpleasant
effects (e.g., if some Emacs application wishes to suggest that the
previously chosen file encoding is inadequate).
--
Kevin Rodgers
Denver, Colorado, USA