free hit counter

Thursday, November 10, 2005

line endings in XEmacs

So the MS Visual Studio 2003 compiler is picky about the lineendings in your files. It only wants dos cr/lf linefeeds, not unix cr, and definitly not a mix of the two.

In XEmacs the magic word realted to this is coding. C-h a coding RET will get you more than you ever wanted to know about character coding systems.

Thanks to I got this working. Here's the snippet I'm have in my init.el to use dos linefeeds by default:

(set-default-buffer-file-coding-system 'undecided-dos)
(setq coding-toggle nil)
(defun toggle-line-end-coding ()
"Switch from DOS line ends (\r\n) to Unix (\n) and back again"
(if coding-toggle
(set-buffer-file-coding-system `undecided-unix)
(setq coding-toggle nil)
(message "Use unix line endings." ())
(set-buffer-file-coding-system `undecided-dos)
(setq coding-toggle t)
(message "Use dos line endings." ())


Post a Comment

<< Home