style: Rename custom functions from slash to dash convention
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
(with-eval-after-load 'dirvish
|
(with-eval-after-load 'dirvish
|
||||||
;; Function to find mtn output file for a given video file in cache directory
|
;; 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."
|
"Find mtn-generated thumbnail for VIDEO-FILE in CACHE-DIR with extension EXT."
|
||||||
(let* ((file-base (file-name-base video-file))
|
(let* ((file-base (file-name-base video-file))
|
||||||
;; mtn generates: [filename].[ext].jpg
|
;; mtn generates: [filename].[ext].jpg
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
(car files)))
|
(car files)))
|
||||||
|
|
||||||
;; Advice to fix the sentinel after mtn generates the thumbnail
|
;; 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."
|
"Advice to rename mtn output to MD5 format after generation."
|
||||||
(let* ((video-path (process-get proc 'path))
|
(let* ((video-path (process-get proc 'path))
|
||||||
(ext (downcase (or (file-name-extension video-path) "")))
|
(ext (downcase (or (file-name-extension video-path) "")))
|
||||||
@@ -30,14 +30,14 @@
|
|||||||
(let* ((width (dirvish-media--img-size (dv-preview-window dv)))
|
(let* ((width (dirvish-media--img-size (dv-preview-window dv)))
|
||||||
(cache (dirvish--img-thumb-name video-path width ".jpg"))
|
(cache (dirvish--img-thumb-name video-path width ".jpg"))
|
||||||
(cache-dir (dirvish--get-parent-path cache))
|
(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)))
|
(when (and mtn-file (file-exists-p mtn-file) (not (file-exists-p cache)))
|
||||||
(rename-file mtn-file cache)))))
|
(rename-file mtn-file cache)))))
|
||||||
;; Call original function
|
;; Call original function
|
||||||
(funcall orig-fun proc exit-code))
|
(funcall orig-fun proc exit-code))
|
||||||
|
|
||||||
;; Apply advice
|
;; 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)
|
(provide 'fix-dirvish-preview)
|
||||||
|
|
||||||
|
|||||||
@@ -84,9 +84,7 @@
|
|||||||
(use-package async
|
(use-package async
|
||||||
:hook
|
:hook
|
||||||
(after-init . dired-async-mode)
|
(after-init . dired-async-mode)
|
||||||
(after-init . async-bytecomp-package-mode)
|
(after-init . async-bytecomp-package-mode)))
|
||||||
:init
|
|
||||||
(setq async-bytecomp-allowed-packages '(all))))
|
|
||||||
|
|
||||||
;; autorevert buffer
|
;; autorevert buffer
|
||||||
(use-package autorevert
|
(use-package autorevert
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
:init
|
:init
|
||||||
(setq prefix-help-command 'embark-prefix-help-command)
|
(setq prefix-help-command 'embark-prefix-help-command)
|
||||||
:config
|
:config
|
||||||
(defun my/embark-preview ()
|
(defun my-embark-preview ()
|
||||||
"Previews candidate in vertico buffer, unless it's a consult command."
|
"Previews candidate in vertico buffer, unless it's a consult command."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless (bound-and-true-p consult--preview-function)
|
(unless (bound-and-true-p consult--preview-function)
|
||||||
@@ -111,11 +111,7 @@ targets."
|
|||||||
:around #'embark-hide-which-key-indicator))))
|
:around #'embark-hide-which-key-indicator))))
|
||||||
|
|
||||||
;; embark-consult
|
;; embark-consult
|
||||||
(use-package embark-consult
|
(use-package embark-consult)
|
||||||
:config
|
|
||||||
(add-hook
|
|
||||||
'embark-collect-mode-hook
|
|
||||||
#'consult-preview-at-point-mode))
|
|
||||||
|
|
||||||
;; eglot
|
;; eglot
|
||||||
(use-package eglot
|
(use-package eglot
|
||||||
|
|||||||
@@ -105,9 +105,9 @@
|
|||||||
(,(kbd "C-/") . [?\C-z])
|
(,(kbd "C-/") . [?\C-z])
|
||||||
(,(kbd "C-?") . ,(kbd "C-S-z"))))
|
(,(kbd "C-?") . ,(kbd "C-S-z"))))
|
||||||
|
|
||||||
(defun my/exwm-update-class ()
|
(defun my-exwm-update-class ()
|
||||||
(exwm-workspace-rename-buffer exwm-class-name))
|
(exwm-workspace-rename-buffer exwm-class-name))
|
||||||
(add-hook 'exwm-update-class-hook #'my/exwm-update-class)
|
(add-hook 'exwm-update-class-hook #'my-exwm-update-class)
|
||||||
|
|
||||||
(require 'exwm-xim)
|
(require 'exwm-xim)
|
||||||
(exwm-xim-mode)
|
(exwm-xim-mode)
|
||||||
|
|||||||
@@ -20,9 +20,10 @@
|
|||||||
(defun disable-truncate-lines ()
|
(defun disable-truncate-lines ()
|
||||||
(toggle-truncate-lines 1))
|
(toggle-truncate-lines 1))
|
||||||
|
|
||||||
(defun my/jinx-smart-toggle ()
|
(defun my-jinx-smart-toggle ()
|
||||||
"Toggle jinx-mode smartly.
|
"Toggle jinx-mode smartly.
|
||||||
Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise toggle global-jinx-mode."
|
Disable jinx-mode if it's enable and global-jinx-mode is disable ,
|
||||||
|
otherwise toggle global-jinx-mode."
|
||||||
(interactive)
|
(interactive)
|
||||||
(unless (featurep 'jinx)
|
(unless (featurep 'jinx)
|
||||||
(require 'jinx))
|
(require 'jinx))
|
||||||
@@ -52,9 +53,13 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
(interactive "fOpen externally: ")
|
(interactive "fOpen externally: ")
|
||||||
(if (and (eq system-type 'windows-nt)
|
(if (and (eq system-type 'windows-nt)
|
||||||
(fboundp 'w32-shell-execute))
|
(fboundp 'w32-shell-execute))
|
||||||
(shell-command-to-string (encode-coding-string (replace-regexp-in-string "/" "\\\\"
|
(shell-command-to-string
|
||||||
(format "explorer.exe %s" (file-name-directory (expand-file-name file))))
|
(encode-coding-string
|
||||||
'gbk))
|
(replace-regexp-in-string "/" "\\\\"
|
||||||
|
(format "explorer.exe %s"
|
||||||
|
(file-name-directory
|
||||||
|
(expand-file-name file))))
|
||||||
|
'gbk))
|
||||||
(call-process (pcase system-type
|
(call-process (pcase system-type
|
||||||
('darwin "open")
|
('darwin "open")
|
||||||
('cygwin "cygstart")
|
('cygwin "cygstart")
|
||||||
@@ -68,11 +73,11 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
(consult-directory-externally default-directory))
|
(consult-directory-externally default-directory))
|
||||||
|
|
||||||
(defun consult-fd-home ()
|
(defun consult-fd-home ()
|
||||||
"Search for all files in home folder use fd."
|
"Search for all files in home folder use fd."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((consult-fd-args "fd -H -I -i -c never --full-path")
|
(let ((consult-fd-args "fd -H -I -i -c never --full-path")
|
||||||
(default-directory "~/"))
|
(default-directory "~/"))
|
||||||
(consult-fd)))
|
(consult-fd)))
|
||||||
|
|
||||||
(defun org-cycle-parent-subtree()
|
(defun org-cycle-parent-subtree()
|
||||||
"Cycle parent org subtree."
|
"Cycle parent org subtree."
|
||||||
@@ -87,7 +92,8 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
(defun my-denote-journal-path-to-existing-entry (&optional date interval)
|
(defun my-denote-journal-path-to-existing-entry (&optional date interval)
|
||||||
"Return the path of current denote journal if it exists, otherwise return nil."
|
"Return the path of current denote journal if it exists, otherwise return nil."
|
||||||
(require 'denote-journal)
|
(require 'denote-journal)
|
||||||
(let* ((internal-date (denote-journal--date-in-interval-p (or date (current-time)) interval))
|
(let* ((internal-date
|
||||||
|
(denote-journal--date-in-interval-p (or date (current-time)) interval))
|
||||||
(files (denote-journal--get-entry internal-date interval)))
|
(files (denote-journal--get-entry internal-date interval)))
|
||||||
(if files
|
(if files
|
||||||
(denote-journal-select-file-prompt files))))
|
(denote-journal-select-file-prompt files))))
|
||||||
@@ -100,9 +106,11 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
(message "No journal for today yet")))
|
(message "No journal for today yet")))
|
||||||
|
|
||||||
(defun my-denote-open-metanote ()
|
(defun my-denote-open-metanote ()
|
||||||
"Open denote metanote in `~/org/my-org-note/20260508T220745==metanote--all-my-metanotes__org.org'"
|
"Open denote metanote in
|
||||||
|
`~/org/my-org-note/20260508T220745==metanote--all-my-metanotes__org.org'"
|
||||||
(interactive)
|
(interactive)
|
||||||
(find-file "~/org/my-org-note/20260508T220745==metanote--all-my-metanotes__org.org"))
|
(find-file
|
||||||
|
"~/org/my-org-note/20260508T220745==metanote--all-my-metanotes__org.org"))
|
||||||
|
|
||||||
(defun org-table-align-all ()
|
(defun org-table-align-all ()
|
||||||
"Ajust all table in current buffer."
|
"Ajust all table in current buffer."
|
||||||
@@ -186,7 +194,8 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
(dired-move-to-filename))
|
(dired-move-to-filename))
|
||||||
|
|
||||||
(defun my-dirvish-layout-toggle ()
|
(defun my-dirvish-layout-toggle ()
|
||||||
"Toggle layout using first recipe in `dirvish-layout-recipes' instead of fallback."
|
"Toggle layout using first recipe in `dirvish-layout-recipes' instead of
|
||||||
|
fallback."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((dv (dirvish-curr)))
|
(let ((dv (dirvish-curr)))
|
||||||
(unless dv (user-error "Not a dirvish buffer"))
|
(unless dv (user-error "Not a dirvish buffer"))
|
||||||
@@ -230,7 +239,8 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
(persp-set-buffer buf))))
|
(persp-set-buffer buf))))
|
||||||
|
|
||||||
(defun my-gptel-agent-project ()
|
(defun my-gptel-agent-project ()
|
||||||
"Run `gptel-agent' in current project's root (by run it with prefix argument)."
|
"Run `gptel-agent' in current project's root (by run it with prefix
|
||||||
|
argument)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((current-prefix-arg '-))
|
(let ((current-prefix-arg '-))
|
||||||
(call-interactively 'gptel-agent)))
|
(call-interactively 'gptel-agent)))
|
||||||
@@ -284,13 +294,13 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog
|
|||||||
(start-process-shell-command "xinput" nil "xinput set-prop 12 'libinput Accel Speed' -0.45"))
|
(start-process-shell-command "xinput" nil "xinput set-prop 12 'libinput Accel Speed' -0.45"))
|
||||||
|
|
||||||
(defun restart-fcitx5 ()
|
(defun restart-fcitx5 ()
|
||||||
"Kill and restart fcitx5, to fix random issues in exwm."
|
"Kill and restart fcitx5, to fix random issues in exwm."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (zerop (shell-command "pgrep fcitx5"))
|
(if (zerop (shell-command "pgrep fcitx5"))
|
||||||
(progn
|
(progn
|
||||||
(eshell-command "pkill fcitx5")
|
(eshell-command "pkill fcitx5")
|
||||||
(eshell-command "fcitx5 -d"))
|
(eshell-command "fcitx5 -d"))
|
||||||
(eshell-command "fcitx5 -d"))))
|
(eshell-command "fcitx5 -d"))))
|
||||||
|
|
||||||
(provide 'init-kbd-func)
|
(provide 'init-kbd-func)
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
(general-def
|
(general-def
|
||||||
:prefix "C-c t"
|
:prefix "C-c t"
|
||||||
"f" 'flycheck-mode
|
"f" 'flycheck-mode
|
||||||
"j" 'my/jinx-smart-toggle
|
"j" 'my-jinx-smart-toggle
|
||||||
"g" 'gptel-mode
|
"g" 'gptel-mode
|
||||||
"h" 'global-diff-hl-mode)
|
"h" 'global-diff-hl-mode)
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
:after org
|
:after org
|
||||||
:demand t
|
:demand t
|
||||||
:hook
|
:hook
|
||||||
(org-mode . org-display-inline-images)
|
(org-mode . org-link-preview-region)
|
||||||
:config
|
:config
|
||||||
(setq-default org-download-image-dir "./images/"
|
(setq-default org-download-image-dir "./images/"
|
||||||
org-download-heading-lvl nil)
|
org-download-heading-lvl nil)
|
||||||
|
|||||||
@@ -66,11 +66,11 @@
|
|||||||
(setq initial-scratch-message
|
(setq initial-scratch-message
|
||||||
"")
|
"")
|
||||||
|
|
||||||
(defun my/scratch-set-mode (&rest _)
|
(defun my-scratch-set-mode (&rest _)
|
||||||
(when (eq major-mode 'fundamental-mode)
|
(when (eq major-mode 'fundamental-mode)
|
||||||
(funcall initial-major-mode)))
|
(funcall initial-major-mode)))
|
||||||
|
|
||||||
(advice-add 'scratch-buffer :after #'my/scratch-set-mode)
|
(advice-add 'scratch-buffer :after #'my-scratch-set-mode)
|
||||||
|
|
||||||
;; 窗口名
|
;; 窗口名
|
||||||
(setq-default frame-title-format '("%b - Emacs"))
|
(setq-default frame-title-format '("%b - Emacs"))
|
||||||
|
|||||||
Reference in New Issue
Block a user