Daniel Dehennin <
daniel.dehennin@baby...> writes:
> Hello,
>
> Back in 2005[1], I tried to change the case of tags.
[...]
I finally manage to get it working, you can pull a signed tag[1] from my repository:
The following changes since commit 298e022d7fba7a991fcc9cf25306a7b8eb8a612e:
* lisp/emms-browser.el (emms-browser-track-duration): New function to allow custom browser track-formats to display track duration. (2011-04-25 18:51:28 +0200)
are available in the git repository at:
git://git.baby-gnu.net/emms cons-cell-usable-in-emms-tag-editor-replace-in-tag
for you to fetch changes up to 53f82af975bb76a8bef46ee3d3fa849da26d4fdf:
Make cons cell usable when replacing a tag and fix an end-of-line match loop. (2012-02-04 18:38:04 +0100)
----------------------------------------------------------------
As reported on the mailing list[1][2], it's not possible to use a cons
cell like "\,(downcase \1)" in emms-tag-editor-replace-in-tag.
After looking at how quer-replace-regexp handle this case, I patch
emms-tag-editor-replace-in-tag.
I also fix a bug when using a catch all regexp like "\(.*\)", the
generator will first try to match on the current line, to replace
multiple occurrences in the same string.
But '(re-search-forward "\\(.*\\)" (line-end-position) t)' will match
the end-of-line, making the replacement looping on the same line.
Footnotes:
[1]
http://lists.gnu.org/archive/html/emms-help/2005-07/msg00010.html[2]
https://lists.gnu.org/archive/html/emms-help/2012-01/msg00002.html----------------------------------------------------------------
Daniel Dehennin (1):
Make cons cell usable when replacing a tag and fix an end-of-line match loop.
lisp/emms-tag-editor.el | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
From 53f82af975bb76a8bef46ee3d3fa849da26d4fdf Mon Sep 17 00:00:00 2001
From: Daniel Dehennin <
daniel.dehennin@baby...>
Date: Sat, 4 Feb 2012 18:32:01 +0100
Subject: [PATCH] Make cons cell usable when replacing a tag and fix an
end-of-line match loop.
* lisp/emms-tag-editor.el (emms-tag-editor-replace-in-tag): Prevent
looping on the same line by matching end-of-line when at the end of the
line.
Make the "map-y-or-n-p" generator returning the matched string and the
calculated replacement and adapt the prompter and the actor
accordingly.
---
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 3eba673..339af1d 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" test))))
(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" test)))))))))))
(delete-overlay overlay))))
(defun emms-tag-editor-transpose-tag (tag1 tag2)
--
1.7.9.rc1
Footnotes:
[1]
http://lwn.net/Articles/475814/--
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1
_______________________________________________
Emms-help mailing list
Emms-help@gnu....https://lists.gnu.org/mailman/listinfo/emms-help
opensubscriber is not affiliated with the authors of this message nor responsible for its content.