emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/subed 7842bb9f15 2/2: Clean up warnings


From: ELPA Syncer
Subject: [nongnu] elpa/subed 7842bb9f15 2/2: Clean up warnings
Date: Fri, 18 Nov 2022 11:59:44 -0500 (EST)

branch: elpa/subed
commit 7842bb9f15f08ea3d223f98bf7be98d6d01be522
Author: Sacha Chua <sacha@sachachua.com>
Commit: Sacha Chua <sacha@sachachua.com>

    Clean up warnings
---
 NEWS.org              |   4 ++
 subed/subed-ass.el    |  20 ++++++----
 subed/subed-common.el | 102 ++++++++++++++++++++++++++++++--------------------
 subed/subed-config.el |  13 ++++---
 subed/subed-debug.el  |   6 ++-
 subed/subed-mpv.el    |   4 ++
 subed/subed-srt.el    |  26 +++++++------
 subed/subed-vtt.el    |  16 ++++----
 subed/subed.el        |   8 +++-
 9 files changed, 123 insertions(+), 76 deletions(-)

diff --git a/NEWS.org b/NEWS.org
index 6a49f5e89d..f84274e536 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -2,6 +2,10 @@
 
 * subed news
 
+** Version 1.0.24 - 2022-11-18 - Sacha Chua
+
+subed should compile without checkdoc warnings or obsolete functions now.
+
 ** Version 1.0.23 - 2022-11-18 - Sacha Chua
 
 You can now use ~subed-copy-region-text~ to copy the text from
diff --git a/subed/subed-ass.el b/subed/subed-ass.el
index f2ca52ccd9..4898af12b1 100644
--- a/subed/subed-ass.el
+++ b/subed/subed-ass.el
@@ -149,7 +149,8 @@ If SUB-ID is not given, use subtitle on point.  Return 
point or
 nil if no stop time could be found.  Use the format-specific
 function for MAJOR-MODE."
   (when (subed-jump-to-subtitle-id sub-id)
-    (re-search-forward (concat "\\(?:" subed--regexp-timestamp "\\),") 
(point-at-eol) t)
+    (re-search-forward (concat "\\(?:" subed--regexp-timestamp "\\),")
+                       (line-end-position) t)
     (when (looking-at subed--regexp-timestamp)
       (point))))
 
@@ -205,13 +206,14 @@ format-specific function for MAJOR-MODE."
 
 ;;; Manipulation
 
-(cl-defmethod subed--make-subtitle (&context (major-mode subed-ass-mode) 
&optional id start stop text comment)
+(cl-defmethod subed--make-subtitle (&context (major-mode subed-ass-mode)
+                                             &optional _ start stop text _)
   "Generate new subtitle string.
 
-ID, START default to 0.
+START default to 0.
 STOP defaults to (+ START `subed-subtitle-spacing')
 TEXT defaults to an empty string.
-COMMENT is ignored.
+The ID and comment are ignored.
 
 A newline is appended to TEXT, meaning you'll get two trailing
 newlines if TEXT is nil or empty.  Use the format-specific
@@ -222,7 +224,8 @@ function for MAJOR-MODE."
                                                 
subed-default-subtitle-length)))
           (replace-regexp-in-string "\n" "\\n" (or text ""))))
 
-(cl-defmethod subed--prepend-subtitle (&context (major-mode subed-ass-mode) 
&optional id start stop text comment)
+(cl-defmethod subed--prepend-subtitle (&context (major-mode subed-ass-mode)
+                                                &optional id start stop text 
comment)
   "Insert new subtitle before the subtitle at point.
 
 ID and START default to 0.
@@ -233,11 +236,12 @@ COMMENT is ignored.
 Move point to the text of the inserted subtitle.  Return new
 point.  Use the format-specific function for MAJOR-MODE."
   (subed-jump-to-subtitle-id)
-  (insert (subed-make-subtitle id start stop text))
+  (insert (subed-make-subtitle id start stop text comment))
   (forward-line -1)
   (subed-jump-to-subtitle-text))
 
-(cl-defmethod subed--append-subtitle (&context (major-mode subed-ass-mode) 
&optional id start stop text comment)
+(cl-defmethod subed--append-subtitle (&context (major-mode subed-ass-mode)
+                                               &optional id start stop text 
comment)
   "Insert new subtitle after the subtitle at point.
 
 ID, START default to 0.
@@ -251,7 +255,7 @@ point.  Use the format-specific function for MAJOR-MODE."
     ;; Point is on last subtitle or buffer is empty
     (subed-jump-to-subtitle-end)
     (unless (bolp) (insert "\n")))
-  (insert (subed-make-subtitle id start stop text))
+  (insert (subed-make-subtitle id start stop text comment))
   (forward-line -1)
   (subed-jump-to-subtitle-text))
 
diff --git a/subed/subed-common.el b/subed/subed-common.el
index 6dc0a55501..4899c48267 100644
--- a/subed/subed-common.el
+++ b/subed/subed-common.el
@@ -32,6 +32,7 @@
 (require 'subed-debug)
 (require 'subed-mpv)
 
+(declare-function subed-tsv-mode "subed-tsv" ())
 
 ;;; Generic functions
 
@@ -71,7 +72,7 @@ interactive form."
                  '("srt" "vtt" "ass"))
        ,(if is-interactive
             `(defun ,(intern (concat "subed-" (symbol-name name))) ,args
-               ,(concat doc "\n\nThis function calls the generic function `"
+               ,(concat doc "\n\nThis function calls the generic function\n`"
                         (concat "subed--" (symbol-name name)) "' for the 
actual implementation.")
                ,(car body)
                (,(intern (concat "subed--" (symbol-name name)))
@@ -341,7 +342,7 @@ If SUB-ID is not given, set the text of the current 
subtitle."
     (when start-point
       (- (point) start-point))))
 
-(subed-define-generic-function subtitle-comment (&optional sub-id)
+(subed-define-generic-function subtitle-comment (&optional _)
   "Return the comment preceding this subtitle."
   nil)
 
@@ -771,8 +772,9 @@ but we move the start time first."
         (move-subtitle msecs)))))
 
 (defun subed--scale-subtitles-in-region (msecs beg end)
-  "Scale subtitles in region specified by BEG and END after moving END MSECS 
milliseconds."
-  (let* ((beg-point (save-excursion ; normalized to fixed location over BEG
+  "Scale subtitles between BEG and END after moving END milliseconds.
+BEG and END specify a region."
+  (let* ((beg-point (save-excursion     ; normalized to fixed location over BEG
                       (goto-char beg)
                       (subed-jump-to-subtitle-end)
                       (point)))
@@ -780,7 +782,7 @@ but we move the start time first."
                            (goto-char beg-point)
                            (subed-forward-subtitle-end)
                            (point)))
-         (end-point (save-excursion ; normalized to fixed location over END
+         (end-point (save-excursion     ; normalized to fixed location over END
                       (goto-char end)
                       (subed-jump-to-subtitle-end)
                       (point)))
@@ -916,12 +918,25 @@ prefix argument is given but not numerical,
 `subed-milliseconds-adjust' is reset to its default value.
 
 Example usage:
-  \\[universal-argument] 1000 \\[subed-scale-subtitles-forward] Extend region 
1000ms forward in time and scale subtitles in region
-           \\[subed-scale-subtitles-forward] Extend region another 1000ms 
forward in time and scale subtitles again
-   \\[universal-argument] 500 \\[subed-scale-subtitles-forward] Extend region 
500ms forward in time and scale subtitles in region
-           \\[subed-scale-subtitles-forward] Extend region another 500ms 
forward in time and scale subtitles again
-       \\[universal-argument] \\[subed-scale-subtitles-forward] Extend region 
100ms (the default) forward in time and scale subtitles in region
-           \\[subed-scale-subtitles-forward] Extend region another 100ms (the 
default) forward in time and scale subtitles again"
+
+\\[universal-argument] 1000 \\[subed-scale-subtitles-forward]
+Extend region 1000ms forward in time and scale subtitles in region.
+
+\\[subed-scale-subtitles-forward]
+Extend region another 1000ms forward in time and scale subtitles again.
+
+\\[universal-argument] 500 \\[subed-scale-subtitles-forward]
+Extend region 500ms forward in time and scale subtitles in region.
+
+\\[subed-scale-subtitles-forward]
+Extend region another 500ms forward in time and scale subtitles again.
+
+\\[universal-argument] \\[subed-scale-subtitles-forward]
+Extend region 100ms (the default) forward in time and scale subtitles in 
region.
+
+\\[subed-scale-subtitles-forward]
+Extend region another 100ms (the default) forward in time
+and scale subtitles again."
   (interactive "P")
   (let ((deactivate-mark nil)
         (msecs (subed-get-milliseconds-adjust arg))
@@ -1205,7 +1220,7 @@ current subtitle."
     subed-mpv-playback-position))
 
 (defun subed-split-subtitle-based-on-point-ratio ()
-  "Return a timestamp based on the position and number of characters in the 
subtitle text."
+  "Return a timestamp based on the relative position in the subtitle text."
   (let* ((pos (point))
          (text-beg (or (save-excursion (subed-jump-to-subtitle-text)) pos))
          (text-end (or (save-excursion (subed-jump-to-subtitle-end)) pos)))
@@ -1283,7 +1298,7 @@ position of the point."
             (delete-region (point) (progn (subed-jump-to-subtitle-end) 
(skip-chars-forward " \t") (point)))
             (when (looking-at "[ \t]+") (replace-match ""))
             (subed-append-subtitle nil new-start-timestamp orig-end 
(string-trim new-text)))
-        (error "Could not determine timestamp for splitting.")))
+        (error "Could not determine timestamp for splitting")))
     (point)))
 
 ;;; Merging
@@ -1647,7 +1662,7 @@ and therefore gets ARGS, which is ignored."
 The optional EXTENSIONS argument can be a list of extensions to
 look for. If not, check against the extensions in
 `subed-video-extensions' and `subed-audio-extensions'.  The file
-extension of the `buffer-file-name' is replaced with each item in
+extension of the function `buffer-file-name' is replaced with each item in
 the extension list and the first existing file is returned.
 
 Language codes are also handled; e.g. \"foo.en.srt\" or
@@ -1678,17 +1693,18 @@ Return nil if function `buffer-file-name' returns nil."
   "History of HTML-like attributes in subtitles.")
 
 (defun subed-insert-html-tag (begin end tag &optional attributes)
-  "Insert a pair of HTML-like tags around the region.
+  "Insert a pair of HTML-like tags around the region using TAG.
+BEGIN and END specify the start of the region.
 If region is not active, insert a pair of tags and put the point
 between them.  If called with a prefix argument, also ask for
-attribute(s)."
+ATTRIBUTE(s)."
   (interactive (let* ((region-p (use-region-p))
-                     (begin (if region-p (region-beginning) (point)))
-                     (end (if region-p (region-end) (point)))
-                     (tag (read-string "Tag: " nil 'subed--html-tag-history))
-                     (attributes (when current-prefix-arg
-                                   (read-string "Attribute(s): " nil 
'subed--html-attr-history))))
-                (list begin end tag attributes)))
+                                 (begin (if region-p (region-beginning) 
(point)))
+                                 (end (if region-p (region-end) (point)))
+                                 (tag (read-string "Tag: " nil 
'subed--html-tag-history))
+                                 (attributes (when current-prefix-arg
+                                                           (read-string 
"Attribute(s): " nil 'subed--html-attr-history))))
+                            (list begin end tag attributes)))
   (save-excursion
     (push (point) buffer-undo-list)
     (goto-char end)
@@ -1699,29 +1715,34 @@ attribute(s)."
     (insert-before-markers ">")))
 
 (defun subed-insert-html-tag-italic (begin end)
-  "Insert a pair of <i> tags at point or around the region."
+  "Insert a pair of <i> tags at point or around the region.
+The region is defined by BEGIN and END."
   (interactive (let* ((region-p (use-region-p))
-                     (begin (if region-p (region-beginning) (point)))
-                     (end (if region-p (region-end) (point))))
-                (list begin end)))
+                                 (begin (if region-p (region-beginning) 
(point)))
+                                 (end (if region-p (region-end) (point))))
+                            (list begin end)))
   (subed-insert-html-tag begin end "i"))
 
 (defun subed-insert-html-tag-bold (begin end)
-  "Insert a pair of <b> tags at point or around the region."
+  "Insert a pair of <b> tags at point or around the region.
+The region is defined by BEGIN and END."
   (interactive (let* ((region-p (use-region-p))
-                     (begin (if region-p (region-beginning) (point)))
-                     (end (if region-p (region-end) (point))))
-                (list begin end)))
+                                 (begin (if region-p (region-beginning) 
(point)))
+                                 (end (if region-p (region-end) (point))))
+                            (list begin end)))
   (subed-insert-html-tag begin end "b"))
 
 ;;; Characters per second computation
 
+(defvar-local subed--cps-overlay nil)
+
 (defun subed-show-cps-p ()
   "Whether CPS is shown for the current subtitle."
   (member #'subed--update-cps-overlay post-command-hook))
 
 (defun subed-enable-show-cps (&optional quiet)
-  "Enable showing CPS next to the subtitle heading."
+  "Enable showing CPS next to the subtitle heading.
+If QUIET is nil, show a message."
   (interactive "p")
   ;; FIXME: Consider displaying CPS on all cues (via jit-lock) rather than the 
current one?
   (add-hook 'post-command-hook #'subed--update-cps-overlay nil t)
@@ -1731,7 +1752,8 @@ attribute(s)."
     (message "Enabled showing characters per second")))
 
 (defun subed-disable-show-cps (&optional quiet)
-  "Disable showing CPS next to the subtitle heading."
+  "Disable showing CPS next to the subtitle heading.
+If QUIET is nil, show a message."
   (interactive)
   (remove-hook 'post-command-hook #'subed--update-cps-overlay t)
   (remove-hook 'subed-subtitle-motion-hook 
#'subed--move-cps-overlay-to-current-subtitle t)
@@ -1761,7 +1783,8 @@ attribute(s)."
     (buffer-string)))
 
 (defun subed-calculate-cps (&optional print-message)
-  "Calculate characters per second of the current subtitle."
+  "Calculate characters per second of the current subtitle.
+if PRINT-MESSAGE is non-nil, display a message."
   (interactive "p")
   (let* ((msecs-start (ignore-errors (subed-subtitle-msecs-start)))
               (msecs-stop (ignore-errors (subed-subtitle-msecs-stop)))
@@ -1776,8 +1799,6 @@ attribute(s)."
              (message "%.1f characters per second" cps)
            cps)))
 
-(defvar-local subed--cps-overlay nil)
-
 (defun subed--move-cps-overlay-to-current-subtitle ()
   "Move the CPS overlay to the current subtitle."
   (unless subed--batch-editing
@@ -1884,7 +1905,7 @@ the stop time isn't smaller than the start time."
        t))))
 
 (defun subed-trim-overlap-next-start (&optional msecs ignore-negative-duration)
-  "Trim the next subtitle so that it starts after the current one.
+  "Trim the next subtitle to start after the current one.
 
 Trim the start time of the next subtitle to MSECS or
 `subed-subtitle-spacing' greater than the end time of the current
@@ -1963,15 +1984,16 @@ If LIST is nil, use the subtitles in the current 
buffer."
   (interactive)
   nil)
 
-(defun subed-create-file (filename subtitles &optional ok-if-exists mode)
+(defun subed-create-file (filename subtitles &optional ok-if-exists init-func)
   "Create FILENAME, set it to MODE, and prepopulate it with SUBTITLES.
-Overwrites existing files."
+If OK-IF-EXISTS is non-nil, overwrite existing files.
+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))
+    (error "File %s already exists" filename))
   (let ((subed-auto-play-media nil))
     (find-file filename)
     (erase-buffer)
-    (if mode (funcall mode))
+    (if init-func (funcall init-func))
     (subed-auto-insert)
     (mapc (lambda (sub) (apply #'subed-append-subtitle nil (cdr sub))) 
subtitles)))
 
diff --git a/subed/subed-config.el b/subed/subed-config.el
index 84ee0b3141..e75a2fb90b 100644
--- a/subed/subed-config.el
+++ b/subed/subed-config.el
@@ -47,15 +47,15 @@
 
 (defface subed-id-face
   '((t (:inherit 'font-lock-constant-face)))
-  "Each subtitle's consecutive number")
+  "Each subtitle's consecutive number.")
 
 (defface subed-time-face
   '((t (:inherit 'font-lock-string-face)))
-  "Start and stop times of subtitles")
+  "Start and stop times of subtitles.")
 
 (defface subed-time-separator-face
   '((t (:inherit 'font-lock-comment-face)))
-  "Separator between the start and stop time (\" --> \")")
+  "Separator between the start and stop time (\" --> \").")
 
 (define-obsolete-face-alias 'subed-srt-id-face 'subed-id-face "2022-09-14")
 (define-obsolete-face-alias 'subed-srt-time-face 'subed-time-face "2022-09-14")
@@ -210,9 +210,8 @@ doing so."
   :group 'subed)
 
 (defvar-local subed--point-was-synced nil
-  "When temporarily disabling point-to-player sync, this variable
-remembers whether it was originally enabled by the user.")
-
+  "Remembers whether point-to-player was originally enabled by the user.
+Used when temporarily disabling point-to-player sync.")
 
 (defcustom subed-mpv-socket-dir (concat (temporary-file-directory) "subed")
   "Path to Unix IPC socket that is passed to mpv's --input-ipc-server option."
@@ -276,6 +275,8 @@ Otherwise, adjust the stop time of the current subtitle."
   "Functions to call when a subtitle's start or stop time has changed.
 The functions are called with the subtitle's start time.")
 
+(declare-function subed-subtitle-msecs-start "subed-common" (&optional id))
+
 (defun subed--run-subtitle-time-adjusted-hook ()
   "Run `subed-subtitle-time-adjusted-hook' functions.
 The functions are called with the subtitle's start time."
diff --git a/subed/subed-debug.el b/subed/subed-debug.el
index 2826264a42..048080c6b3 100644
--- a/subed/subed-debug.el
+++ b/subed/subed-debug.el
@@ -54,14 +54,16 @@
     (remove-hook 'kill-buffer-hook #'subed-disable-debugging :local)))
 
 (defun subed-toggle-debugging ()
-  "Display or hide debugging messages in separate window and set 
`debug-on-error' to t or nil."
+  "Display or hide debugging messages in separate window.
+Set `debug-on-error' to t or nil."
   (interactive)
   (if subed-debugging-enabled-p
       (subed-disable-debugging)
     (subed-enable-debugging)))
 
 (defun subed-debug (msg &rest args)
-  "Pass MSG and ARGS to `format' and show the result in debugging buffer if it 
exists."
+  "Pass MSG and ARGS to `format'.
+Show the result in debugging buffer if it exists."
   (when (get-buffer subed-debug-buffer)
     (with-current-buffer (get-buffer-create subed-debug-buffer)
       (setq-local buffer-read-only nil)
diff --git a/subed/subed-mpv.el b/subed/subed-mpv.el
index 4ddc6d0968..9e0457eab4 100644
--- a/subed/subed-mpv.el
+++ b/subed/subed-mpv.el
@@ -30,6 +30,10 @@
 (require 'subed-debug)
 (require 'json)
 
+(declare-function subed-subtitle-id "subed-common" ())
+(declare-function subed-subtitle-msecs-start "subed-common" (&optional id))
+(defvar subed-mpv-frame-step-map)
+
 (defvar-local subed-mpv-is-playing nil
   "Whether mpv is currently playing or paused.")
 
diff --git a/subed/subed-srt.el b/subed/subed-srt.el
index 51412b8a20..7169904409 100644
--- a/subed/subed-srt.el
+++ b/subed/subed-srt.el
@@ -144,7 +144,7 @@ Return point or nil if no stop time could be found.
 Use the format-specific function for MAJOR-MODE."
   (when (subed-jump-to-subtitle-id sub-id)
     (forward-line 1)
-    (re-search-forward " *--> *" (point-at-eol) t)
+    (re-search-forward " *--> *" (line-end-position) t)
     (when (looking-at subed--regexp-timestamp)
       (point))))
 
@@ -196,12 +196,13 @@ Use the format-specific function for MAJOR-MODE."
 
 ;;; Manipulation
 
-(cl-defmethod subed--make-subtitle (&context (major-mode subed-srt-mode) 
&optional id start stop text comment)
+(cl-defmethod subed--make-subtitle (&context (major-mode subed-srt-mode) 
&optional id start stop text _)
   "Generate new subtitle string.
 
 ID, START default to 0.
 STOP defaults to (+ START `subed-subtitle-spacing')
 TEXT defaults to an empty string.
+COMMENT is ignored.
 
 A newline is appended to TEXT, meaning you'll get two trailing
 newlines if TEXT is nil or empty.  Use the format-specific
@@ -219,11 +220,12 @@ function for MAJOR-MODE."
 ID and START default to 0.
 STOP defaults to (+ START `subed-subtitle-spacing')
 TEXT defaults to an empty string.
+COMMENT is ignored.
 
 Move point to the text of the inserted subtitle.
 Return new point.  Use the format-specific function for MAJOR-MODE."
   (subed-jump-to-subtitle-id)
-  (insert (subed-make-subtitle id start stop text))
+  (insert (subed-make-subtitle id start stop text comment))
   (when (looking-at "\\([[:space:]]*\\|^\\)[0-9]+$")
     (insert "\n"))
   (forward-line -2)
@@ -235,6 +237,7 @@ Return new point.  Use the format-specific function for 
MAJOR-MODE."
 ID, START default to 0.
 STOP defaults to (+ START `subed-subtitle-spacing')
 TEXT defaults to an empty string.
+COMMENT is ignored.
 
 Move point to the text of the inserted subtitle.
 Return new point.  Use the format-specific function for MAJOR-MODE."
@@ -248,7 +251,7 @@ Return new point.  Use the format-specific function for 
MAJOR-MODE."
       (save-excursion (insert ?\n)))
     ;; Move to end of separator
     (goto-char (match-end 0)))
-  (insert (subed-make-subtitle id start stop text))
+  (insert (subed-make-subtitle id start stop text comment))
   ;; Complete separator with another newline unless we inserted at the end
   (when (looking-at "\\([[:space:]]*\\|^\\)[0-9]+$")
     (insert ?\n))
@@ -260,7 +263,7 @@ Return new point.  Use the format-specific function for 
MAJOR-MODE."
 Use the format-specific function for MAJOR-MODE."
   (subed-regenerate-ids-soon))
 
-(cl-defmethod subed--split-subtitle :after (&context (major-mode 
subed-srt-mode) &optional offset)
+(cl-defmethod subed--split-subtitle :after (&context (major-mode 
subed-srt-mode) &optional _)
   "Split current subtitle at point.
 Use the format-specific function for MAJOR-MODE."
   (subed-regenerate-ids-soon))
@@ -286,7 +289,8 @@ Use the format-specific function for MAJOR-MODE."
 ;;; Maintenance
 
 (cl-defmethod subed--regenerate-ids (&context (major-mode subed-srt-mode))
-  "Ensure consecutive, unduplicated subtitle IDs."
+  "Ensure consecutive, unduplicated subtitle IDs.
+Format-specific for MAJOR-MODE."
   (atomic-change-group
     (save-excursion
       (goto-char (point-min))
@@ -365,7 +369,7 @@ Use the format-specific function for MAJOR-MODE."
           ;; This regex is stricter than `subed-srt--regexp-timestamp'
           (unless (looking-at 
"^[0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\},[0-9]\\{,3\\}")
             (error "Found invalid start time: %S"  (substring (or 
(thing-at-point 'line :no-properties) "\n") 0 -1)))
-          (when (re-search-forward "[[:blank:]]" (point-at-eol) t)
+          (when (re-search-forward "[[:blank:]]" (line-end-position) t)
             (goto-char (match-beginning 0)))
           (unless (looking-at " --> ")
             (error "Found invalid separator between start and stop time: %S"
@@ -377,13 +381,13 @@ Use the format-specific function for MAJOR-MODE."
             (error "Found invalid stop time: %S" (substring (or 
(thing-at-point 'line :no-properties) "\n") 0 -1))))
         (goto-char orig-point)))))
 
-(cl-defmethod subed--insert-subtitle :after (&context (major-mode 
subed-srt-mode) &optional arg)
-  "Renumber afterwards. Format-specific for MAJOR-MODE."
+(cl-defmethod subed--insert-subtitle :after (&context (major-mode 
subed-srt-mode) &optional _)
+  "Renumber afterwards.  Format-specific for MAJOR-MODE."
   (subed-regenerate-ids-soon)
   (point))
 
-(cl-defmethod subed--insert-subtitle-adjacent :after (&context (major-mode 
subed-srt-mode) &optional arg)
-  "Renumber afterwards. Format-specific for MAJOR-MODE."
+(cl-defmethod subed--insert-subtitle-adjacent :after (&context (major-mode 
subed-srt-mode) &optional _)
+  "Renumber afterwards.  Format-specific for MAJOR-MODE."
   (subed-regenerate-ids-soon)
   (point))
 
diff --git a/subed/subed-vtt.el b/subed/subed-vtt.el
index 6d77ad2693..c2a364968a 100644
--- a/subed/subed-vtt.el
+++ b/subed/subed-vtt.el
@@ -108,9 +108,9 @@ If SUB-ID is specified, jump to that subtitle first.
 Use the format-specific function for MAJOR-MODE."
   (save-excursion
     (subed-jump-to-subtitle-id sub-id)
-    (let ((sub-start-point (point))
-          (prev-end (or (subed-backward-subtitle-end)
-                        (goto-char (point-min)))))
+    (let ((sub-start-point (point)))
+      (or (subed-backward-subtitle-end)
+          (goto-char (point-min)))
       (when (re-search-forward "^\\(NOTE\\(.*\n\\)+\n+\\)" sub-start-point t)
         (match-string 0)))))
 
@@ -168,7 +168,7 @@ If SUB-ID is not given, use subtitle on point.
 Return point or nil if no stop time could be found.
 Use the format-specific function for MAJOR-MODE."
   (when (subed-jump-to-subtitle-time-start sub-id)
-    (re-search-forward " *--> *" (point-at-eol) t)
+    (re-search-forward " *--> *" (line-end-position) t)
     (when (looking-at subed--regexp-timestamp)
       (point))))
 
@@ -247,12 +247,14 @@ Make sure COMMENT ends with a blank line."
         ((string-match "\n" comment) (concat "NOTE\n" comment "\n\n"))
         (t (concat "NOTE " comment))))
 
-(cl-defmethod subed--make-subtitle (&context (major-mode subed-vtt-mode) 
&optional id start stop text comment)
+(cl-defmethod subed--make-subtitle (&context (major-mode subed-vtt-mode)
+                                             &optional _ start stop text 
comment)
   "Generate new subtitle string.
 
-ID, START default to 0.
+START defaults to 0.
 STOP defaults to (+ START `subed-subtitle-spacing')
 TEXT defaults to an empty string.
+ID is ignored.
 
 A newline is appended to TEXT, meaning you'll get two trailing
 newlines if TEXT is nil or empty.  Use the format-specific
@@ -386,7 +388,7 @@ Use the format-specific function for MAJOR-MODE."
           ;; This regex is stricter than `subed--regexp-timestamp'
           (unless (looking-at 
"^\\([0-9]\\{2\\}:\\)?[0-9]\\{2\\}:[0-9]\\{2\\}\\(\\.[0-9]\\{0,3\\}\\)")
             (error "Found invalid start time: %S"  (substring (or 
(thing-at-point 'line :no-properties) "\n") 0 -1)))
-          (when (re-search-forward "[[:blank:]]" (point-at-eol) t)
+          (when (re-search-forward "[[:blank:]]" (line-end-position) t)
             (goto-char (match-beginning 0)))
           (unless (looking-at " --> ")
             (error "Found invalid separator between start and stop time: %S"
diff --git a/subed/subed.el b/subed/subed.el
index f539ccec67..68ec73f3f3 100644
--- a/subed/subed.el
+++ b/subed/subed.el
@@ -1,6 +1,6 @@
 ;;; subed.el --- A major mode for editing subtitles  -*- lexical-binding: t; 
-*-
 
-;; Version: 1.0.23
+;; Version: 1.0.24
 ;; Maintainer: Sacha Chua <sacha@sachachua.com>
 ;; Author: Random User
 ;; Keywords: convenience, files, hypermedia, multimedia
@@ -139,11 +139,15 @@ Key bindings:
   (when subed-auto-play-media
     (add-hook 'subed-mode-hook #'subed-auto-play-media-maybe :append :local)))
 
+(declare-function subed-ass-mode "subed-ass" (&optional arg))
+(declare-function subed-vtt-mode "subed-vtt" (&optional arg))
+(declare-function subed-srt-mode "subed-srt" (&optional arg))
+
 (defun subed-guess-format ()
   "Set this buffer's format to a more specific subed mode format.
 This is a workaround for the transition to using format-specific
 modes such as `subed-srt-mode' while `auto-mode-alist' might
-still refer to `subed-mode'. It will also switch to the
+still refer to `subed-mode'.  It will also switch to the
 format-specific mode if `subed-mode' is called directly."
   (when (and (eq major-mode 'subed-mode)
              (buffer-file-name))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]