unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* using lisp in replacement string
@ 2014-12-24 14:25 Guido Van Hoecke
  2014-12-24 14:27 ` Dmitry Gutov
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Guido Van Hoecke @ 2014-12-24 14:25 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <mailman.16672.1419431131.1147.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2014-12-29 17:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-24 14:25 using lisp in replacement string Guido Van Hoecke
2014-12-24 14:27 ` Dmitry Gutov
2014-12-24 14:40   ` Guido Van Hoecke
2014-12-24 14:52     ` Dmitry Gutov
     [not found]       ` <CAEySM9GB6z1yBJSy8AzwN4a6LK4KRQBYQZ2-fZRDtmQ0XTCYng@mail.gmail.com>
2014-12-24 16:25         ` Guido Van Hoecke
     [not found]         ` <mailman.16678.1419438348.1147.help-gnu-emacs@gnu.org>
2014-12-24 16:43           ` Barry Margolin
2014-12-24 21:36       ` ronaldo.mercado
2014-12-24 14:56 ` Nicolas Richard
2014-12-25  9:25 ` Andreas Röhler
2014-12-25 11:50   ` Guido Van Hoecke
     [not found] <mailman.16672.1419431131.1147.help-gnu-emacs@gnu.org>
2014-12-29  4:40 ` Emanuel Berg
2014-12-29 17:55   ` Guido Van Hoecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).