emms-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [emms-help] [PATCH] Make cons cell usable when replacing a tag


From: Daniel Dehennin
Subject: Re: [emms-help] [PATCH] Make cons cell usable when replacing a tag
Date: Sun, 31 Jul 2016 17:57:00 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.5 (gnu/linux)

Here is a fixed version of the patch, thanks for comments.

The following changes since commit bec63d3ea62dafc4158c35abdf7e9180419a3f78:

  * Makefile: add .info suffix. (2016-07-09 12:33:04 -0400)

are available in the git repository at:

  git://git.baby-gnu.net/emms.git 
tags/feature/make-cons-cell-usable-in-emms-tag-editor-replace-in-tag

for you to fetch changes up to 103cf23d5c55c6876a0880951e1a7b80fa21ce1d:

  Make cons cell usable when replacing a tag (2016-07-31 17:39:08 +0200)

----------------------------------------------------------------
Make cons cell usable when replacing a tag

----------------------------------------------------------------
Daniel Dehennin (1):
      Make cons cell usable when replacing a tag

 lisp/emms-tag-editor.el | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/lisp/emms-tag-editor.el b/lisp/emms-tag-editor.el
index 6ed23f2..ad68cbf 100644
--- a/lisp/emms-tag-editor.el
+++ b/lisp/emms-tag-editor.el
@@ -349,21 +349,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)


-- 
Daniel Dehennin
Récupérer ma clef GPG: gpg --recv-keys 0xCC1E9E5B7A6FE2DF
Fingerprint: 3E69 014E 5C23 50E8 9ED6  2AAD CC1E 9E5B 7A6F E2DF

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]