diff options
author | Tassilo Horn <tassilo@member.fsf.org> | 2007-08-15 08:01:00 +0000 |
---|---|---|
committer | Tassilo Horn <tassilo@member.fsf.org> | 2007-08-15 08:01:00 +0000 |
commit | eb8dcf8d1fa030351093571714cf55cc8c73fa1b (patch) | |
tree | 8cb118a07ae5cbca4afe99f4146361acea91352a /emms-history.el | |
parent | f8ba8c3683f3119e25f33d700cb900697716618b (diff) |
refinements-and-docs-for-emms-history.dpatch
This path makes some refinements in emms-history.el:
- Start playback after `emms-history-load' only if
`emms-history-start-playing' is non-nil.
- Added customization group emms-history
- defvar -> defcustom
- better docstrings and commentary
- Added Info docs. (Node "Persistent Playlists")
darcs-hash:20070815080114-c06f4-fbe6c254a5dade4d6a99130fb2cc43c277ef6311.gz
Diffstat (limited to 'emms-history.el')
-rw-r--r-- | emms-history.el | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/emms-history.el b/emms-history.el index b3b9f0c..153e43a 100644 --- a/emms-history.el +++ b/emms-history.el @@ -1,4 +1,4 @@ -;;; emms-history.el -- save playlist when exit emacs +;;; emms-history.el -- save all playlists when exiting emacs ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc. ;; @@ -22,25 +22,42 @@ ;;; Commentary: -;; Save playlists when exit emacs. -;; Next time use M-x emms-history-load to load saved playlist +;; Saves all playlists when you close emacs. When you start it up again use +;; M-x emms-history-load to restore all saved playlists. -;; Put this file into your load-path and the following into your ~/.emacs: +;; To use it put the following into your ~/.emacs: +;; ;; (require 'emms-history) +;; +;; If all playlists should be restored on startup add this, too: +;; +;; (emms-history-load) ;;; Code: -(provide 'emms-history) (require 'emms) (eval-when-compile (require 'cl)) -(defvar emms-history-file "~/.emacs.d/.emms-history" - "File to save playlists") +(defgroup emms-history nil + "Saving and restoring all playlists when closing/restarting +Emacs." + :prefix "emms-history-" + :group 'emms) + +(defcustom emms-history-file "~/.emacs.d/emms-history" + "The file to save playlists in." + :type 'string + :group 'emms-history) + +(defcustom emms-history-start-playing nil + "If non-nil emms starts playing the current track after +`emms-history-load' was invoked." + :type 'boolean + :group 'emms-history) (defun emms-history-save () - "Save all playlists that open in this emacs session when exit. Use -`emms-history-load' to load saved playlists." + "Save all playlists that are open in this Emacs session." (interactive) (when (stringp emms-history-file) (let ((oldbuf emms-playlist-buffer) @@ -80,6 +97,7 @@ (add-hook 'kill-emacs-hook 'emms-history-save) (defun emms-history-load () + "Restore all playlists in `emms-history-file'." (interactive) (when (and (stringp emms-history-file) (file-exists-p emms-history-file)) @@ -100,6 +118,8 @@ (dolist (method (nth 2 history)) (set (car method) (cdr method))) (ignore-errors - (emms-start)))))) + (when emms-history-start-playing + (emms-start))))))) +(provide 'emms-history) ;;; emms-history.el ends here |