From 376b9ebede6cc8c6fbcd3d2ececaa7311d67a973 Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Tue, 2 Sep 2008 20:46:14 +0300 Subject: Ask before saving over an existing playlist file. As suggested on the mailing list, this feature can be turned off. The appropriate documentation has been added to the Emms manual. Signed-off-by: Yoni Rabkin --- doc/emms.texinfo | 11 +++++++---- lisp/emms-source-playlist.el | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/emms.texinfo b/doc/emms.texinfo index 54cd72d..f98aa03 100644 --- a/doc/emms.texinfo +++ b/doc/emms.texinfo @@ -758,8 +758,8 @@ An Emms source for multiple directory trees - either @var{dir}, or the value of @var{emms-source-file-default-directory}. @end defun @defun emms-source-playlist file -An EMMS source for playlists. See `emms-source-playlist-formats' for -a list of supported formats. +An EMMS source for playlists. See @var{emms-source-playlist-formats} +for a list of supported formats. @end defun @defun emms-source-playlist-native file An EMMS source for a native EMMS playlist file. @@ -845,7 +845,7 @@ buffer is also selected. @defun emms-playlist-save &optional format file Store the current playlist to FILE as the type FORMAT. The default -format is specified by `emms-source-playlist-default-format'. +format is specified by @var{emms-source-playlist-default-format}. @end defun The current Emms playlist buffer is stored in the variable @@ -1005,7 +1005,10 @@ Put the interactive playlist buffer at the end of the list of all buffers. @item C-x C-s @findex emms-playlist-save -Save the current playlist buffer to a file. +Save the current playlist buffer to a file. By default, Emms will ask +you for confirmation before overwriting an existing playlist. You can +silently overwrite existing playlist by setting +@var{emms-source-playlist-ask-before-overwrite} to nil. @item ? @findex describe-mode Describe the mode. diff --git a/lisp/emms-source-playlist.el b/lisp/emms-source-playlist.el index 35ed254..1aeaa9c 100644 --- a/lisp/emms-source-playlist.el +++ b/lisp/emms-source-playlist.el @@ -71,6 +71,12 @@ If this is nil, you will be prompted for a format to use." (symbol :tag "Other")) :group 'emms) +(defcustom emms-source-playlist-ask-before-overwrite t + "*Ask before saving over an existing playlist. +If this is nil, existig playlists will be quitely overwritten." + :type 'boolean + :group 'emms) + ;;; General playlist (defsubst emms-source-playlist-p-sym (format) @@ -139,7 +145,7 @@ The default format is specified by `emms-source-playlist-default-format'." (current-buffer)) (current-buffer)) (let ((backup-inhibited t)) - (write-file file)))) + (write-file file emms-source-playlist-ask-before-overwrite)))) (defun emms-source-playlist-determine-format (&optional parse-files) "Determine the playlist format of the current buffer. -- cgit v1.2.3