.emacs.d/site-lisp/db-music.el
Daniel Borchmann 888e703448
[Music] Introduce ‘db/music’ and move code there
All music related functions that do not directly depend on EMMS will now go into
‘db/music’, with the intention that if we in the future replace EMMS with
something else, the API provided by ‘db/music’ will still be valid.  This does
not mean, however, that functions in ‘db/music’ may not use functions from EMMS.
2019-03-02 13:37:05 +01:00

36 lines
893 B
EmacsLisp
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;;; db-music.el -- Music related stuff -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
;; Custom playlist
(defun db/play-playlist ()
"Start playing songs from `db/playlist"
(interactive)
(require 'emms)
(save-window-excursion
(let ((music-buffer-name "*EMMS Playlist* -- Personal"))
(unless (get-buffer music-buffer-name)
(emms-playlist-new music-buffer-name))
(with-current-buffer (get-buffer music-buffer-name)
(emms-stop)
(emms-playlist-set-playlist-buffer)
(emms-playlist-current-clear)
(dolist (track db/playlist)
(when (eq :include (cdr track))
(emms-playlist-current-insert-source 'emms-insert-file (car track))))
(goto-char (point-min))
(emms-shuffle)
(emms-playlist-select-first)
(emms-start)))))
;; End
(provide 'db-music)
;;; db-music ends here