all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* query-replace-regexp-yank
@ 2007-01-15  9:15 Andreas Roehler
  2007-01-15 19:42 ` query-replace-regexp-yank Andreas Roehler
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Roehler @ 2007-01-15  9:15 UTC (permalink / raw)



Hi all,

Lets assume, expression

 `  (interactive "*p\np")'

shall be catched by `isearch-forward-regexp'
and changed by `query-replace-regexp'

In the first case I could copy this list at place and yank it via
M-y into the minibuffer, where it will be taken by
search-function. Thus I can do repeated C-M-s to find all the
designated lists in buffer.

If I try to change them, calling `query-replace-regexp', M-y
works too, but no match afterwards.

Thats because in the first case backlashes and `*` are provided
with a (second) backlash to escape them.

Is there a way to procede that way with `query-replace-regexp'
yanked search-input too?

At the moment I use `isearch-yank-kill' to insert
regexps into the `query-replace-regexp' minibuffer to
have them quoted as necessary.

Thanks

__
Andreas Roehler

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: query-replace-regexp-yank
  2007-01-15  9:15 query-replace-regexp-yank Andreas Roehler
@ 2007-01-15 19:42 ` Andreas Roehler
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Roehler @ 2007-01-15 19:42 UTC (permalink / raw)



>
> At the moment I use `isearch-yank-kill' to insert
> regexps into the `query-replace-regexp' minibuffer to
> have them quoted as necessary.

It seems `query-replace-regexp' handles termes with
backslashes now not due `isearch-yank-kill' but as a
result of an `regexp-quote' inserted into
`query-replace-read-from' - see the diff below.

As an uncomfortable side-effect, however, terms
delivered by `query-replace-history' in a following
query are quoted again and again,  are no longer
usable. So this isn't a solution still.

diff -bc --suppress-common-lines 
/usr/local/share/emacs/22.0.92/lisp/replace.el replace.el
*** /usr/local/share/emacs/22.0.92/lisp/replace.el    2007-01-15 
11:36:52.000000000 +0100
--- replace.el    2007-01-15 16:26:25.000000000 +0100
***************
*** 101,110 ****
        (car (if regexp-flag regexp-search-ring search-ring))
      (let* ((history-add-new-input nil)
         (from
-         ;; The save-excursion here is in case the user marks and copies
-         ;; a region in order to specify the minibuffer input.
-         ;; That should not clobber the region for the query-replace 
itself.
          (save-excursion
            (read-from-minibuffer
             (if query-replace-defaults
             (format "%s (default %s -> %s): " prompt
--- 101,110 ----
        (car (if regexp-flag regexp-search-ring search-ring))
      (let* ((history-add-new-input nil)
         (from
           (save-excursion
+            ;; 2007-01-15 a.roehler@web.de changed section start          
+            (regexp-quote
+         ;; 2007-01-15 a.roehler@web.de changed section end       
             (read-from-minibuffer
          (if query-replace-defaults
              (format "%s (default %s -> %s): " prompt
***************
*** 114,119 ****
--- 114,122 ----
          nil nil nil
          query-replace-from-history-variable
          nil t))))
+        ;; 2007-01-15 a.roehler@web.de changed section start      
+        )
+       ;; 2007-01-15 a.roehler@web.de changed section end     
        (if (and (zerop (length from)) query-replace-defaults)
        (cons (car query-replace-defaults)
          (query-replace-compile-replacement

__
Andreas Roehler

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-15 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-15  9:15 query-replace-regexp-yank Andreas Roehler
2007-01-15 19:42 ` query-replace-regexp-yank Andreas Roehler

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.