style: Rename custom functions from slash to dash convention

This commit is contained in:
2026-06-27 09:15:48 +08:00
parent 33ced00fc4
commit 315fb0ef87
8 changed files with 45 additions and 41 deletions

View File

@@ -9,7 +9,7 @@
(with-eval-after-load 'dirvish
;; Function to find mtn output file for a given video file in cache directory
(defun my/dirvish-find-mtn-output (video-file cache-dir ext)
(defun my-dirvish-find-mtn-output (video-file cache-dir ext)
"Find mtn-generated thumbnail for VIDEO-FILE in CACHE-DIR with extension EXT."
(let* ((file-base (file-name-base video-file))
;; mtn generates: [filename].[ext].jpg
@@ -18,7 +18,7 @@
(car files)))
;; Advice to fix the sentinel after mtn generates the thumbnail
(defun my/dirvish-media--cache-sentinel-advice (orig-fun proc exit-code)
(defun my-dirvish-media--cache-sentinel-advice (orig-fun proc exit-code)
"Advice to rename mtn output to MD5 format after generation."
(let* ((video-path (process-get proc 'path))
(ext (downcase (or (file-name-extension video-path) "")))
@@ -30,14 +30,14 @@
(let* ((width (dirvish-media--img-size (dv-preview-window dv)))
(cache (dirvish--img-thumb-name video-path width ".jpg"))
(cache-dir (dirvish--get-parent-path cache))
(mtn-file (my/dirvish-find-mtn-output video-path cache-dir ext)))
(mtn-file (my-dirvish-find-mtn-output video-path cache-dir ext)))
(when (and mtn-file (file-exists-p mtn-file) (not (file-exists-p cache)))
(rename-file mtn-file cache)))))
;; Call original function
(funcall orig-fun proc exit-code))
;; Apply advice
(advice-add 'dirvish-media--cache-sentinel :around #'my/dirvish-media--cache-sentinel-advice))
(advice-add 'dirvish-media--cache-sentinel :around #'my-dirvish-media--cache-sentinel-advice))
(provide 'fix-dirvish-preview)