danielfm / smudge

Control the Spotify app from within Emacs.
https://asciinema.org/a/218654
GNU General Public License v3.0
307 stars 47 forks source link

`smuge-controller` doesn't seem to be defined until I run some command #82

Open alexsieusahai opened 2 years ago

alexsieusahai commented 2 years ago

Hi, great package, mostly no hiccups.

I'm using basically a vanilla spacemacs on the current develop branch.

I totally apologize if I'm missing something obvious btw

I'm trying to rebind stuff like this:

;; keybinds
(with-eval-after-load 'evil
  ;; prev / next
  ;; note; these will return 403 errors if the query doesn't make logical sense;
  ;; if there's nothing previous (like if you selected a track), then it'll return a 403
  (define-key evil-normal-state-local-map (kbd "SPC m j") 'smudge-controller-next-track)
  (define-key evil-normal-state-local-map (kbd "SPC m k") 'smudge-controller-previous-track)

  ;; search
  (define-key evil-normal-state-local-map (kbd "SPC m t /") 'smudge-track-search)
  (define-key evil-normal-state-local-map (kbd "SPC m l /") 'smudge-my-playlists)
  (define-key evil-normal-state-local-map (kbd "SPC m l /") 'smudge-playlist-load-more)

  ;; volume
  (define-key evil-normal-state-local-map (kbd "SPC m v k") 'smudge-controller-volume-up)
  (define-key evil-normal-state-local-map (kbd "SPC m v j") 'smudge-controller-volume-down)

  ;; various toggles
  (define-key evil-normal-state-local-map (kbd "SPC m t p") 'smudge-controller-toggle-play)
  (define-key evil-normal-state-local-map (kbd "SPC m t s") 'smudge-controller-toggle-shuffle)
  (define-key evil-normal-state-local-map (kbd "SPC m t r") 'smudge-controller-toggle-repeat))

But nothing seems to be defined (Symbol's function definition is void: smudge-controller-next-track if I try to eval (smudge-controler-next-track), for example), at least until I run some command, like (smudge-my-playlists).

Indeed, if I append (smudge-my-playlists) to the above keybinds snippet, everything loads fine...

Any idea why this might be the case?

alexsieusahai commented 2 years ago

Btw, my super ugly bandaid fix is just do this

(smudge-my-playlists)
(sleep-for 1)
(kill-buffer "*Playlists: <acc_name>*")

before running the above snippet, if anyone else stumbles upon this and doesn't mind a poor fix in the meanwhile.

sjhuang26 commented 2 years ago

I have encountered the same issue on Spacemacs.

magicaldave commented 1 year ago

This package does NOT play nice with Spacemacs' lazy loading. Doing a manual install should fix this issue, as it did for me.

danielfm commented 8 months ago

I only tested this with Doom and in my old vanilla Emacs dotfiles. So if any Spacemacs user is willing to contribute a fix, I will get it merged.