From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Guido Van Hoecke Newsgroups: gmane.emacs.help Subject: using lisp in replacement string Date: Wed, 24 Dec 2014 15:25:20 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1419431159 32717 80.91.229.3 (24 Dec 2014 14:25:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Dec 2014 14:25:59 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 24 15:25:52 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y3msm-0005ar-Tm for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Dec 2014 15:25:49 +0100 Original-Received: from localhost ([::1]:48511 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3msm-0002Ol-2K for geh-help-gnu-emacs@m.gmane.org; Wed, 24 Dec 2014 09:25:48 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3msS-0002OB-UO for help-gnu-emacs@gnu.org; Wed, 24 Dec 2014 09:25:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y3msP-0007Fd-Gv for help-gnu-emacs@gnu.org; Wed, 24 Dec 2014 09:25:28 -0500 Original-Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:55988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y3msP-0007FX-Al for help-gnu-emacs@gnu.org; Wed, 24 Dec 2014 09:25:25 -0500 Original-Received: by mail-wi0-f175.google.com with SMTP id l15so13675048wiw.2 for ; Wed, 24 Dec 2014 06:25:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:subject; bh=J/+hICSEaiY6RV054P2uAf2Q9HFJaBdOYnovV0yoF+I=; b=MLCFg8b22e0uOZLcytghXDKJxD/oTUO+hiKH95wMVa6fyOJKPjsxSzHA/+dbhIkntp f8/G1XMTzGNhsCwBCMAy+OhSscxES6p/NECIfWLB/5eQi/DwjPrT3ejkdIDQ0nw48sAz Q0+xgbIfIQT1Y0oSEovdxfgd3cfUpC1DWFnNSzYLFNMsO1XNiJnYaqghxGgAIf+CdyD4 +MbQlri7ynf9iawXhBE1wN5z+KZea680tnIpCsXKdUiNv86qH2JGGpgLtT5lBqey70F8 8uKs7Nwv3DS6IMBReGoq5HTM1VcFzPhUc4gwwNvKToNnaxZewr0kWFF1aW7um8vCFFTL CSMw== X-Received: by 10.180.80.34 with SMTP id o2mr53024987wix.53.1419431124398; Wed, 24 Dec 2014 06:25:24 -0800 (PST) Original-Received: from zac (78-21-109-135.access.telenet.be. [78.21.109.135]) by mx.google.com with ESMTPSA id pu3sm31797426wjc.14.2014.12.24.06.25.22 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 24 Dec 2014 06:25:23 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22f X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:101709 Archived-At: Hi, I am trying to apply what I found in the Emacs manual -> Search (15 Searching and replacement) -> Replace (15.10 Replacement Commands) -> Regexp Replace (15.10.2 Regexp Replacement) "You can use Lisp expressions to calculate parts of the replacement string. To do this, write `\,' followed by the expression in the replacement string. Each replacement calculates the value of the expression and converts it to text without quoting (if it's a string, this means using the string's contents), and uses it in the replacement string in place of the expression itself." So I have a temp buffer with following content |2+6*21| |3*15| |7-3| and I want to replace the formulas between the '|' characters by the result of passing them to calc-eval: (replace-regexp "|\\([^|]*\\)|" \\,(calc-eval \\1) nil (point-min)(point-max)) but this causes Debugger entered--Lisp error: (void-variable \\) So I try it with single slash: (replace-regexp "|\\([^|]*\\)|" \,(calc-eval \\1) nil (point-min)(point-max)) and then I get : Symbol's value as variable is void: \, I got the distinct feeling I'm missing something very basic here... Please advise TIA, Guido