all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* "\":Converting "dired-do-rename-regexp" into a "query-replace"?
@ 2010-01-29 23:26 David Combs
  2010-01-30 16:46 ` Andreas Röhler
  0 siblings, 1 reply; 2+ messages in thread
From: David Combs @ 2010-01-29 23:26 UTC (permalink / raw)
  To: help-gnu-emacs

Subj: "\\":Converting "dired-do-rename-regexp" into a "query-replace"?

I need to turn this:

    (dired-do-rename-regexp "Lendman_1_\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)_100000.mp3"     "\\3\\1\\2-S.L.mp3")

into:

    (query-replace-regexp   "FROMPAT"  "TO-STRING"    nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end)))


(the dired one works fine; now I want to adjust the regexps, but test them in an ascii file, not as file-names in dired.)

So, once I did that, how to convert it BACK into the dired-form>?

Thanks!

David




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

* Re: "\":Converting "dired-do-rename-regexp" into a "query-replace"?
  2010-01-29 23:26 "\":Converting "dired-do-rename-regexp" into a "query-replace"? David Combs
@ 2010-01-30 16:46 ` Andreas Röhler
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Röhler @ 2010-01-30 16:46 UTC (permalink / raw)
  To: help-gnu-emacs

David Combs wrote:
> Subj: "\\":Converting "dired-do-rename-regexp" into a "query-replace"?
>
> I need to turn this:
>
>     (dired-do-rename-regexp "Lendman_1_\\([0-9][0-9]\\)\\([0-9][0-9]\\)\\([0-9][0-9]\\)_100000.mp3"     "\\3\\1\\2-S.L.mp3")
>
> into:
>
>     (query-replace-regexp   "FROMPAT"  "TO-STRING"    nil (if (and transient-mark-mode mark-active) (region-beginning)) (if (and transient-mark-mode mark-active) (region-end)))
>   

Hi,
didn't check your forms limiting the search, assuming it works,

IIUC your question, use:

(while
    (query-replace-regexp YOUR-FIRST-REGEXP (if (and transient-mark-mode
mark-active) (region-beginning)) (if (and transient-mark-mode
mark-active) (region-end)) t 1)
  (replace-match (concat (match-string-no-properties 3)
(match-string-no-properties 1) (match-string-no-properties 2) "-S.L.mp3")))

HTH

Andreas

--
https://code.launchpad.net/s-x-emacs-werkstatt/

>
> (the dired one works fine; now I want to adjust the regexps, but test them in an ascii file, not as file-names in dired.)
>
> So, once I did that, how to convert it BACK into the dired-form>?
>
> Thanks!
>
> David
>
>
>
>   





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

end of thread, other threads:[~2010-01-30 16:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-29 23:26 "\":Converting "dired-do-rename-regexp" into a "query-replace"? David Combs
2010-01-30 16:46 ` Andreas Röhler

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.