"Stephen J. Turnbull" <stephen(a)xemacs.org> さんは書きました:
>>>>> "Eduards" == Eduards Mihelovics
<emikhelo(a)gmail.com> writes:
Eduards> When I run M-x prefer-coding-system utf-8, I get: Can't
Eduards> prefer coding system utf-8.
That's an XEmacs bug, I've confirmed it. Evaluating the expression
I noticed that bug as well already, but I wasn't sure whether it was a
bug or not and somehow forgot to ask on the mailing list. The
"site-start.el" file of the SuSE XEmacs package currently contains the
code below. Note the comment I wrote which says that
(prefer-coding-system 'utf-8) doesn't work:
(defun suse-set-coding-systems ()
(let* ((tmp (shell-command-to-string "locale charmap"))
(tmp (substring tmp 0 (string-match "\[ \t\n\]" tmp)))
(tmp (downcase tmp)))
(when (find-coding-system (intern tmp))
;; set the coding system priorities:
;; (this is also important to make XIM in utf-8 work
;; because XEmacs has no variable/function to set the
;; coding-system for XIM, it is just autodetected which
;; will work correctly only when the coding-system priorities
;; are OK.)
(if (not (string-match "utf-8" tmp))
(progn (prefer-coding-system (intern tmp))
(if (fboundp 'latin-unity-install) (latin-unity-install)))
;; it's strange, but (prefer-coding-system 'utf-8) doesn't
;; work in XEmacs.
;; use 'set-coding-priority-list instead, which achieves
;; the same and works for 'utf-8 as well:
(set-coding-priority-list (list (intern tmp)))
(set-coding-category-system (intern tmp) (intern tmp)))
(if (emacs-version>= 21 5 6)
;; XEmacs 21.5 apparently renamed this function:
(set-default-output-coding-systems (intern tmp))
(set-default-coding-systems (intern tmp)))
(set-keyboard-coding-system (intern tmp))
(set-terminal-coding-system (intern tmp))
;; XEmacs 21.5.16 needs this to be able to use non-ASCII file names:
(if (and (string-match "XEmacs" emacs-version)
(emacs-version>= 21 5 6))
(setq file-name-coding-system (intern tmp)))
;; without the following line, shell buffers are not by default
;; in UTF-8 when running in an UTF-8 locale in XEmacs 21.5.16:
(setq process-coding-system-alist (cons (cons ".*" (intern tmp))
'()))
;; these two lines appearently make no difference, if they
;; are used instead of the above process-coding-system-alist,
;; shell buffers still have the wrong encoding:
;; (setq default-process-coding-system-read (intern tmp))
;; (setq default-process-coding-system-write (intern tmp))
;; and this doesn't seem to work either:
;; (setq default-process-coding-system '(utf-8 . utf-8))
;;
;; the following is necessary to enable XEmacs to pass
;; command line arguments to external processes in the correct
;; encoding. For example this is needed to make
;; 'M-x grep' work when searching for UTF-8 strings
;; while running in an UTF-8 locale.
;;
(if (and (string-match "XEmacs" emacs-version)
(emacs-version>= 21 5 6))
(define-coding-system-alias 'native (intern tmp))))))
(suse-set-coding-systems)
--
Mike FABIAN <mfabian(a)suse.de>
http://www.suse.de/~mfabian
睡眠不足はいい仕事の敵だ。