diff options
-rw-r--r-- | lisp/emms-tag-editor.el | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lisp/emms-tag-editor.el b/lisp/emms-tag-editor.el index 23e45f9..85baf7d 100644 --- a/lisp/emms-tag-editor.el +++ b/lisp/emms-tag-editor.el @@ -355,21 +355,34 @@ changes will only take effect on the tracks in the region." (map-y-or-n-p (lambda (match) (move-overlay overlay (match-beginning 0) (match-end 0)) - (format "Replace %s to %s" match to)) + (format "Replace %s to %s" (car match) (cadr match))) (lambda (match) - (delete-region (- (point) (length match)) (point)) - (insert to)) + (delete-region (- (point) (length (car match))) (point)) + (insert (cadr match))) (lambda () (if (and (save-excursion (re-search-backward tag (line-beginning-position) t)) + (not (= (point) (line-end-position))) (re-search-forward from (line-end-position) t)) - (match-string 0) + (list (match-string 0) (cond + ((and (listp to) + (fboundp (car to)) (funcall (car to) (cdr to) 0))) + ((string-match-p "\\\\[&[:digit:]]" to) + (match-substitute-replacement to nil nil)) + ((stringp to) to) + (t (error "Wrong type argument: string or cons cell, %s" to)))) (let (found) (while (and (not found) (re-search-forward tag nil t)) (if (re-search-forward from (line-end-position) t) (setq found t))) - (and found (match-string 0)))))))) + (and found (list (match-string 0) (cond + ((and (listp to) + (fboundp (car to)) (funcall (car to) (cdr to) 0))) + ((string-match-p "\\\\[&[:digit:]]" to) + (match-substitute-replacement to nil nil)) + ((stringp to) to) + (t (error "Wrong type argument: string or cons cell, %s" to))))))))))) (delete-overlay overlay)))) (defun emms-tag-editor-transpose-tag (tag1 tag2) |