help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get rid of Microsoft dumb quotes, e.g. \222 for apostrophe?


From: Brendan Halpin
Subject: Re: How to get rid of Microsoft dumb quotes, e.g. \222 for apostrophe?
Date: Fri, 16 Feb 2007 12:44:00 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

"Endless Story" <usable.thought@gmail.com> writes:

> I have just started seeing lots of nasty stuff like \222 instead of
> apostrophes in working on text files in Emacs on XP, then trying to
> reformat these files for LaTeX. 

Something like this might work: 

  (while (re-search-forward "[€-Ÿ]" nil t)
    (let ((mschar (buffer-substring-no-properties 
                   (match-beginning 0) (match-end 0))))
      (cond 
       ((string= mschar "‘") (replace-match "`" )) 
       ((string= mschar "’") (replace-match "'" )) 
       ((string= mschar "“") (replace-match "``")) 
       ((string= mschar "”") (replace-match "''")) 
       ((string= mschar "–") (replace-match "--")))))

Obviously, the list of matches can be extended.

Brendan
-- 
Brendan Halpin,  Department of Sociology,  University of Limerick,  Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:brendan.halpin@ul.ie  http://www.ul.ie/sociology/brendan.halpin.html


reply via email to

[Prev in Thread] Current Thread [Next in Thread]