From: Richard M. Stallman Date: Sat, 10 Jun 2006 10:34:35 +0000 (+0000) Subject: (Coding Conventions): Explain use of coding systems X-Git-Tag: emacs-pretest-22.0.90~1994 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4c02cf8619e158542d4273bda97231b325c63f19;p=emacs.git (Coding Conventions): Explain use of coding systems to ensure one decoding for strings. --- diff --git a/lispref/tips.texi b/lispref/tips.texi index d2060a942bf..727ae6918de 100644 --- a/lispref/tips.texi +++ b/lispref/tips.texi @@ -223,6 +223,31 @@ Lisp, so please don't use it in your programs. (Emacs uses such names only for special-purpose buffers.) The users will find Emacs more coherent if all libraries use the same conventions. +@item +If your program contains non-ASCII characters in string or character +constants, you should make sure Emacs always decodes these characters +the same way, regardless of the user's settings. There are two ways +to do that: + +@itemize - +@item +Use coding system @code{emacs-mule}, and specify that for +@code{coding} in the @samp{-*-} line or the local variables list. + +@example +;; XXX.el -*- coding: emacs-mule; -*- +@end example + +@item +Use one of the coding systems based on ISO 2022 (such as +iso-8859-@var{n} and iso-2022-7bit), and specify it with @samp{!} at +the end for @code{coding}. (The @samp{!} turns off any possible +character translation.) + +@example +;; XXX.el -*- coding: iso-latin-2!; -*- +@end example + @item Indent each function with @kbd{C-M-q} (@code{indent-sexp}) using the default indentation parameters.