Previous: Displaying Covers, Up: The Browser


20.4 Changing Looks

The Browser's look can be customised. You can change the way the tree structure looks, the display format and display faces.

Changing Tree Structure

You can change the way the tree is displayed by modifying the function emms-browser-next-mapping-type.

The following code displays artist->track instead of artist->album->track when you switch to the 'singles' filter:

     (defadvice emms-browser-next-mapping-type
                                     (after no-album (current-mapping))
       (when (eq ad-return-value 'info-album)
         (setq ad-return-value 'info-title)))
     (defun toggle-album-display ()
       (if (string= emms-browser-current-filter-name "singles")
           (ad-activate 'emms-browser-next-mapping-type)
         (ad-deactivate 'emms-browser-next-mapping-type)))
     
     (add-hook 'emms-browser-filter-changed-hook 'toggle-album-display)

Changing Display Format

Format strings govern the way items are displayed in the browser and playlist. You can customize these if you wish.

emms-browser-default-format controls the format to use when no other format has been explicitly defined. By default, only track and albums deviate from the default.

To customise the format of a particular type, find the name of the field you want to use (eg `info-artist', `info-title', etc), and insert that into emms-browser-<type>-format or emms-browser-playlist-<type>-format. For example, if you wanted to remove track numbers from tracks in both the browser and playlist, you could do:

     (defvar emms-browser-info-title-format "%i%n")
     (defvar emms-browser-playlist-info-title-format
       emms-browser-info-title-format)

The format specifiers available include:

Note that if you use track-related items like %t, it will take the data from the first track.

Changing Display Faces

The faces used to display the various fields are also customizable. They are in the format emms-browser-<type>-face, where type is one of "year/genre", "artist", "album" or "track". Note that faces lack the initial "info-" part. For example, to change the artist face, type M-x customize-face emms-browser-artist-face.