From 4f3032d0941579a64e2cebdd07c8e46457a43fca Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 2 Oct 2026 14:09:54 -0400 Subject: try to rename the track to B, update the year --- emacsconf-subed.el | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'emacsconf-subed.el') diff --git a/emacsconf-subed.el b/emacsconf-subed.el index 01c08c2..d17298a 100644 --- a/emacsconf-subed.el +++ b/emacsconf-subed.el @@ -337,6 +337,17 @@ Create it if necessary." (error "Duration %d is less than minimum" (- (subed-subtitle-msecs-stop) (subed-subtitle-msecs-start)))) (or (subed-forward-subtitle-text) (goto-char (point-max))))) +;;;###autoload +(defun emacsconf-subed-add-todo (event) + "Append a TODO comment at EVENT." + (interactive "e") + (goto-char (posn-point (event-start event))) + (let ((comment (subed-subtitle-comment))) + (subed-set-subtitle-comment + (if comment + (concat comment "\nTODO") + "TODO")))) + (defun emacsconf-subed-split-at-mouse (event) "Split at the word clicked on." (interactive "e") @@ -369,24 +380,27 @@ Create it if necessary." "\n+" " " (subed-subtitle-text)))) -(defvar emacsconf-subed-split-map - (let ((map (make-sparse-keymap))) - (define-key map [down-mouse-1] #'emacsconf-subed-split-at-mouse) - (define-key map [mouse-1] #'ignore) - (define-key map [up-1] #'ignore) - (define-key map [drag-mouse-1] #'ignore) - (define-key map [mouse-movement] #'ignore) - (define-key map (kbd "M-q") #'emacsconf-subed-unfill-paragraph) - (define-key map (kbd "M-.") #'emacsconf-subed-merge-and-unfill) - (define-key map "q" #'emacsconf-subed-unfill-paragraph) - (define-key map "p" #'subed-backward-subtitle-text) - (define-key map "n" #'subed-forward-subtitle-text) - (define-key map "k" #'subed-kill-subtitle) - (define-key map "." #'emacsconf-subed-merge-and-unfill) - (define-key map "u" #'undo) - (define-key map (kbd "SPC") #'scroll-up) - map) - "Map for splitting.") + +(defvar-keymap emacsconf-subed-split-map + :doc "Shortcuts for splitting and reflowing subtitles." + :repeat t + "" #'emacsconf-subed-add-todo + "" #'ignore + "" #'emacsconf-subed-split-at-mouse + "" #'ignore + "S-" #'emacsconf-subed-add-todo + "" #'ignore + "" #'ignore + "" #'ignore + "M-q" #'emacsconf-subed-unfill-paragraph + "M-." #'emacsconf-subed-merge-and-unfill + "q" #'emacsconf-subed-unfill-paragraph + "p" #'subed-backward-subtitle-text + "n" #'subed-forward-subtitle-text + "k" #'subed-kill-subtitle + "." #'emacsconf-subed-merge-and-unfill + "u" #'undo + "SPC" #'scroll-up) ;;;###autoload (defun emacsconf-subed-split () -- cgit v1.2.3