aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2006-04-01 19:18:00 +0000
committerMichael Olson <mwolson@gnu.org>2006-04-01 19:18:00 +0000
commitca867192b76b7e10f1672cdd1fa7862eb2f40341 (patch)
tree03c5e57077abc3ce33459ebbcd2b5961d7d7c7d4
parente9cfafc1da50e7ea469a3ed58add63b7785f09ae (diff)
emms-mode-line: Add toggle functions and autoload cookies.
darcs-hash:20060401191825-1bfb2-763dcaee4201c44565e113e516b844e448a0c4a1.gz
-rw-r--r--emms-mode-line-icon.el3
-rw-r--r--emms-mode-line.el26
2 files changed, 28 insertions, 1 deletions
diff --git a/emms-mode-line-icon.el b/emms-mode-line-icon.el
index d9ed9ff..04699f3 100644
--- a/emms-mode-line-icon.el
+++ b/emms-mode-line-icon.el
@@ -30,6 +30,7 @@
;; Code:
+(require 'emms-mode-line)
(defvar emms-mode-line-icon-color "black"
"Color of the little icon displayed in the mode-line.")
@@ -37,7 +38,7 @@
(defvar emms-mode-line-icon-before-format ""
"String to put before the icon, in the mode-line.
For example, if you want to have something like :
-[ <icon> Foo - The Foo Song ]
+\[ <icon> Foo - The Foo Song ]
You should set it to \"[\", and set emms-mode-line-format to \"%s ]\"")
(setq emms-mode-line-icon-image-cache
diff --git a/emms-mode-line.el b/emms-mode-line.el
index 8847fa0..0f12f72 100644
--- a/emms-mode-line.el
+++ b/emms-mode-line.el
@@ -67,12 +67,16 @@
(emms-track-description
(emms-playlist-current-selected-track))))))
+(defvar emms-mode-line-active-p nil
+ "If non-nil, emms mode line is active.")
+
(defvar emms-mode-line-initial-titlebar frame-title-format)
(defun emms-mode-line (arg)
"Turn on `emms-mode-line' if ARG is positive, off otherwise."
(interactive "p")
(or global-mode-string (setq global-mode-string '("")))
+ (setq emms-mode-line-active-p arg)
(if (and arg (> arg 0))
(progn
(add-hook 'emms-track-updated-functions 'emms-mode-line-alter)
@@ -92,6 +96,28 @@
(emms-mode-line-restore-titlebar)
(emms-mode-line-restore-mode-line)))
+;;;###autoload
+(defun emms-mode-line-enable ()
+ "Turn on `emms-mode-line'."
+ (interactive)
+ (emms-mode-line 1)
+ (message "emms mode line enabled"))
+
+;;;###autoload
+(defun emms-mode-line-disable ()
+ "Turn off `emms-mode-line'."
+ (interactive)
+ (emms-mode-line -1)
+ (message "emms mode line disabled"))
+
+;;;###autoload
+(defun emms-playing-time-toggle ()
+ "Toggle `emms-mode-line'."
+ (interactive)
+ (if emms-mode-line-active-p
+ (emms-mode-line-enable)
+ (emms-mode-line-disable)))
+
(defun emms-mode-line-alter (&optional track)
"Alter mode-line/titlebar.