[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mpv 8c0933630b 08/50: add seek-to-position-at-point
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mpv 8c0933630b 08/50: add seek-to-position-at-point |
Date: |
Tue, 28 Dec 2021 00:58:34 -0500 (EST) |
branch: elpa/mpv
commit 8c0933630bd52532169d6e6b34143d0697101d6c
Author: Johann Klähn <kljohann@gmail.com>
Commit: Johann Klähn <kljohann@gmail.com>
add seek-to-position-at-point
---
mpv-mode.el | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/mpv-mode.el b/mpv-mode.el
index 5cfba03ce8..0a7b78cb21 100644
--- a/mpv-mode.el
+++ b/mpv-mode.el
@@ -39,9 +39,13 @@
"Name or path to the mpv executable."
:type 'file)
-(defcustom position-format "%H:%M:%S"
- "Format used for inserting playback position."
- :type 'string)
+(defvar -position-format "%H:%M:%S"
+ "Format used for inserting playback position.")
+(defvar -position-regexp
+ (rx (group (repeat 2 num)) ":"
+ (group (repeat 2 num)) ":"
+ (group (repeat 2 num))))
+(defvar -position-skipchars ":[:digit:]")
(defvar -process nil)
(defvar -queue nil)
@@ -142,8 +146,19 @@ drops unsolicited event messages."
(let* ((secs (truncate time))
(usecs (round (* 1000 (- time secs)))))
(with-current-buffer buffer
- (insert (format-time-string position-format
+ (insert (format-time-string -position-format
`(0 ,secs ,usecs 0) t))))))))
+
+(defun seek-to-position-at-point ()
+ "Jump to playback position as inserted by
`mpv-mode-insert-playback-position'."
+ (interactive)
+ (save-excursion
+ (skip-chars-backward -position-skipchars (point-at-bol))
+ (when (looking-at -position-regexp)
+ (let ((hours (string-to-number (match-string 1)))
+ (mins (string-to-number (match-string 2)))
+ (secs (string-to-number (match-string 3))))
+ (-enqueue `("seek" ,(+ (* 3600 hours) (* 60 mins) secs) "absolute")
#'ignore)))))
)
(provide 'mpv-mode)
- [nongnu] elpa/mpv 9dedf3b7c1 34/50: Monkey-patch org-timer-item instead of reimplementing, (continued)
- [nongnu] elpa/mpv 9dedf3b7c1 34/50: Monkey-patch org-timer-item instead of reimplementing, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 174cd4b68b 31/50: call expand-file-name on files passed to mpv-play, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 3849da1e45 01/50: root commit, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 33ca8987ed 03/50: work around spurious event messages, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 6fe510798a 26/50: fix mpv-speed-set, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv fcdca618df 29/50: add badge for MELPA stable, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv d7bb3a7082 40/50: Add sleep and timeout to mpv-kill and mpv-play, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv bc89524528 15/50: use timer formatting from org-timer.el, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv b026ae5bb6 46/50: Merge pull request #19 from c1-g/volume, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 1e666079b8 05/50: skip junk at beginning of buffer, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 8c0933630b 08/50: add seek-to-position-at-point,
ELPA Syncer <=
- [nongnu] elpa/mpv 03fe7a536a 24/50: add mpv-on-start-hook and mpv-on-exit-hook, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 3021c55fa5 32/50: Merge pull request #1 from magnusstahre/expand-tilde, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv f31cbdb94a 37/50: Add convenience functions to get and set properties, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv f0f61db3af 47/50: Add COPYING file following GPL, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 4774d52c8c 48/50: Merge pull request #21 from sachac/master, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 604b32d7e6 11/50: add play command, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 15c51ddc5e 10/50: remove dependency on dash library, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 059135de39 28/50: version 0.1.0, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 9e1781249f 27/50: convert numbers to strings before encoding as JSON, ELPA Syncer, 2021/12/28
- [nongnu] elpa/mpv 79e01bf89b 35/50: Remove stale socket files when mpv process is gone, ELPA Syncer, 2021/12/28