unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Peter <peter.milliken@gmail.com>
To: gnu.emacs.help@googlegroups.com
Cc: help-gnu-emacs@gnu.org
Subject: Re: How do I search for symbols such as \253 in Emacs
Date: Tue, 6 Nov 2012 12:24:15 -0800 (PST)	[thread overview]
Message-ID: <7c0203e4-9363-4695-b7d6-7c6438526fae@googlegroups.com> (raw)
In-Reply-To: <mailman.12407.1352225988.855.help-gnu-emacs@gnu.org>

I wrote this many years ago when I first picked up Emacs. As I come across new characters I just add to the list with the expected replacement string. I tried to keep track of what the character looked like in the comment beside it. The replacement strings are for text files which I am converting to LaTeX files (which is typically where I run across this problem), so you might want to change some of the replacements to better suit your application.

Hope this helps,
Peter

(defun fix-latin-1-chars ()
  (interactive)
  (let ((change-list '((?\x005397c  "``")  ; “
                       (?\xc "")           ; Page Feed character
                      (?\x005397d  "''")   ; ”
                      (?\x2019  "'")    ; ’
                      (?\x201c  "''")   ; ”
                      (?\x201d  "''")   ; ”
                      (?\x2014  "--")   ; —
                      (?\x2026  " \\ldots ")   ; —
                      (?\x0053974  "--")   ; —
                      (?\x0053979  "'")    ; ’
                      (?\x81     "'")
                      (?\x2018     "'")
                      (?\x2019     "'")
                      (?\x201A     ".")
                      (?\x2022     ".")
                      (?\x8b4      "'")    ; ´
                      (?\x53979    "'")
                      (?\x00539a6  " ")    ; …
                      (?\x0053978  "`")    ; ‘
                      (?\x0053973  "--")   ; –
                      (?\x2013  "--")   ; –
                      (?\x8b7  "*")        ; ·
                      (?\x004e647  "*")    ; 
                      (?\x004e6a0  "*")    ; 
                      (?\x8bd  ".5")       ; ½
                      (?\x8a1  " ")        ; ¡
                      (?\x8a7  " ")        ; §
                      (?\x8a8  " ")        ; ¨
                      (?\x0053973  "-")    ; –
                      (?\x0053c39  "*")    ; ∙
                      (?\x26  "and")       ; &
                      (?\x004e657  "*")    ; 
                      (?\x004e5f1  "*")    ; 
                      (?\x004e648  "*")    ; 
                      (?\x004f070  "*")    ; 
                      (?\x004e5ca  "*")    ; 
                      (?\x004e5f6  "*")    ; 
                      (?\x004e678  "*")    ; 
                      (?\xf0a8 "*")        ; 
                      (?\xf0b7 "*")        ; 
                      (?\xf0fc "*")        ; 
                      (?\x0053972  "*")    ; ‒
                      (?\x8d8  "*")        ; Ø
                      (?\x004e5aa  "*")    ; 
                      (?\x8b6 " ")         ; ¶
                      (?\x4f95f "")        ; 
                      (?\x539a0 "")        ; †
                      (?\x5397e "")
                      (?\xfeff "")
                      (?\x00539a2  "*")))  ; •
        (search-for)
        (start-point (point))
        (buffer-limit (point-max)))
    (dolist (item change-list)
      (setq search-for (make-string 1 (car item)))
      (goto-char start-point)
      (while (re-search-forward search-for buffer-limit t)
        (delete-char -1)
        (insert (car (cdr item)))))))



  parent reply	other threads:[~2012-11-06 20:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 11:23 How do I search for symbols such as \253 in Emacs acomber
2012-11-06 11:47 ` Peter Dyballa
2012-11-06 18:19   ` Oleksandr Gavenko
     [not found]   ` <mailman.12407.1352225988.855.help-gnu-emacs@gnu.org>
2012-11-06 20:24     ` Peter [this message]
2012-11-06 21:22       ` Eli Zaretskii
2012-11-06 12:09 ` Jambunathan K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c0203e4-9363-4695-b7d6-7c6438526fae@googlegroups.com \
    --to=peter.milliken@gmail.com \
    --cc=gnu.emacs.help@googlegroups.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).