Browse Source

Fix wrong handling of EMMS' current playlist buffer during export

The macro `with-current-emms-playlist' does not set the current playlist to the
current buffer, but instead switches to it.  Yes, that's reasonable, but not
what I thought it does.  Since I need the reverse (make the current buffer to
temporarily be the current playlist), we simply bind `emms-playlist-buffer' to
the value returned by `current-buffer'.

While we are at it, also make info loading synchronous by binding
`emms-info-asynchronously' to nil.
master
Daniel 9 months ago
parent
commit
015d218431
No known key found for this signature in database GPG Key ID: 1C7071A75BB72D64
  1. 21
      site-lisp/db-music.el

21
site-lisp/db-music.el

@ -188,17 +188,18 @@ OVERWRITE is non-nil."
(if (not (zerop return-code))
(error "%s" output)
(let ((emms-source-playlist-ask-before-overwrite (not overwrite))
(emms-temp-playlist-buffer (emms-playlist-new " *EMMS Playlist Export*")))
(emms-temp-playlist-buffer (emms-playlist-new " *EMMS Playlist Export*"))
(emms-info-asynchronously nil))
(with-current-buffer emms-temp-playlist-buffer
(emms-playlist-clear)
(dolist (track (split-string output "[\n\r]+"))
(emms-insert-file track))
(emms-playlist-sort-by-info-title)
(emms-playlist-sort-by-info-artist)
;; When writing the playlist, we simulate the current buffer to be
;; the current playlist, as otherwise `emms-playlist-save' will
;; ask for confirmation.
(with-current-emms-playlist
(let ((emms-playlist-buffer (current-buffer)))
(emms-playlist-clear)
(dolist (track (split-string output "[\n\r]+"))
(emms-insert-file track))
(emms-playlist-sort-by-info-title)
(emms-playlist-sort-by-info-artist)
;; When writing the playlist, we simulate the current buffer to be
;; the current playlist, as otherwise `emms-playlist-save' will
;; ask for confirmation.
(emms-playlist-save 'm3u file)))
(kill-buffer emms-temp-playlist-buffer)))))))

Loading…
Cancel
Save