[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emms-patches] darcs patch: automatically-save-and-restore-playlists...
From: |
Michael Olson |
Subject: |
[Emms-patches] darcs patch: automatically-save-and-restore-playlists... (and 1 more) |
Date: |
Tue, 14 Aug 2007 10:08:04 -0400 |
Tue Aug 14 06:27:43 EDT 2007 Tassilo Horn <address@hidden>
* automatically-save-and-restore-playlists.dpatch
This patch adds a new module `emms-playlist-restore' (plus documentation) that
saves all your playlists when you kill emacs and restores them when you start
it up again. Simply put
(require 'emms-playlist-restore)
into your ~/.emacs.
Tue Aug 14 10:06:43 EDT 2007 Michael Olson <address@hidden>
* emms-playlist-restore: Fix compilation and XEmacs issues
New patches:
[automatically-save-and-restore-playlists.dpatch
Tassilo Horn <address@hidden>**20070814102743
This patch adds a new module `emms-playlist-restore' (plus documentation) that
saves all your playlists when you kill emacs and restores them when you start
it up again. Simply put
(require 'emms-playlist-restore)
into your ~/.emacs.
] {
hunk ./NEWS 3
- -
+ - Automatic save and restore all playlists on emacs quit/startup.
+ See (info "(emms)Restoring Playlists").
addfile ./emms-playlist-restore.el
hunk ./emms-playlist-restore.el 1
+;;; emms-playlist-restore.el --- Saves all playlist when closing emacs and
+;;; restores them on startup.
+
+;; Copyright (C) 2007 Free Software Foundation, Inc.
+
+;; Author: Tassilo Horn <address@hidden>
+
+;; Keywords: emms, mp3, mpeg, multimedia
+
+;; This file is part of EMMS.
+
+;; EMMS is free software; you can redistribute it and/or modify it under the
+;; terms of the GNU General Public License as published by the Free Software
+;; Foundation; either version 3, or (at your option) any later version.
+
+;; EMMS is distributed in the hope that it will be useful, but WITHOUT ANY
+;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+;; details.
+
+;; You should have received a copy of the GNU General Public License along with
+;; EMMS; see the file COPYING. If not, write to the Free Software Foundation,
+;; Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This code saves all your playlists when closing Emacs and restores them when
+;; you start it up again.
+
+;;; Usage:
+
+;; All you have to do is to put
+;;
+;; (require 'emms-playlist-restore)
+;;
+;; into your ~/.emacs.
+
+;;; Code:
+
+(defvar emms-playlist-restore-directory "~/.emacs.d/emms-playlists"
+ "When closing Emacs all emms playlist will be saved in this directory.
+If you want to customize this directory be sure to set this
+variable before you require emms-playlist-restore.")
+
+(defvar emms-playlist-restore-suffix ".emms-playlist"
+ "Suffix used for playlists.
+If you want to customize this suffix be sure to set this variable
+before you require emms-playlist-restore.")
+
+(when (not (file-exists-p emms-playlist-restore-directory))
+ (make-directory emms-playlist-restore-directory t))
+
+(defun emms-playlist-restore-delete-all ()
+ "Delete all playlist files in `emms-playlist-restore-directory'."
+ (let ((files (directory-files emms-playlist-restore-directory
+ t
+ (concat
+ (regexp-quote emms-playlist-restore-suffix)
"$"))))
+ (dolist (file files)
+ (delete-file file))))
+
+(defun emms-playlist-restore-save-all ()
+ "Save all playlists in `emms-playlist-restore-directory'."
+ (interactive)
+ (emms-playlist-restore-delete-all)
+ (dolist (buf (emms-playlist-buffer-list))
+ (emms-playlist-set-playlist-buffer buf)
+ (emms-playlist-save 'native
+ (format "%s/%s%s"
+ emms-playlist-restore-directory
+ (buffer-name buf)
+ emms-playlist-restore-suffix))))
+
+(defun emms-playlist-restore-all ()
+ "Restore all non-empty playlists in
+`emms-playlist-restore-directory'."
+ (interactive)
+ (let ((files (directory-files emms-playlist-restore-directory
+ t
+ (concat
+ (regexp-quote emms-playlist-restore-suffix)
"$")))
+ current)
+ (dolist (file files)
+ (when (with-temp-buffer
+ ;; Check if this playlist file contains a non-empty playlist.
+ (insert-file-contents file)
+ (read (current-buffer)))
+ (setq current (emms-playlist-new
+ (replace-regexp-in-string
+ (concat (regexp-quote emms-playlist-restore-suffix)
"$")
+ ""
+ (file-name-nondirectory file))))
+ (emms-playlist-set-playlist-buffer current)
+ (emms-add-playlist file)))))
+
+(add-hook 'kill-emacs-hook
+ 'emms-playlist-restore-save-all)
+
+(emms-playlist-restore-all)
+
+(provide 'emms-playlist-restore)
+;;; emms-playlist-restore.el ends here
hunk ./emms.texinfo 73
+* Restoring Playlists:: Restoring playlists on startup.
hunk ./emms.texinfo 1703
address@hidden Restoring Playlists
address@hidden Restoring Playlists
+
+If you want emms to save all your playlists when you close Emacs and to
+restore them when you start it up again, simply put this into your
address@hidden/.emacs}.
+
address@hidden
+(require 'emms-playlist-restore)
address@hidden lisp
+
+Note that empty playlists won't be restored.
+
+To tell emms where to store the playlists and what suffix to give the
+files, you can tweak these variables. Both have to be set
address@hidden you require @code{emms-playlist-restore}.
+
address@hidden emms-playlist-restore-directory
+The directory where the playlists will be saved. The default value is
+"~/.emacs.d/emms-playlists".
address@hidden defvar
+
address@hidden emms-playlist-restore-directory
+The suffix used for playlist files. The default value is
+".emms-playlist".
address@hidden defvar
+
}
[emms-playlist-restore: Fix compilation and XEmacs issues
Michael Olson <address@hidden>**20070814140643] {
hunk ./emms-playlist-restore.el 40
+(require 'emms-compat)
+(require 'emms-source-playlist)
+
hunk ./emms-playlist-restore.el 92
- (replace-regexp-in-string
+ (emms-replace-regexp-in-string
}
Context:
[emms-score.el: change score-file to something more sane
address@hidden
~/.emms can be an EMMS config file, whereas ~/.emacs.d/ is already used
to store the stream bookmarks file, so use it for the score file too.
]
[make-S-prefix-key-for-sorting-functions.dpatch
Tassilo Horn <address@hidden>**20070802200758]
[Fix compiler warning in emms-setup
Michael Olson <address@hidden>**20070723023532]
[emms-playlist-limit: Use standard enable/disable/toggle interface
Michael Olson <address@hidden>**20070723023452]
[emms-streams: New option emms-stream-repeat-p
Michael Olson <address@hidden>**20070723020304
Instead of assuming that everyone will want to automatically repeat a
streamlist if it runs out of tracks, make this controlled by the
`emms-stream-repeat-p' option, which defaults to nil.
]
[emms-player-mpd: Fix bug with selecting an individual URL track to play from a
streamlist
Michael Olson <address@hidden>**20070723015956]
[emms-player-mpd: Make callback arg for emms-player-mpd-sync-from-emms optional
Michael Olson <address@hidden>**20070723015722]
[emms-playlist-sort.el: Bind "s s" to emms-playlist-sort-by-score.
William Xu <address@hidden>**20070719065003]
[emms-setup.el: Enable emms-score in emms-devel.
William Xu <address@hidden>**20070717131538]
[emms-lyrics.el: Set default value for emms-lyrics-dir to ~/music/lyrics.
William Xu <address@hidden>**20070717100946]
[emms-playlist-sort.el: Remove emms-playlist-sort-prefix to make the
William Xu <address@hidden>**20070717095454
codes more clean. And steal "s" prefix key from
`emms-playlist-mode'. (An alternative for emms-playlist-mode could be
"v", same as XMMS)
]
[emms-playlist-limit.el: (define-emms-playlist-limit) Fix prompt string bug.
William Xu <address@hidden>**20070717082536]
[make-number-of-secs-to-seek-configurable.dpatch
Tassilo Horn <address@hidden>**20070712062052
Patch sent by "Alfred M. Szmidt" <address@hidden> in
<address@hidden> on the emms-users list (with
slight modifications).
]
[Avoid even the most remote possibility of a conflict with color-theme.el and
its very bad replace-in-string function
Michael Olson <address@hidden>**20070712211444]
[emms-playlist-limit.el: Add missing line: (define-emms-playlist-limit
info-title).
William Xu <address@hidden>**20070711071022]
[emms-playlist-limit.el: Minor updates.
William Xu <address@hidden>**20070709103714]
[emms-playlist-limit.el: Update Copyright to GPLv3.
William Xu <address@hidden>**20070708140012]
[emms-playlist-sort.el: Minor updates.
William Xu <address@hidden>**20070708120050]
[emms-playlist-limit.el: Redefine functions emms-playlist-limit-to-* with
William Xu <address@hidden>**20070708115907
macro: define-emms-playlist-limit.
]
[emms-playlist-limit.el: Add default value based on track at point for
William Xu <address@hidden>**20070708040809
emms-playlist-limit-to-*.
]
[New file: emms-playlist-limit.el. And minor updates to emms-playlist-sort.
William Xu <address@hidden>**20070705160221]
[emms-player-mplayer.el: Add "eng.srt", "chs.srt", "cht.srt" to
William Xu <address@hidden>**20070630124728
emms-player-mplayer-subtitle-extensions.
]
[Updated NEWS for post-3.0
address@hidden
[TAG 3.0
address@hidden
Patch bundle hash:
9f18a4939e48b2a936320d8a594cf81134155744
- [Emms-patches] darcs patch: automatically-save-and-restore-playlists... (and 1 more),
Michael Olson <=