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
Are you sure its not an xemacs or pico thing ?
> No apropos matches for 'replace-quote'
replace-quote has been in lisp/replace.el since 17 June 2004:
,----[ ChangeLog.11 ]
| 2004-06-17 David Kastrup <d...@gnu.org>
|
| * replace.el (query-replace-read-args): Only warn about use of \n
| and \t when we are doing a regexp replacement and the actual
| escaped character is n or t.
| (query-replace-regexp): Add \, and \# interpretation to
| interactive call and document it.
| (query-replace-regexp-eval, replace-match-string-symbols): Add \#
| as shortkey for replace-count.
| (replace-quote): New function for doubling backslashes.
`----