From d96af7fa0231ed697fc3dfbaa42a40a45a93cd3d Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 29 Jan 2022 19:13:21 +0800 Subject: 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. --- subed-conf.el | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 subed-conf.el (limited to 'subed-conf.el') 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: 李俊緯 +;; 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 . + +;;; 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 -- cgit v1.2.3-18-g5258