[Top][All Lists]

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

[emms-help] "shy group" in regexp-opt and external tool "find"

From: William Xu
Subject: [emms-help] "shy group" in regexp-opt and external tool "find"
Date: Fri, 22 Feb 2008 18:02:35 +0900
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.91 (darwin)

regexp-opt supports "shy group" regexps (info "(elisp)Regexp Backslash"), 
while gnu "find" doesn't seem to support it. I have tested under macosx
and debian. Hence, our regex definition for some players are
problematic. For example:

| (define-emms-simple-player mplayer '(file url)
|   (regexp-opt '(".ogg" ".mp3" ".wav" ".mpg" ".mpeg" ".wmv" ".wma"
|                 ".mov" ".avi" ".divx" ".ogm" ".asf" ".mkv" "http://"; "mms://"
|                 ".rm" ".rmvb" ".mp4" ".flac" ".vob" ".m4a" ".ape"))
|   "mplayer" "-slave" "-quiet" "-really-quiet") 

regexp-opt would construct some shy groups in return value, when this is
later passed to external "find", "find" will not find some specific kind
of files, for instance ".ape" files.

Take a simple example, 

,----[ with shy group ]
| (shell-command-to-string
|  (format "find /tmp/ -type f -iregex %s"
|          (concat "\".*\\(" (regexp-opt '("avi" "ape")) "\\).*\"")))
| =>"/tmp/b.avi
| "

,----[ without shy group ]
| (shell-command-to-string
|  (format "find /tmp/ -type f -iregex %s"
|          (concat "\".*\\(" 
|                  (mapconcat 'regexp-quote
|                             '("avi" "ape")
|                             "\\|") 
|                  "\\).*\"")))
| =>
| "/tmp/a.ape
| /tmp/b.avi
| "

Right now I find mplayer and xine are defining regexps using regexp-opt,
which I will send patches fixing them. 



reply via email to

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