branch: elpa/subed
commit dc85d2cbcb82e1a6858afc50c931d9873deda941
Author: Sacha Chua <[email protected]>
Commit: Sacha Chua <[email protected]>

    subed-set-subtitle-comment-to-region-text
    
    * subed/subed-common.el (subed-set-subtitle-comment-to-region-text):
    New command. This makes defining chapters easier.
---
 subed/subed-common.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/subed/subed-common.el b/subed/subed-common.el
index 49306a1654..9c7e0e4a90 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -776,6 +776,19 @@ before including them."
               end)
              include-comments)))
 
+
+(defun subed-set-subtitle-comment-to-region-text (beg end)
+  "Set the subtitle comment to the text from BEG to END."
+  (interactive (if (region-active-p)
+                   (list (region-beginning)
+                         (region-end))
+                 (list (subed-subtitle-start-pos)
+                       (subed-subtitle-end-pos))))
+  (save-excursion
+    (goto-char beg)
+    (subed-set-subtitle-comment
+     (subed-subtitle-list-text (subed-subtitle-list beg end)))))
+
 (defvar subed-section-comments-as-chapters-functions nil
   "Functions to call with the the subtitle list.
 Return a filtered subtitle list.")

Reply via email to