[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/subed 0e05076 072/389: subed-srt-sanitize: Properly trim t
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/subed 0e05076 072/389: subed-srt-sanitize: Properly trim trailing newlines |
Date: |
Fri, 3 Dec 2021 10:59:59 -0500 (EST) |
branch: elpa/subed
commit 0e05076f9fd057ea411a45d71bbc477d4639681d
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>
subed-srt-sanitize: Properly trim trailing newlines
---
subed/subed-srt.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index ca8318f..701a5b5 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -500,8 +500,8 @@ each subtitle."
(atomic-change-group
(save-match-data
(subed--save-excursion
- ;; Remove trailing whitespace from each line and empty lines from end
of buffer
- (delete-trailing-whitespace (point-min) nil)
+ ;; Remove trailing whitespace from each line
+ (delete-trailing-whitespace (point-min) (point-max))
;; Remove leading spaces and tabs from each line
(goto-char (point-min))
@@ -523,11 +523,13 @@ each subtitle."
(delete-region prev-sub-end (point))
(insert "\n\n"))))
- ;; Remove trailing newlines
+ ;; Two trailing newline if last subtitle text is empty,
+ ;; one trailing newline otherwise
(goto-char (point-max))
(subed-srt-move-to-subtitle-end)
- (when (looking-at "\n\\{2,\\}")
- (replace-match "\n"))
+ (unless (looking-at "\n\\'")
+ (delete-region (point) (point-max))
+ (insert "\n"))
;; Ensure there is one space before and after " --> "
(goto-char (point-min))
- [nongnu] elpa/subed dc60c27 060/389: subed-srt--subtitle-id-at-msecs: Try to ignore invalid time stamps, (continued)
- [nongnu] elpa/subed dc60c27 060/389: subed-srt--subtitle-id-at-msecs: Try to ignore invalid time stamps, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 0781285 061/389: Make mpv RPC socket and client buffer unique per buffer, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 2f86a8e 030/389: Add function: subed-srt--subtitle-text, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 17f3ae5 034/389: Add/fix tests for srt parsing changes, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed fb9354c 039/389: Adjust tests for subed-srt-move-to-subtitle-end, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 4e3e42f 044/389: subed-srt-sort: Wrap function body in atomic-change-group, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 33f27c5 063/389: Fix docstring, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 7932aee 066/389: subed-srt-sort: Sanitize before validating, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed dc771c8 067/389: Fix/Add tests, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 23156e3 071/389: subed-srt-subtitle-insert: Make argument optional, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 0e05076 072/389: subed-srt-sanitize: Properly trim trailing newlines,
ELPA Syncer <=
- [nongnu] elpa/subed 49e8e72 073/389: subed-srt-move-to-subtitle-end: Adjust docstring, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 473f041 077/389: Add ogv to video file extensions, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed bd4c44d 081/389: Fix typo, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed bd2c0e4 082/389: Add LICENSE, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 07c6b2b 083/389: Show more helpful error message if mpv isn't available, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 150a781 084/389: Rename *-move-to-* functions to *-jump-to-*, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d2d3532 085/389: Rename get-adjust-time to get-seconds-adjust, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 73d303d 087/389: Adjust some docstrings, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed f76f7ea 092/389: Add keybindings C-M-n and C-M-p to move subtitles, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d07bde4 093/389: Add moving subtitles to feature list and reword some stuff, ELPA Syncer, 2021/12/03