From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: weber Newsgroups: gmane.emacs.help Subject: bind-string-match: comments please Date: Tue, 30 Sep 2008 08:02:46 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1222789280 952 80.91.229.12 (30 Sep 2008 15:41:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 30 Sep 2008 15:41:20 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 30 17:42:18 2008 connect(): Connection refused 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 1KkhMJ-0005GX-Kq for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Sep 2008 17:41:55 +0200 Original-Received: from localhost ([127.0.0.1]:43142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkhLG-00004r-UD for geh-help-gnu-emacs@m.gmane.org; Tue, 30 Sep 2008 11:40:50 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!s50g2000hsb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 23 Original-NNTP-Posting-Host: 201.21.216.91 Original-X-Trace: posting.google.com 1222786966 20923 127.0.0.1 (30 Sep 2008 15:02:46 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 30 Sep 2008 15:02:46 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s50g2000hsb.googlegroups.com; posting-host=201.21.216.91; posting-account=7GrjgQoAAAD6slWURausdJnhFDkmQYC8 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.1.17) Gecko/20080829 Firefox/2.0.0.17,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 stargate.datacom:3128 (squid/2.6.STABLE5) Original-Xref: news.stanford.edu gnu.emacs.help:162890 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:58231 Archived-At: I've written this helper function: (defun bind-string-match (regexp string &optional start) (let ((ret (string-match regexp string start))) (when ret (catch 'end (dolist (i (number-sequence 1 10)) (let ((match (match-string i string))) (if match (eval `(setq ,(intern (concat "$" (number-to-string i))) ,match)) (throw 'end t)))))) ret)) so that I can access the match groups with $1.. instead of (match- string 1 string). Is there any recommendation against this type of functions? Other than polluting the global namespace? Also, can one rewrite it without the `eval'? TIA, weber PS: I'm not a Perl programmer!