diff options
author | Yoni Rabkin <yrk@gnu.org> | 2016-08-01 11:43:48 -0400 |
---|---|---|
committer | Yoni Rabkin <yrk@gnu.org> | 2016-08-01 11:43:48 -0400 |
commit | e63f143cce434aa17076ed6f437ed5bfd5db6d9d (patch) | |
tree | 9a2db46f79762fcac5dcbff066e6ebcf7de12e54 | |
parent | 92b982757880ffbe37ef8b2e7d6166c5440d94f0 (diff) |
* lisp/emms-tag-editor.el: Make cons cell usable.
Make cons cell usable when replacing a tag. Patch by Daniel Dehennin
<daniel.dehennin@baby-gnu.org>.
-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) |