diff options
| -rw-r--r-- | emacs/.emacs.d/init/ycp-emms.el | 2 | ||||
| -rw-r--r-- | emacs/.emacs.d/lisp/my/my-emms.el | 30 | ||||
| -rw-r--r-- | emacs/.emacs.d/lisp/my/my-package.el | 2 | 
3 files changed, 16 insertions, 18 deletions
| diff --git a/emacs/.emacs.d/init/ycp-emms.el b/emacs/.emacs.d/init/ycp-emms.el index 08c9d92..b2e8382 100644 --- a/emacs/.emacs.d/init/ycp-emms.el +++ b/emacs/.emacs.d/init/ycp-emms.el @@ -81,7 +81,7 @@      "C-<return>" #'my-emms-playlist-mode-make-current      "w" #'my-emms-playlist-kill-track-name-at-point      "D" #'my-emms-playlist-delete-at-point -    "R" #'my-emms-random-album +    "R" #'my-emms-playlist-random-album      "N" #'my-emms-next-track-or-random-album      )    (add-hook 'emms-player-started-hook 'my-emms-maybe-seek-to-last-played) diff --git a/emacs/.emacs.d/lisp/my/my-emms.el b/emacs/.emacs.d/lisp/my/my-emms.el index e6fb0e2..e3e4d32 100644 --- a/emacs/.emacs.d/lisp/my/my-emms.el +++ b/emacs/.emacs.d/lisp/my/my-emms.el @@ -374,17 +374,20 @@ artist/album/track."                               my-emms-favourites-playlist)))  ;;; random album in emms -(defun my-my-emms-current-album-name () +(defun my-emms-current-album-name ()    (file-name-directory (my-emms-get-current-track-name))) +(defun my-emms-playlist-album-name-at-point () +  (file-name-directory (emms-track-get (emms-playlist-track-at) 'name))) +  (defun my-emms-next-track-or-random-album ()    (interactive) -  (let ((current-album (my-my-emms-current-album-name))) +  (let ((current-album (my-emms-current-album-name)))      (when emms-player-playing-p (emms-stop))      (emms-playlist-current-select-next) -    (if (string-equal (my-my-emms-current-album-name) current-album) +    (if (string-equal (my-emms-current-album-name) current-album)          (emms-start) -      (my-emms-random-album nil)))) +      (my-emms-playlist-random-album nil))))  (defvar-local my-emms-albums-cache (vector)) @@ -415,20 +418,15 @@ under /zzz-seren/."              (elt my-emms-albums-cache (random (length my-emms-albums-cache)))))      album)) -(defun my-emms-random-album (update-album) -  (interactive "P") +(defun my-emms-playlist-random-album () +  (interactive)    (with-current-emms-playlist -    (when (or update-album (length= my-emms-albums-cache 0)) -      (my-emms-save-albums-cache)) -    (when emms-player-playing-p (emms-stop)) -    (let ((saved-position (point))) +    (goto-line (1+ (random (count-lines (point-min) (point-max))))) +    (let ((album-name (my-emms-playlist-album-name-at-point)))        (goto-char (point-min)) -      (if (search-forward -           (my-emms-get-random-album) -           nil t) -          (emms-playlist-mode-play-current-track) -        (goto-char saved-position) -        (error "Cannot play random album"))))) +      (search-forward album-name) +      (beginning-of-line) +      (emms-playlist-mode-play-current-track))))  ;;; override the minor mode  ;;;###autoload diff --git a/emacs/.emacs.d/lisp/my/my-package.el b/emacs/.emacs.d/lisp/my/my-package.el index 9eefa2e..ab3ad77 100644 --- a/emacs/.emacs.d/lisp/my/my-package.el +++ b/emacs/.emacs.d/lisp/my/my-package.el @@ -274,7 +274,7 @@ same name, cancel that one first."      (add-hook hook function)))  (defvar my-common-packages -  '(package windmove consult icomplete isearch +  '(package windmove consult corfu icomplete isearch paredit              my-utils my-buffer my-editing my-complete)    "Common packages to include with any profile") | 
