all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: help-gnu-emacs@gnu.org
Subject: Re: "\":Converting "dired-do-rename-regexp" into a "query-replace"?
Date: Sat, 30 Jan 2010 17:46:45 +0100	[thread overview]
Message-ID: <4B646275.3030005@easy-emacs.de> (raw)
In-Reply-To: <hjvqrb$3cl$1@panix1.panix.com>

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
>
>
>
>   





      reply	other threads:[~2010-01-30 16:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29 23:26 "\":Converting "dired-do-rename-regexp" into a "query-replace"? David Combs
2010-01-30 16:46 ` Andreas Röhler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B646275.3030005@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.