From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: replace-regexp-in-string, using the dyn scoped variable STR Date: Wed, 11 Nov 2009 20:18:11 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1257967297 15779 80.91.229.12 (11 Nov 2009 19:21:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Nov 2009 19:21:37 +0000 (UTC) To: Emacs-Devel devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 11 20:21:30 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N8Iky-0003jO-Im for ged-emacs-devel@m.gmane.org; Wed, 11 Nov 2009 20:21:28 +0100 Original-Received: from localhost ([127.0.0.1]:40680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8Iky-00077w-1u for ged-emacs-devel@m.gmane.org; Wed, 11 Nov 2009 14:21:28 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N8IiE-00036c-T5 for emacs-devel@gnu.org; Wed, 11 Nov 2009 14:18:39 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N8Ii9-0002yI-JG for emacs-devel@gnu.org; Wed, 11 Nov 2009 14:18:37 -0500 Original-Received: from [199.232.76.173] (port=34679 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N8Ii9-0002xy-BL for emacs-devel@gnu.org; Wed, 11 Nov 2009 14:18:33 -0500 Original-Received: from mail-yx0-f191.google.com ([209.85.210.191]:56561) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N8Ii9-00037R-0I for emacs-devel@gnu.org; Wed, 11 Nov 2009 14:18:33 -0500 Original-Received: by yxe29 with SMTP id 29so1392466yxe.14 for ; Wed, 11 Nov 2009 11:18:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:from:date:message-id :subject:to:content-type; bh=6C7kDbWKOysPiFzF8yKGychKMsVrbPmX5SZvbg+WLPI=; b=D/J00PPOqvYvHRlx34NmiMVohqPSdO0kI2junx60JyJi71xfK5RPwR8/gSkqxNUzLU 3+JCYTX1r1qcDHLTioB3xgE8Ims4hTOQnOUWhCIciHlRQvgBd0Es5AmlKBOluX3JPdUJ qdiCwP0MHSrwe6xVSTylobcUkBksKuGAsj8A8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=tL6mfilyz0afvPqlY5ymSDDtyEWiCbMt8afg+NzCsRDPaozw+2Vnhu+xFkNuDqrbLK 3AF+rgzZv1ExSCQfyDKILSIho5uCPhrBV69hUvl/CoPhhkSjmNXUGcYrfLrm/6mO8BPg JZeTrhujO8qb6U1k0WDj8mO5a7O7bx531Gz88= Original-Received: by 10.101.208.35 with SMTP id k35mr1972215anq.132.1257967111512; Wed, 11 Nov 2009 11:18:31 -0800 (PST) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116836 Archived-At: Sometimes it is necessary to use the variable str which is dynamically scoped in replace-regexp-in-string. Below is an example of this. Could we please document the use of str (and perhaps name it quite differently)? Example: ;;(test-org-freemind-unescape-str-to-org "mA≌B<C<=") ;;(test-org-freemind-unescape-str-to-org "<<") (defun test-org-freemind-unescape-str-to-org (fm-str) (let ((org-str fm-str)) (setq org-str (replace-regexp-in-string "&#x\\([a-f0-9]\\{2,4\\}\\);" (lambda (m) (char-to-string ;; Note: str is scoped dynamically from ;; `replace-regexp-in-string'. (+ (string-to-number (match-string 1 str) 16) 0 ))) org-str))))