From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: Retrieve a web page into buffer and insert some text into it. Date: Fri, 30 Jul 2010 20:12:11 +0300 Message-ID: <87sk30sxlg.fsf@mithlond.arda> References: <4C504E73.6050207@mousecar.com> <4C50C15D.6000808@mousecar.com> <4C51DE14.2060102@mousecar.com> <4C52B62E.9060405@mousecar.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1280510087 23340 80.91.229.12 (30 Jul 2010 17:14:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 30 Jul 2010 17:14:47 +0000 (UTC) Cc: GNU Emacs List To: filebat Mark Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jul 30 19:14:45 2010 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.69) (envelope-from ) id 1OetAF-0000Bs-SZ for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Jul 2010 19:14:44 +0200 Original-Received: from localhost ([127.0.0.1]:47630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OetAB-0005W7-Ri for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Jul 2010 13:14:27 -0400 Original-Received: from [140.186.70.92] (port=40970 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oet9g-0005V0-7Q for help-gnu-emacs@gnu.org; Fri, 30 Jul 2010 13:13:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oet9e-00035V-JS for help-gnu-emacs@gnu.org; Fri, 30 Jul 2010 13:13:55 -0400 Original-Received: from mta-out.inet.fi ([195.156.147.13]:47103 helo=kirsi2.inet.fi) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oet9e-0002lc-Ar for help-gnu-emacs@gnu.org; Fri, 30 Jul 2010 13:13:54 -0400 Original-Received: from mithlond.arda (84.251.132.215) by kirsi2.inet.fi (8.5.122) id 4C33307D00B94A19; Fri, 30 Jul 2010 20:12:12 +0300 Original-Received: from dtw by mithlond.arda with local (Exim 4.69) (envelope-from ) id 1Oet7z-0003OW-Uj; Fri, 30 Jul 2010 20:12:11 +0300 In-Reply-To: (filebat Mark's message of "Sat, 31 Jul 2010 00:51:30 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:74358 Archived-At: * 2010-07-31 00:51 (+0800), filebat Mark wrote: > Does the below solve your problem? I don't know but I'll comment your code in general. > (defun match-web-body() > (interactive) > (setq case-fold-search t);;Make searches case insensitive > (goto-char 0) > (re-search-forward "\\(< *\n* *body\n* +fgcolor=\".*\" *\n*>\\)" nil t 1) > (setq match_str (match-string 1)) > (message match_str) > ) If you want to set case-fold-search or other state-changing variable for certain operation create a local binding for the variable, do not assign new value to the existing binding. In other words, do not do this: (setq case-fold-search t) (re-search-forward ...) Do this instead: (let ((case-fold-search t)) (re-search-forward ...)) Also, do not introduce new global variables in functions like you did here: > (setq match_str (match-string 1)) > (message match_str) In that case there is no need for the variable at all. It could be written like this: (message "%s" (match-string 1)) But even if you needed a variable you shouldn't introduce it with SETQ but create a local binding with LET: (let ((match-str (match-string 1))) (message "%s" match-str) ;; Plus other uses of the variable ) In short, keep things local.