summaryrefslogtreecommitdiff
path: root/subed-conf.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-01-29 19:13:21 +0800
committerJSDurand <mmemmew@gmail.com>2022-01-29 19:13:42 +0800
commitd96af7fa0231ed697fc3dfbaa42a40a45a93cd3d (patch)
tree7dd802d86356c2784bdabbee540d89bd4cf1987c /subed-conf.el
parent9a665974c00bec7848e49b2e87a93e21f6cc4241 (diff)
Refactor: save something and tidy things up.
* bongo.el: Try to implement a mechanism to play subtitles along with the music, but it is not yet finished. * subed-conf.el: Make it work. * text-conf.el (insert-section-heading): Delete unnecessary debugging mechanisms.
Diffstat (limited to 'subed-conf.el')
-rw-r--r--subed-conf.el55
1 files changed, 55 insertions, 0 deletions
diff --git a/subed-conf.el b/subed-conf.el
new file mode 100644
index 0000000..f9404ad
--- /dev/null
+++ b/subed-conf.el
@@ -0,0 +1,55 @@
+;;; subed-conf.el --- Configurations of Subed -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Durand
+
+;; Author: 李俊緯 <mmemmew@gmail.com>
+;; Keywords: convenience, multimedia, data
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; My configurations of the superb package subed:
+;; https://github.com/sachac/subed
+
+;;; Code:
+
+(use-package "subed/subed" 'subed)
+
+;;; Use a shorter name for the socket
+
+(setq subed-mpv-socket-dir "/tmp/")
+
+;; Make some modifications so that mpv works
+
+(defun durand-subed-mpv--socket ()
+ "Path to mpv's RPC socket for a particular buffer.
+See also `subed-mpv-socket-dir'."
+ (unless (file-exists-p subed-mpv-socket-dir)
+ (condition-case err
+ (make-directory subed-mpv-socket-dir :create-parents)
+ (file-error
+ (error "%s" (mapconcat #'identity (cdr err) ": ")))))
+ (concat (file-name-as-directory subed-mpv-socket-dir)
+ (truncate-string-to-width
+ (format "%s%s"
+ (let ((filename (file-name-sans-extension (subed--buffer-file-name))))
+ (substring (substring filename 0 (min (length filename) 20))))
+ (buffer-hash))
+ 15)))
+
+(advice-add #'subed-mpv--socket :override #'durand-subed-mpv--socket)
+
+(provide 'subed-conf)
+;;; subed-conf.el ends here