summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-11-24 05:54:37 -0800
committerCraig Jennings <c@cjennings.net>2025-11-24 05:54:37 -0800
commitc0066af134cb0ffb21889b455963c6917fd690e7 (patch)
tree234df34ee4405028e2a95bb5312ef8ffb776be8f
parent42a649d38043dfe5aee15e3fc2d6dcce4483cd40 (diff)
feat(dwim-shell): fix M-D menu binding and enhance audio extraction
- Fix dwim-shell-commands-menu keybinding in dirvish/dired - Remove :after (dired dirvish) which prevented package loading - Add :demand t to load package immediately at startup - Move keybindings inside :config block after menu function definition - M-D now works immediately in dirvish without manual trigger - Enhance extract-audio-from-video function - Fix :extensions parameter (was regex string, now proper list) - Change from copy to AAC re-encoding for codec compatibility - Add interactive bitrate selection (64k/96k/128k/192k) - Fixes Opus codec compatibility issues with M4A containers - Remove conflicting keybindings - Remove music-config p binding in dirvish (was overriding path copy) - Clean up extraneous requires/hooks from troubleshooting - Add TODO for dwim-shell-command status dashboard [#D priority] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
-rw-r--r--modules/dirvish-config.el15
-rw-r--r--modules/dwim-shell-config.el28
-rw-r--r--modules/music-config.el4
-rw-r--r--todo.org92
4 files changed, 95 insertions, 44 deletions
diff --git a/modules/dirvish-config.el b/modules/dirvish-config.el
index fc399d11..5577b9f1 100644
--- a/modules/dirvish-config.el
+++ b/modules/dirvish-config.el
@@ -14,10 +14,10 @@
;; - G: Search with deadgrep in current directory
;; - f: Open system file manager in current directory
;; - o/O: Open file with xdg-open/custom command
-;; - l: Copy file path (project-relative or home-relative)
-;; - L: Copy absolute file path
-;; - P: Copy file path (same as 'l', replaces dired-do-print)
-;; - M-D: DWIM menu (context actions for files)
+;; - l: Copy org-link with relative file path (project-relative or home-relative)
+;; - p: Copy absolute file path
+;; - P: Copy relative file path (project-relative or home-relative)
+;; - M-S-d (Meta-Shift-d): DWIM shell commands menu
;; - TAB: Toggle subtree expansion
;; - F11: Toggle sidebar view
@@ -314,9 +314,8 @@ regardless of what file or subdirectory the point is on."
("C-." . dirvish-history-go-forward)
("F" . dirvish-file-info-menu)
("G" . revert-buffer)
- ("l" . (lambda () (interactive) (cj/dired-copy-path-as-kill))) ;; overwrites dired-do-redisplay
- ("L" . (lambda () (interactive) (cj/dired-copy-path-as-kill nil t))) ;; copy absolute path
("h" . cj/dirvish-open-html-in-eww) ;; it does what it says it does
+ ("l" . (lambda () (interactive) (cj/dired-copy-path-as-kill t nil))) ;; copy as org-link, relative path
("M" . cj/dired-mark-all-visible-files)
("M-e" . dirvish-emerge-menu)
("M-l" . dirvish-ls-switches-menu)
@@ -330,8 +329,9 @@ regardless of what file or subdirectory the point is on."
("g" . dirvish-quick-access)
("o" . cj/xdg-open)
("O" . cj/open-file-with-command) ; Prompts for command to run
+ ("p" . (lambda () (interactive) (cj/dired-copy-path-as-kill nil t)))
+ ("P" . (lambda () (interactive) (cj/dired-copy-path-as-kill)))
("r" . dirvish-rsync)
- ("P" . cj/dired-copy-path-as-kill)
("s" . dirvish-quicksort)
("v" . dirvish-vc-menu)
("y" . dirvish-yank-menu)))
@@ -429,5 +429,6 @@ Returns nil if not in a project."
(t nil)))
+
(provide 'dirvish-config)
;;; dirvish-config.el ends here.
diff --git a/modules/dwim-shell-config.el b/modules/dwim-shell-config.el
index a05646b2..1881f791 100644
--- a/modules/dwim-shell-config.el
+++ b/modules/dwim-shell-config.el
@@ -90,16 +90,10 @@
(require 'cl-lib)
-
-;; 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
- :after (dired dirvish)
+ :demand t
:bind (("<remap> <shell-command>" . dwim-shell-command)
:map dired-mode-map
("<remap> <dired-do-async-shell-command>" . dwim-shell-command)
@@ -606,10 +600,14 @@ in process lists or command history."
(defun cj/dwim-shell-commands-extract-audio-from-video ()
"Extract audio track from video file(s)."
(interactive)
- (dwim-shell-command-on-marked-files
- "Extract audio"
- "ffmpeg -i '<<f>>' -vn -acodec copy '<<fne>>.m4a'"
- :utils "ffmpeg"))
+ (let ((bitrate (completing-read "Audio bitrate: "
+ '("64k" "96k" "128k" "192k")
+ nil t)))
+ (dwim-shell-command-on-marked-files
+ "Extract audio"
+ (format "ffmpeg -i '<<f>>' -vn -c:a aac -b:a %s '<<fne>>.m4a'" bitrate)
+ :utils "ffmpeg"
+ :extensions '("mp4" "mkv" "webm" "avi" "mov" "flv" "wmv" "m4v" "mpg" "mpeg" "ogv" "3gp" "ts"))))
(defun cj/dwim-shell-commands-normalize-audio-volume ()
"Normalize audio volume in file(s)."
@@ -809,7 +807,13 @@ gpg: decryption failed: No pinentry"
'dwim-shell-command-history))
(command (alist-get selected command-alist nil nil #'string=)))
(when command
- (call-interactively command)))))
+ (call-interactively command))))
+
+ ;; Bind menu to keymaps after function is defined
+ (with-eval-after-load 'dired
+ (keymap-set dired-mode-map "M-D" #'dwim-shell-commands-menu))
+ (with-eval-after-load 'dirvish
+ (keymap-set dirvish-mode-map "M-D" #'dwim-shell-commands-menu)))
(provide 'dwim-shell-config)
;;; dwim-shell-config.el ends here.
diff --git a/modules/music-config.el b/modules/music-config.el
index 0994bf82..f60ff36a 100644
--- a/modules/music-config.el
+++ b/modules/music-config.el
@@ -407,9 +407,7 @@ Dirs added recursively."
((file-directory-p file) (cj/music-add-directory-recursive file))
((cj/music--valid-file-p file) (emms-add-file file))
(t (message "Skipping non-music file: %s" file))))
- (message "Added %d item(s) to playlist" (length files))))
-
- (keymap-set dirvish-mode-map "p" #'cj/music-add-dired-selection))
+ (message "Added %d item(s) to playlist" (length files)))))
;;; EMMS setup and keybindings
diff --git a/todo.org b/todo.org
index 99704df1..42e64c79 100644
--- a/todo.org
+++ b/todo.org
@@ -26,28 +26,6 @@ High priority - daily pain point.
Daily workflow improvement.
-** DONE [#B] Toggle org-appear on/off
-CLOSED: [2025-11-16 Sat]
-
-✅ **Implemented toggle function with C-c C-a keybinding**
-
-Created `cj/org-appear-toggle` function that toggles org-appear-mode on/off in
-current org buffer. Default is OFF (cleaner for reading), can be toggled ON when
-editing links, then toggled OFF again.
-
-**Implementation:**
-- Removed :disabled flag and :hook (default: OFF)
-- Created cj/org-appear-toggle function with clear user feedback
-- Bound to C-c C-a in org-mode-map (unbound, no conflicts)
-- Tested: toggles correctly, all tests pass
-
-**Usage:**
-- C-c C-a: Toggle on/off
-- Default: OFF (links and emphasis markers stay hidden)
-- Messages show current state clearly
-
-Moved from inbox 2025-11-07. Completed 2025-11-16.
-
** TODO [#B] Optimize org-agenda performance using built-in profiler
THE BOTTLENECK. Currently 30+ seconds, target < 5 seconds.
@@ -523,6 +501,28 @@ CLOSED: [2025-11-08 Fri]
- No lag, even in large files
- Maintains same "L:line C:col" format
+** DONE [#B] Toggle org-appear on/off
+CLOSED: [2025-11-16 Sat]
+
+✅ **Implemented toggle function with C-c C-a keybinding**
+
+Created `cj/org-appear-toggle` function that toggles org-appear-mode on/off in
+current org buffer. Default is OFF (cleaner for reading), can be toggled ON when
+editing links, then toggled OFF again.
+
+**Implementation:**
+- Removed :disabled flag and :hook (default: OFF)
+- Created cj/org-appear-toggle function with clear user feedback
+- Bound to C-c C-a in org-mode-map (unbound, no conflicts)
+- Tested: toggles correctly, all tests pass
+
+**Usage:**
+- C-c C-a: Toggle on/off
+- Default: OFF (links and emphasis markers stay hidden)
+- Messages show current state clearly
+
+Moved from inbox 2025-11-07. Completed 2025-11-16.
+
** DONE [#B] Consider implementing cron download of Google Calendar to replace org-gcal
CLOSED: [2025-11-16 Sat]
@@ -1428,6 +1428,54 @@ CLOSED: [2025-11-12 Wed 02:41] SCHEDULED: <2025-11-03 Sun>
Review this inbox, cancel stale items, keep < 20 active. Track in calendar.
* Emacs Config Inbox
+** TODO [#D] Add status dashboard for dwim-shell-command processes
+
+Create a command to show all running dwim-shell-command processes with their status.
+Currently, there's no unified view of multiple running extractions/conversions.
+
+**Current behavior:**
+- Each command shows spinner in minibuffer while running
+- Process buffers created: `*Extract audio*`, etc.
+- On completion: buffer renamed to `*Extract audio done*` or `*Extract audio error*`
+- No way to see all running processes at once
+
+**Implementation approaches:**
+
+1. **Use existing process list (simplest):**
+ - Enhance `M-x list-processes` output filtering
+ - Create wrapper command that filters to dwim-shell processes only
+ - Pro: Uses built-in functionality
+ - Con: Generic process list, not tailored
+
+2. **Custom status buffer:**
+ - Create command `dwim-shell-commands-status` or similar
+ - Access `dwim-shell-command--commands` variable (tracks all running commands)
+ - Display in custom buffer with:
+ - Command name
+ - Files being processed
+ - Progress/status
+ - Time running
+ - Allow actions: view buffer, kill process
+ - Pro: Tailored UI, more useful information
+ - Con: More code to maintain
+
+3. **Mode-line indicator:**
+ - Show count of running dwim commands in mode-line
+ - Click to open status buffer
+ - Pro: Always visible, lightweight
+ - Con: Limited information at a glance
+
+**Recommended approach:**
+Start with option 2 (custom status buffer) that reads `dwim-shell-command--commands`.
+Can add mode-line indicator later as enhancement.
+
+**Files to create/modify:**
+- modules/dwim-shell-config.el - add status command
+
+** TODO [#C] Create print function for dirvish bound to uppercase P
+
+Add a print function that works on printable files (PDF, txt, org, etc.) and bind it to uppercase P in dirvish-mode. Should detect file type and use appropriate print command (lpr for text files, print dialog for PDFs, etc.).
+
** TODO [#C] Review and implement flycheck modeline customization spec
Add flycheck status (error/warning counts) to custom modeline to make it visible again.