branch: elpa/subed
commit 905c9da310a3fa5f1394a26afb08500d868b92b6
Author: Sacha Chua <sa...@sachachua.com>
Commit: Sacha Chua <sa...@sachachua.com>

    subed-create-file: Save file automatically; subed-wpm: return list
    
    * subed/subed-common.el: Fix typo.
    (subed-wpm): Return a list including word count and minutes.
    (subed-create-file): Save file automatically.
---
 subed/subed-common.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/subed/subed-common.el b/subed/subed-common.el
index 89ee166307..66e0053e9f 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -2098,7 +2098,7 @@ if PRINT-MESSAGE is non-nil, display a message."
 
 (defun subed-wpm (&optional subtitles)
   "Display words per minute.
-Use SUBTITILES if specified."
+Use SUBTITLES if specified."
   (interactive)
   (setq subtitles (or subtitles (subed-subtitle-list)))
   (let (word-count
@@ -2118,7 +2118,8 @@ Use SUBTITILES if specified."
          (/ (* 1.0 word-count) minutes)
          word-count
          minutes)
-      (/ (* 1.0 word-count) minutes))))
+      (list (/ (* 1.0 word-count) minutes)
+            word-count minutes))))
 
 ;;; Trimming overlaps
 
@@ -2295,11 +2296,11 @@ If INIT-FUNC is non-nil, call that function to 
initialize."
   (when (and (file-exists-p filename) (not ok-if-exists))
     (error "File %s already exists" filename))
   (let ((subed-auto-play-media nil))
-    (find-file filename)
-    (erase-buffer)
-    (if init-func (funcall init-func))
-    (subed-auto-insert)
-    (subed-append-subtitle-list subtitles)))
+    (with-temp-file filename
+      (subed-guess-format filename)
+      (if init-func (funcall init-func))
+      (subed-auto-insert)
+      (subed-append-subtitle-list subtitles))))
 
 (defun subed-convert (format &optional include-comments)
   "Create a buffer with the current subtitles converted to FORMAT.

Reply via email to