0

I'm trying to use emms in emacs 29.4 for MacOSX Monterrey. Everything works fine except for playing files in nested folders. Here is my config:

;; MEDIA
;; EMMS
(emms-all)
(emms-default-players)
(emms-mode-line 1)
(emms-playing-time 1)
;; Source my music from my server:
(setq emms-source-file-default-directory "/Volumes/Coronila/Music"
      emms-playlist-buffer-name "*Music*"
      emms-info-asynchronously t
      emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find)

And here is the error message after execute emms-play-directory-tree and put the the directory tree:

Debugger entered--Lisp error: (error "No first track")
  signal(error ("No first track"))
  error("No first track")
  emms-playlist-first()
  emms-playlist-select-first()
  emms-playlist-current-select-first()
  emms-source-play(emms-source-directory "/Volumes/Coronila/Music")
  emms-play-directory("/Volumes/Coronila/Music")
  funcall-interactively(emms-play-directory "/Volumes/Coronila/Music")
  call-interactively(emms-play-directory record nil)
  command-execute(emms-play-directory record)
  execute-extended-command(nil "emms-play-directory" "emms-play-direc")
  funcall-interactively(execute-extended-command nil "emms-play-directory" "emms-play-direc")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

I've tried different ways to reproduce the directory tree without success. Any help or recommendation is welcome.

UPDATED: I am sorry I forgot to mention that I tried play my music tree using emms-play-directory and put the path of my music folder obtaining the above error:

Debugger entered--Lisp error: (error "No first track")
  signal(error ("No first track"))
  error("No first track")
  emms-playlist-first()
  emms-playlist-select-first()
  emms-playlist-current-select-first()
  emms-source-play(emms-source-directory "/Volumes/Coronila/Music")
  emms-play-directory("/Volumes/Coronila/Music")
  funcall-interactively(emms-play-directory "/Volumes/Coronila/Music")
  call-interactively(emms-play-directory record nil)
  command-execute(emms-play-directory record)
  execute-extended-command(nil "emms-play-directory" "emms-play-direc")
  funcall-interactively(execute-extended-command nil "emms-play-directory" "emms-play-direc")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

And I also tried using emms-play-directory-tree and put the path of music folder obtaining a similar error:

Debugger entered--Lisp error: (error "No first track")
  signal(error ("No first track"))
  error("No first track")
  emms-playlist-first()
  emms-playlist-select-first()
  emms-playlist-current-select-first()
  emms-source-play(emms-source-directory-tree "/Volumes/Coronila/Music/")
  emms-play-directory-tree("/Volumes/Coronila/Music/")
  funcall-interactively(emms-play-directory-tree "/Volumes/Coronila/Music/")
  call-interactively(emms-play-directory-tree record nil)
  command-execute(emms-play-directory-tree record)
  execute-extended-command(nil "emms-play-directory-tree" "emms-play-directory-tr")
  funcall-interactively(execute-extended-command nil "emms-play-directory-tree" "emms-play-directory-tr")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

My bad, I'm sorry for the confusion.

17
  • What does your *Music* buffer look like? I suspect it is empty. You probably want emms-play-directory-tree? See Basic Commands in the manual. Commented Aug 14, 2024 at 3:03
  • Yes. I run run emms-play-directory-tree and put the path to folder with my music file but the the above error appears. Commented Aug 14, 2024 at 5:20
  • Your backtrace shows that you are running emms-play-directory, not emms-play-directory-tree. emms-play-directory will only look in the specified directory, not in any subdirectories. emms-play-directory-tree will look in subdirectories as well. IIUC of course... Commented Aug 14, 2024 at 13:53
  • I tried both emms-play-directory and emms-play-directory-treeobtaining similar error. I updated the question, I am sorry for the poor clarity in my question. Commented Aug 15, 2024 at 19:25
  • Try evaluating the following form: (emms-source-file-directory-tree "/Volumes/Coronila/Music/ (emms-source-file-regex)). Just copy it into your *scratch* buffer and press C-j after the closing paren. Does it give you a list of files? Or is it empty? What does /Volumes/Coronila/Music contain? And just to make sure: I asked you if your *Music* buffer is empty - I assume so, but you have not confirmed that assumption. Please do. Commented Aug 15, 2024 at 19:58

2 Answers 2

0

The problem as touched by NickD is that any command that traverses a directory tree in emms requires the GNU version of the find command; specifically if emms-source-file-directory-tree-function is set to emms-source-file-directory-tree-find. OSX's default findcommand is other then the GNU version and neither is the GNU version preinstalled. You need to download the GNU version of find using brew install findutils and add the GNU find command to your path. See more about installing GNU Version of find on mac here.

Once GNU is the default version of find, restart Emacs and command related to directory trees should work again

1
  • I believe I followed your suggestions correctly, but I am still encountering the same error. Any additional suggestions would be appreciated. Commented Feb 16 at 2:09
0

[Just to close the loop - convert the rest of the comments into an answer.]

The OP tried emms-play-directory-tree (which is the correct function to call when you want to scan subdirectories - emms-play-directory returns eligible files in the specified directory only, not in subdirectories). However, the list he got back was empty.

That suggested that the mechanism that is used by emms-play-directory-tree just did not work at all. That mechanism calls the function emms-source-file-directory-tree to generate the list of files and then adds each file to the playlist.

emms-source-file-directory-tree does a funcall through the variable emms-source-file-directory-tree-function. The doc string of that variable is illuminating:

emms-source-file-directory-tree-function is a variable defined
in ‘emms-source-file.el’.

Its value is ‘emms-source-file-directory-tree-find’

*A function to call that searches in a given directory all files
that match a given regex. DIR and REGEX are the only arguments passed
to this function.

You have two build-in options:
‘emms-source-file-directory-tree-internal’ will work always, but might
be slow.
‘emms-source-file-directory-tree-find’ will work only if you have GNU
find, but it’s faster.

The reason for needing GNU find is that it can do the regular expression filtering through the option -iregex, and that option is used by emms. But the OP is running on OSX and did not have GNU find, so he was getting an error from find (that was suppressed) and an empty list as the result.

Following the suggestion from the doc string of changing the variable to the other built-in function emms-source-file-tree-internal, which is a Lisp implementation of a directory scanner (that is why it can be slower), eliminated the external dependency and solved the OP's problem. That can be done by customizing the variable or by adding

(setq emms-source-file-directory-tree-function 'emms-source-file-directory-tree-internal)

to the init file.


[Comment converted to an answer. This part of the answer is still relevant, despite the downvoter's opinion, but the OP's problem was a bit deeper.]

Your backtrace shows that you are running emms-play-directory, not emms-play-directory-tree. emms-play-directory will only look in the specified directory, not in any subdirectories. emms-play-directory-tree will look in subdirectories as well.

The doc string for emms-play-directory says:

An EMMS source for a whole directory tree - either DIR, or queried
from the user.

whereas the doc string for emms-play-directory-tree says:

An EMMS source for multiple directory trees - either DIR, or the
value of ‘emms-source-file-default-directory’.

I believe that both of these are misleading and should be reported as doc bugs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.