branch: elpa/helm commit 119d1d2885f731febf0e83cf97f8c075f4038198 Author: Thierry Volpiatto <thie...@posteo.net> Commit: Thierry Volpiatto <thie...@posteo.net>
Improve query replace in fnames Allow incrementing inside the search and replace expression and not only after. --- helm-files.el | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/helm-files.el b/helm-files.el index d217a53c30..d5a2858d64 100644 --- a/helm-files.el +++ b/helm-files.el @@ -2416,14 +2416,12 @@ COUNT is used for incrementing new name if needed." ;; replacement with \# in ;; search and replace ;; feature in placeholder \@. - (string-match - "\\\\@/\\(.*\\)/\\(\\(?99:.*\\)\\\\#\\)/" - rep) - (replace-regexp-in-string - (match-string 1 rep) - (concat (match-string 99 rep) - (format "%03d" (1+ count))) - target)) + (string-match "\\\\@/\\(.*\\)/\\(.*\\)/" rep) + (helm-aand (replace-regexp-in-string + "\\\\#" (format "%03d" (1+ count)) + (match-string 2 rep)) + (replace-regexp-in-string + (match-string 1 rep) it target))) ;; Incremental replacement ;; before or after \@. ((or (string-match "\\`\\\\#\\\\@\\'" rep) @@ -2448,15 +2446,6 @@ COUNT is used for incrementing new name if needed." (length target)) (t (string-to-number it)))) t t rep)) - ;; Search and replace in - ;; placeholder. Doesn't - ;; handle incremental here. - ((string-match "\\\\@/\\(.*\\)/\\(.*\\)/" rep) - (replace-match (replace-regexp-in-string - (match-string 1 rep) - (match-string 2 rep) - target t) - t t rep)) ;; Simple replacement by placeholder. ((string-match "\\\\@" rep) (replace-match target t t rep))