;;; 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