From a5cea3ece7c46fdb0eb88cb1eb6013658fc9ff3d Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 1 May 2013 12:26:06 +0200 Subject: Show emms playing title in the mode-line --- emacs/site-lisp/oni.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'emacs/site-lisp/oni.el') diff --git a/emacs/site-lisp/oni.el b/emacs/site-lisp/oni.el index 544d215..2436e53 100644 --- a/emacs/site-lisp/oni.el +++ b/emacs/site-lisp/oni.el @@ -260,6 +260,20 @@ code. Found at http://xahlee.org/emacs/elisp_parse_time.html" (match-string 2 date-string) (match-string 1 date-string))) +(defun oni:mode-line-current-song () + "Extract current song information from a path. + +EMMS only shows me the absolute path of a song, this function +extracts the parts I want to know about." + (let* ((song (emms-track-name (emms-playlist-current-selected-track))) + (matchp (string-match "\\([^/]+\\)/\\([0-9]\\{4\\}\\) - \\(.+\\)/\\([0-9]\\{2,3\\}\\) - \\(.+\\)\\..\\{3,4\\}$" song)) + (band (substring song (match-beginning 1) (match-end 1))) + (year (substring song (match-beginning 2) (match-end 2))) + (album (substring song (match-beginning 3) (match-end 3))) + (track (substring song (match-beginning 4) (match-end 4))) + (title (substring song (match-beginning 5) (match-end 5)))) + (format "[%s - %s]" band title))) + (defun oni:move-beginning-of-dwim () "Move to beginning of line either after indentation or before." (interactive) -- cgit v1.2.3-54-g00ecf