Function: mpc-quit
mpc-quit is an interactive and byte-compiled function defined in
mpc.el.gz.
Signature
(mpc-quit)
Documentation
Quit Music Player Daemon.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mpc.el.gz
(defun mpc-quit ()
"Quit Music Player Daemon."
(interactive)
(let* ((proc mpc-proc)
(bufs (mapcar #'cdr (if proc (process-get proc 'buffers))))
(wins (mapcar (lambda (buf) (get-buffer-window buf 0)) bufs))
(song-buf (mpc-songs-buf))
frames)
;; Collect all the frames where MPC buffers appear.
(dolist (win wins)
(when (and win (not (memq (window-frame win) frames)))
(push (window-frame win) frames)))
(if (and frames song-buf
(with-current-buffer song-buf mpc-previous-window-config))
(progn
(select-frame (car frames))
(set-window-configuration
(with-current-buffer song-buf mpc-previous-window-config)))
;; Now delete the ones that show nothing else than MPC buffers.
(dolist (frame frames)
(let ((delete t))
(dolist (win (window-list frame))
(unless (memq (window-buffer win) bufs) (setq delete nil)))
(if delete (ignore-errors (delete-frame frame))))))
;; Then kill the buffers.
(mapc #'kill-buffer bufs)
(mpc-status-stop)
(if proc (delete-process proc))))