[XeTeX] Converting legacy encodings to utf-8

Peter Dyballa Peter_Dyballa at Web.DE
Tue Jul 11 13:18:12 CEST 2006


Am 11.07.2006 um 12:47 schrieb Joachim Trinkwitz:

> I usually take BareBones free editor TextWrangler to convert my old
> latin1 files to utf-8 (open file, ev. "Reopen using encoding xyz",
> then "Save as ..." and choose the right encoding under "Options"),
> something I never succeeded with with Emacs. Otherwise I usually use
> Emacs (nowadays in incarnation of Aquamacs Emacs) with auctex because
> of its outstanding ease and comfort wrt (La)TeX, so I would like to
> hear your method.

Modern Emacsen from CVS, i.e. versions 22.0.50, 23.0.0, have C-x RET  
r, or: Options menu -> Mule (Multilingual Environment) -> Set Coding  
Systems -> choose one of the options. I admit it did not seem to work  
for me first. Sometimes I had local variables, and I am sure I had  
settings in .emacs for ancient Emacsen that prevented the code  
conversion to work. My solution was to out-source version specific  
code blocks from .emacs ...

(defconst mEV (emacs-version)
   "Keep the Emacs version string,
    that is needed a few times.")
(defconst mWS (symbol-value 'window-system)
   "Running as some windowing system's client,
    or as slave of a terminal emulator?")

;;; Desktop & Session
(unless (string-match "21.2" mEV)
   (progn
     (desktop-save-mode 1)
     (setq history-length 250)
     (setq desktop-globals-to-save '(desktop-missing-file-warning))
     (setq desktop-dirname   (format "~/.emacs.d/PDesktop-%d" emacs- 
major-version))
;veraltet: (desktop-load-default)
;    (setq desktop-buffer-modes-to-save
;          (cons 'w3m-mode desktop-buffer-modes-to-save))
;    (setq desktop-locals-to-save
;          (cons 'buffer-file-coding-system desktop-locals-to-save))
     (require 'session)
     (add-hook 'after-init-hook 'session-initialize)
     (setq session-save-file-coding-system 'utf-8-unix)
     (setq session-save-file (format "~/.Psession-%d"	 emacs-major- 
version))
))

(if (not (string-match "XEmacs" mEV))
     (progn
	(load (format "~/.emacs_%s" mWS))
	(setq custom-file (format "~/.emacs-Abrichtung-%d.el" emacs-major- 
version))
	(if (string-match "Aquamacs" mEV)
	    (progn
		(setq desktop-path (quote ("~/.emacs.d/PDesktop-Aqua")))
		(setq session-save-file "~/.Psession-Aqua")
		(setq custom-file "~/.emacs-Abrichtung-AquaMacs.el")
	))
	(if (string-match "Step" mEV)
	    (progn
		(setq desktop-path (quote ("~/.emacs.d/PDesktop-NS")))
		(setq session-save-file "~/.Psession-NS")
	))
	(load custom-file)
	(add-hook 'before-save-hook 'time-stamp)
))

Enabling me also to have different "environments" or working sets of  
files open in the different personalities.

--
Mit friedvollen Grüßen

   Pete
               <\
                 \__     O                       __O
                 | O\   _\\/\-%                _`\<,
                 '()-'-(_)--(_)               (_)/(_)





More information about the XeTeX mailing list