aboutsummaryrefslogtreecommitdiff
path: root/lisp/emms-tag-editor.el
diff options
context:
space:
mode:
authorYoni Rabkin <yrk@gnu.org>2016-08-01 11:43:48 -0400
committerYoni Rabkin <yrk@gnu.org>2016-08-01 11:43:48 -0400
commite63f143cce434aa17076ed6f437ed5bfd5db6d9d (patch)
tree9a2db46f79762fcac5dcbff066e6ebcf7de12e54 /lisp/emms-tag-editor.el
parent92b982757880ffbe37ef8b2e7d6166c5440d94f0 (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>.
Diffstat (limited to 'lisp/emms-tag-editor.el')
-rw-r--r--lisp/emms-tag-editor.el23
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)