diff options
Diffstat (limited to 'subed-conf.el')
-rw-r--r-- | subed-conf.el | 55 |
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 |