diff options
| author | Craig Jennings <c@cjennings.net> | 2025-10-23 00:02:54 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-10-23 00:02:54 -0500 |
| commit | ccecfedc1eadb71222846b795f0725cedd99beb6 (patch) | |
| tree | d20bf9cac54658d36cd212d8253a3cd64a264374 | |
| parent | 60ae04b619382615b5117cea8cb402c3160ca31f (diff) | |
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.
| -rw-r--r-- | modules/dwim-shell-config.el | 24 |
1 files 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 (("<remap> <shell-command>" . dwim-shell-command) :map dired-mode-map ("<remap> <dired-do-async-shell-command>" . 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. |
