From ccecfedc1eadb71222846b795f0725cedd99beb6 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 23 Oct 2025 00:02:54 -0500 Subject: refactor(dwim-shell-config): Reorganize and remove redundant code Remove redundant function declarations and reorganize key binding logic for better clarity and maintainability. Bind `dwim-shell-commands-menu` to `dired-mode-map` directly within `use-package`.refactor(dwim-shell-config): Remove redundant function declarations Remove unused function declarations and move the key binding setup to an appropriate section. Change the `use-package` directive to load `dwim-shell-command` only after `dired` to ensure proper initialization. --- modules/dwim-shell-config.el | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/modules/dwim-shell-config.el b/modules/dwim-shell-config.el index 18b03ebc..9c42c9a6 100644 --- a/modules/dwim-shell-config.el +++ b/modules/dwim-shell-config.el @@ -90,25 +90,16 @@ (require 'cl-lib) -;; Declare variable from dired -(defvar dired-mode-map) -;; Declare functions from dwim-shell-command -(declare-function dwim-shell-command-on-marked-files "dwim-shell-command") -(declare-function dwim-shell-command--files "dwim-shell-command") -(declare-function dwim-shell-command-read-file-name "dwim-shell-command") - -;; Declare functions from system-utils -(declare-function cj/xdg-open "system-utils") -(declare-function cj/open-file-with-command "system-utils") - -;; Declare function defined in use-package :config below -(declare-function dwim-shell-commands-menu "dwim-shell-config") +;; Bind menu to dired (after dwim-shell-command loads) +(with-eval-after-load 'dwim-shell-command + (with-eval-after-load 'dired + (keymap-set dired-mode-map "M-D" #'dwim-shell-commands-menu))) ;; ----------------------------- Dwim Shell Command ---------------------------- (use-package dwim-shell-command - :defer t + :after dired :bind ((" " . dwim-shell-command) :map dired-mode-map (" " . dwim-shell-command) @@ -820,10 +811,5 @@ gpg: decryption failed: No pinentry" (when command (call-interactively command))))) -;; Bind menu to dired (after dwim-shell-command loads) -(with-eval-after-load 'dwim-shell-command - (with-eval-after-load 'dired - (keymap-set dired-mode-map "M-D" #'dwim-shell-commands-menu))) - (provide 'dwim-shell-config) ;;; dwim-shell-config.el ends here. -- cgit v1.2.3