From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: brad clawsie Newsgroups: gmane.emacs.help Subject: elisp optimization question Date: Thu, 08 May 2008 11:03:53 -0700 Message-ID: <86k5i4pt9y.fsf@jobbicycle.corp.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210283828 16547 80.91.229.12 (8 May 2008 21:57:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2008 21:57:08 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 08 23:57:43 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JuE76-0001XZ-Kb for geh-help-gnu-emacs@m.gmane.org; Thu, 08 May 2008 23:57:20 +0200 Original-Received: from localhost ([127.0.0.1]:50270 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuE6O-0002IN-Hy for geh-help-gnu-emacs@m.gmane.org; Thu, 08 May 2008 17:56:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JuATT-00058e-5O for help-gnu-emacs@gnu.org; Thu, 08 May 2008 14:04:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JuATO-0004wJ-3g for help-gnu-emacs@gnu.org; Thu, 08 May 2008 14:04:10 -0400 Original-Received: from [199.232.76.173] (port=57708 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuATN-0004w2-EW for help-gnu-emacs@gnu.org; Thu, 08 May 2008 14:04:05 -0400 Original-Received: from out2.smtp.messagingengine.com ([66.111.4.26]:50221) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JuATN-0001sZ-4X for help-gnu-emacs@gnu.org; Thu, 08 May 2008 14:04:05 -0400 Original-Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 6D352106D51 for ; Thu, 8 May 2008 14:04:04 -0400 (EDT) Original-Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Thu, 08 May 2008 14:04:04 -0400 X-Sasl-enc: eQkJwh4RwXrQpYGC6T/zojlYl0kxaGoqbMVbzJsRu8gU 1210269843 Original-Received: from jobbicycle.corp.yahoo.com (nat-dip4.fw.corp.yahoo.com [209.131.62.113]) by mail.messagingengine.com (Postfix) with ESMTPSA id D6618112DB for ; Thu, 8 May 2008 14:04:03 -0400 (EDT) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (berkeley-unix) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Thu, 08 May 2008 17:54:55 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:53823 Archived-At: -----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-----