2 Configuring the mpdmacs Minor Mode

Before loading & enabling mpdmacs-mode, the reader will need to configure it with the location of the MPD instance to be controlled. If communications over TCP/IP are desired, set the following two variables:

User Option: mpdmacs-host

The hostname on which MPD is listening.

User Option: mpdmacs-port

The port at which MPD is listening.

If, however, the reader would prefer to communicate with MPD over its Unix socket:

User Option: mpdmacs-socket

The path of the Unix socket on which MPD is listening. If the TCP/IP socket is preferred, it is best to set this to nil: mpdmacs-mode will try the local socket first, if it exists.

mpdmacs supplies several interactive commands (see see below), with keybindings in mpdmacs-mode-keymap; you may want to map a chord you find convenient to that keymap like so:

(defun my-mpdmacs-hook ()
  (global-set-key "\C-c m" 'mpdmacs-mode-keymap))
(add-hook 'mpdmacs-mode-hook 'my-mpdmacs-hook)

Having installed & configured mpdmacs, load it as usual:

(require 'mpdmacs)

At this point, mpdmacs has done nothing: it needs to be explicitly enabled by calling mpdmacs-mode:

Command: mpdmacs-mode &optional ARG

Turn mpdmacs-mode on & off. Interactively, with no prefix argument, toggle the mode. A prefix argument enables the mode if the argument is positive, and disables it otherwise.

When called from Lisp, toggle the mode if the argument is toggle, disable the mode if the argument is a non-positive integer, and enables the mode otherwise (including if the argument is omitted or nil or a positive integer).

Enabling the minor mode will open a connection to your MPD server, begin monitoring its state for changes, and enable the caller to begin issuing commands.