[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/subed 3c97061 264/389: Add subed--init-alist variable to t
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/subed 3c97061 264/389: Add subed--init-alist variable to track supported formats |
Date: |
Fri, 3 Dec 2021 11:00:38 -0500 (EST) |
branch: elpa/subed
commit 3c970614c769bce02894410da057469c73cc336a
Author: Random User <rndusr@posteo.de>
Commit: Random User <rndusr@posteo.de>
Add subed--init-alist variable to track supported formats
---
subed/subed-config.el | 3 +++
subed/subed.el | 10 +++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/subed/subed-config.el b/subed/subed-config.el
index 9ef10b3..7833d59 100644
--- a/subed/subed-config.el
+++ b/subed/subed-config.el
@@ -36,6 +36,9 @@
(defvar-local subed--subtitle-format nil
"Short form of the name of the subtitle format in the current buffer (e.g.
\"srt\").")
+(defvar subed--init-alist '(("srt" . subed-srt--init))
+ "Alist that maps file extensions to format-specific init functions.")
+
(defvar subed-mode-map
(let ((subed-mode-map (make-keymap)))
(define-key subed-mode-map (kbd "M-n") #'subed-forward-subtitle-text)
diff --git a/subed/subed.el b/subed/subed.el
index 2c94c78..187db6c 100644
--- a/subed/subed.el
+++ b/subed/subed.el
@@ -131,8 +131,16 @@ Key bindings:
(subed-mode-disable)
(subed-mode-enable)))
+;; Internally, supported formats are listed in `subed--init-alist', which
+;; associates file extensions with format-specific init methods (e.g. "srt" ->
+;; subed-srt--init). Here we map each file extension as a regexp to
+;; `subed-mode-enable', which will call the format-specific init method and do
+;; generic init stuff.
;;;###autoload
-(add-to-list 'auto-mode-alist '("\\.srt\\'" . subed-mode-enable))
+(dolist (item subed--init-alist)
+ (let ((file-ext-regex (car item)))
+ (add-to-list 'auto-mode-alist (cons (concat "\\." file-ext-regex "\\'")
+ 'subed-mode-enable))))
(provide 'subed)
;;; subed.el ends here
- [nongnu] elpa/subed 9642945 346/389: Further fixes to let tests pass, (continued)
- [nongnu] elpa/subed 9642945 346/389: Further fixes to let tests pass, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 0968590 344/389: Fix separator search in subed-srt--validate, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 9e661cc 351/389: New command subed-split-subtitle splits at point with MPV timestamp, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed a63c362 252/389: More work on README, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed b5da89e 254/389: Move defgroup to the top, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 7d5c543 255/389: Add function: subed-srt--init, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 3036e7c 256/389: Remove stale comment, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed df51c44 258/389: Rename test file for common functions, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed c1e05c6 259/389: Remove empty line, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 9f0c939 260/389: subed-for-each-subtitle: Make all arguments mandatory, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 3c97061 264/389: Add subed--init-alist variable to track supported formats,
ELPA Syncer <=
- [nongnu] elpa/subed f6acfdd 266/389: Re-order function suffixes, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 50a4717 268/389: Fix tests, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 7f361c2 269/389: Explain "adjust", "move" and "shift" in subed-mode docstring, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d71655f 276/389: Fix parens, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed b740511 277/389: Use mark-active instead of use-region-p, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed e8612e7 279/389: Unify optional argument name, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed d1b308e 280/389: Make subed-subtitle-time-adjusted-hook buffer-local, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 0302aa9 278/389: Move screenshow below introduction, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed c8cf4b7 281/389: Don't insert too many mock subtitles, ELPA Syncer, 2021/12/03
- [nongnu] elpa/subed 3245922 282/389: Focus correct subtitle, ELPA Syncer, 2021/12/03