all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ken <gebser@speakeasy.net>
To: help-gnu-emacs@gnu.org
Subject: Re: replacing characters and whacky trans-buffer conversion
Date: Fri, 09 Mar 2007 05:15:02 -0500	[thread overview]
Message-ID: <45F133A6.8090308@speakeasy.net> (raw)
In-Reply-To: <jwvd53jw5gj.fsf-monnier+gnu.emacs.help@gnu.org>

On 03/08/2007 08:51 PM somebody named Stefan Monnier wrote:
>>>> The first buffer is a *scratch* buffer, the modeline starts "--:".  The
>>>> second contains the *.el file mentioned in the original post; its
>>>> modeline begins "-:".
>>> For some reason this second buffer is in unibyte mode.
>>> That's the source of your problem.  Tell us how you created that buffer.
> 
>> C-x C-f
> 
> Hmm, that doesn't say much.
> Tell us the value of C-h v default-enable-multibyte-characters.
> Also shows us the first few and last few lines of the file.

In both the *.el file and in the *scratch* buffer
default-enable-multibyte-characters is t.

Here's the entirety of the *.el file:

;Replace goofy MS chars with latin1 equivalents.
;You can, of course, add to the list of chars.

; Multi-byte strings such as the one below should be toward
; the top of the list so that single-byte replacements don't
; cut them up, making subsequent searches for them impossible.
;"—" => "--"

; Also, to enter the escaped numbers, e.g. "\221", do
; C-q 2 2 1 RETURN.

;To discover the code for a new (garbage) char to be replaced,
;put the point over it and do "C-x="; the first code returned in
;the minibuffer tells you the escaped number you want to replace.

;Wrote up more on this at
;<http://www.emacswiki.org/cgi-bin/emacs-en/ReplaceGarbageChars>

(defun replace-garbage-chars ()
"Replace goofy MS and other garbage characters with latin1 equivalents."
(interactive)
(save-excursion				;save the current point
  (replace-string "—" "--" nil (point-min) (point-max)); multi-byte
  (replace-string "“" "``" nil (point-min) (point-max))
  (replace-string "–" "--" nil (point-min) (point-max))
  (replace-string "–" "'" nil (point-min) (point-max))
  (replace-string "k," "i" nil (point-min) (point-max))
  (replace-string "¢" "'" nil (point-min) (point-max))
  (replace-string "”" "'" nil (point-min) (point-max))
  (replace-string "?" "`" nil (point-min) (point-max))
  (replace-string "?" "'" nil (point-min) (point-max))
  (replace-string "?" "``" nil (point-min) (point-max))
  (replace-string "?" "''" nil (point-min) (point-max))
  (replace-string "?" "--" nil (point-min) (point-max))
))



-- 
"Genius might be described as a supreme capacity for getting its
possessors into trouble of all kinds."
	-- Samuel Butler

  reply	other threads:[~2007-03-09 10:15 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-06 15:15 replacing characters and whacky trans-buffer conversion ken
2007-03-06 16:28 ` Peter Dyballa
2007-03-07  7:38   ` Matthew Flaschen
2007-03-07  9:59     ` Peter Dyballa
2007-03-08 12:16   ` ken
2007-03-08 16:31     ` Peter Dyballa
2007-03-08 20:43   ` ken
2007-03-08 23:14     ` Peter Dyballa
     [not found]     ` <mailman.688.1173395790.7795.help-gnu-emacs@gnu.org>
2007-03-09 14:28       ` Oliver Scholz
2007-03-07 20:48 ` ken
2007-03-07 21:03   ` ken
2007-03-07 21:30     ` Peter Dyballa
2007-03-08  1:11       ` ken
     [not found]       ` <mailman.627.1173316331.7795.help-gnu-emacs@gnu.org>
2007-03-08  7:50         ` Stefan Monnier
2007-03-08 10:40           ` ken
2007-03-08 11:55             ` ken
     [not found]           ` <mailman.648.1173350436.7795.help-gnu-emacs@gnu.org>
2007-03-09  1:51             ` Stefan Monnier
2007-03-09 10:15               ` ken [this message]
2007-03-09 13:14                 ` Peter Dyballa
2007-03-09 15:54                   ` ken
2007-03-09 16:13                     ` Peter Dyballa
2007-03-09 18:41                   ` Reiner Steib
2007-03-10 18:29                     ` ken
2007-03-10 18:57                       ` Reiner Steib
2007-03-10 19:00                       ` Peter Dyballa
2007-03-10 19:12                       ` Eli Zaretskii
2007-03-09 10:21               ` ken
2007-03-09 13:02                 ` Peter Dyballa
     [not found]               ` <mailman.699.1173435731.7795.help-gnu-emacs@gnu.org>
2007-03-09 20:20                 ` Stefan Monnier
2007-03-10 18:32                   ` ken
     [not found]               ` <mailman.698.1173435330.7795.help-gnu-emacs@gnu.org>
2007-03-09 20:34                 ` Stefan Monnier
2007-03-09 22:00                   ` Oliver Scholz
     [not found] <mailman.528.1173194164.7795.help-gnu-emacs@gnu.org>
2007-03-06 16:41 ` Oliver Scholz
2007-03-06 17:52 ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=45F133A6.8090308@speakeasy.net \
    --to=gebser@speakeasy.net \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.