all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* elisp optimization question
@ 2008-05-08 18:03 brad clawsie
  2008-05-08 22:14 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 8+ messages in thread
From: brad clawsie @ 2008-05-08 18:03 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi, i use the following function to translate unicode and other
entities found on the web into ascii that i can view in emacs-w3m. i
am concerned that each search and replace as done in my example is
inefficient, is there a better way to do this? i.e., is there a better
way to group search/replace pairs? thanks in advance!

(defun w3m-filter-brad (url)
  (goto-char (point-min))
  (while (re-search-forward "»" nil t)
    (replace-match ">>"))
  (goto-char (point-min))
  (while (re-search-forward "’" nil t)
    (replace-match "'"))
  (goto-char (point-min))
  (while (re-search-forward "“" nil t)
    (replace-match "\""))
  (goto-char (point-min))
  (while (re-search-forward "”" nil t)
    (replace-match "\""))
  (goto-char (point-min))
  (while (re-search-forward "—" nil t)
    (replace-match "-"))
  (goto-char (point-min))
  (while (re-search-forward "«" nil t)
    (replace-match "<"))
  (goto-char (point-min))
  (while (re-search-forward "»" nil t)
    (replace-match ">"))
  (goto-char (point-min))
  (while (re-search-forward "ö" nil t)
    (replace-match "o"))
  )
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAkgjQIwACgkQxRg3RkRK91MO8gCgqJHsYhE/3bUERIeVztOkABUI
xy0An3rk59o/OCHfaOlSVmM3zBdTgUXQ
=lwIH
-----END PGP SIGNATURE-----




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-05-09 21:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.11345.1210283700.18990.help-gnu-emacs@gnu.org>
2008-05-09  0:00 ` elisp optimization question harven
2008-05-09  1:45   ` Kevin Rodgers
     [not found]   ` <mailman.11354.1210297808.18990.help-gnu-emacs@gnu.org>
2008-05-09  9:59     ` Rupert Swarbrick
2008-05-09 21:43       ` harven
2008-05-09  0:36 ` Xah
2008-05-08 18:03 brad clawsie
2008-05-08 22:14 ` Lennart Borgman (gmail)
2008-05-09  1:42   ` Kevin Rodgers

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.