I have this code to play mp3 files instead of opening them:
(defun ora-mp3 ()
(interactive)
(let ((file (buffer-file-name)))
(kill-buffer (current-buffer))
(ora-dired-start-process (format "rhythmbox \"%s\"" file))))
(add-to-list 'auto-mode-alist '("\\.mp3\\'" . ora-mp3))
Here ora-dired-start-process
is just a variant of shell-command
.
I kind of like using auto-mode-alist
, since it's very granular: only
mp3 files are affected. But the problem is that my window
configuration gets messed up each time ora-mp3
is called.
How could I avoid the problem with the current approach? Or maybe there's another approach that doesn't have this problem?