emms-help
[Top][All Lists]
Advanced

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

[emms-help] Re: Tags replacement


From: Lucas Bonnet
Subject: [emms-help] Re: Tags replacement
Date: Wed, 06 Jul 2005 19:22:45 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Daniel 'NebuchadnezzaR' Dehennin <address@hidden> writes:
> Hello,
Hello

>
> Any idée ?


This totally untested function might do what you expect. Just copy it in
your .emacs, and be sure to put it after any require regarding EMMS, so
that it overrides the one defined in emms-tageditor.el

(defun emms-tageditor-replace-tags (&optional field regexp replace-with)
  "Replace REGEXP with REPLACE-WITH in the widgets matching FIELD."
  (interactive)
  (setq field (or field (intern (completing-read
                               "Select which tags to replace in: "
                               '(("all" . all) ("title" . title)
                                 ("artist" . artist) ("album" . album)
                                 ("note" . note))
                               nil t "title"))))
  (setq regexp (or regexp (read-from-minibuffer "Regexp to replace: ")))
  (setq replace-with (or replace-with (read-from-minibuffer (concat "Replace 
regexp " regexp " with: "))))
  (setq replace-with (if (string= replace-with "'downcase") 'downcase 
replace-with))
  ;; Having all input, let's continue to act on it.
  (when (and field regexp replace-with)
    ;; two cases, 'all or something else
    (if (equal field 'all)
        (progn
          ;; We need a sweep-search of all tag-fields
          (let ((tags '(title artist album note)))
            (while tags
              (emms-tageditor-replace-tag (car tags) regexp replace-with)
              (setq tags (cdr tags)))))
      ;; only search the field called field
      (emms-tageditor-replace-tag field regexp replace-with))
    ;; we've probably changed some widget values, so we need to make
    ;; them count.
    (widget-setup)))


Hope this helps

-- 
Lucas





reply via email to

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