Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Newbie question on replace-eval-replacement , replace-quote
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bolega  
View profile  
 More options Aug 26 2011, 12:33 am
Newsgroups: gnu.emacs.help, comp.emacs, gnu.emacs, comp.emacs.xemacs, comp.lang.lisp
Followup-To: gnu.emacs.help
From: bolega <gnuist...@gmail.com>
Date: Thu, 25 Aug 2011 21:33:47 -0700 (PDT)
Local: Fri, Aug 26 2011 12:33 am
Subject: Newbie question on replace-eval-replacement , replace-quote
While searching in groups, I came across the following discussion.

http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/c7...%2C%22+swap#a2afe24ce98ed739

which presents the following code.

,----
| (defun query-swap-regexp (regexp-a regexp-b)
|   "Swap A and B regexp matches in current buffer or region."
|   (interactive "sRegexp A: \nsRegexp B: ")
|   (let ((match-a (save-excursion
|                  (re-search-forward regexp-a nil t)
|                  (match-string 0)))
|         (match-b (save-excursion
|                  (re-search-forward regexp-b nil t)
|                  (match-string 0))))
|     (query-replace-regexp
|      (concat "\\(\\(" regexp-a "\\)\\|" regexp-b "\\)")
|      `(replace-eval-replacement
|        replace-quote
|        (if (match-string 2) ,match-b ,match-a))
|      nil
|      (if (and transient-mark-mode mark-active) (region-beginning))
|      (if (and transient-mark-mode mark-active) (region-end)))))
`----

I am find it hard to understand due to lack of any example or
documentation explaining the operations of

replace-eval-replacement
replace-quote

For the latter, emacs says

No apropos matches for 'replace-quote'

and for the former,

replace-eval-replacement is a compiled Lisp function in `replace'.
(replace-eval-replacement EXPRESSION REPLACE-COUNT)
not documented

I cant run the above and play with it.

Thank for any help.
Bolega


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »