mihaiolteanu / vuiet

The music player and explorer for Emacs
https://mihaiolteanu.me/vuiet
GNU General Public License v3.0
278 stars 15 forks source link

emacsclient crashes when re-opening it while music is playing #10

Closed marben-olvbar closed 4 years ago

marben-olvbar commented 4 years ago

I'm using the emacs server (started by running emacs --daemon together with emacsclient.

After I start some track through any of the supported means and then close the emacsclient afterwards, it is not possible to open any emacsclient frame anymore due to the following error:

*ERROR*: Wrong type argument: listp, "<Band> - <Track> "

While I haven't had the time to investigate the cause further, I suspect that it might be a problem with the function setting the currently playing track in the modeline.

If you require any further information I will try my best to provide it.

PS: I found this on HN and its really cool, thanks for making vuiet :)

mihaiolteanu commented 4 years ago

Just to be sure, you're doing the following steps,

  1. run emacs --daemon on the command line
  2. run emacsclient -c on the command line
  3. you load or require the vuiet package by some means
  4. you call vuiet-play-artist, for example
  5. you close the emacsclient
  6. you run emacsclient -c on the command line again
  7. you get the error you've specified above

Is this correct? I've tried these steps and I don't get any error. I've also tried it in non-gui mode, with emacsclient -nw. Still no luck. Feel free to correct any steps from the above if I've missed something.

mihaiolteanu commented 4 years ago

I found this on HN and its really cool, thanks for making vuiet :)

I'm glad you're finding it useful. :)

marben-olvbar commented 4 years ago

I investigated the issue further and found that the problem results from the doom-modeline I'm using.

Below is a minimal configuration file to reproduce the issue (by the way I had to explicitly install org-ref when using a clean emacs26 installation on ubuntu 19, maybe this should be a dependency for the package?):

(package-initialize)

(require 'package)

(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/") t)
(custom-set-variables
 '(package-selected-packages (quote (doom-modeline org-ref vuiet))))
(custom-set-faces)

(require 'vuiet)
(require 'doom-modeline)

;; to fix an issue with not fully loaded theme when running emacsclient
(if (daemonp)
    (add-hook
     'after-make-frame-functions
     (lambda (frame)
       (when (eq (length (frame-list)) 2)
         (progn
           (select-frame frame)
           (doom-modeline-init)))))
  (doom-modeline-init))

This whole after-make-frame-functions hook thing is needed because of an issue with theme loading when using emacsclient, see this for more information.

I tried to track down the root cause by using the debugger to track the doom-modeline-init function, but I wasn't able to find the exact crashing call, because the frame would simply close most of the time.

Unfortunately I haven't done much debugging in emacs yet, so it is quite probable that I'm missing something.

Do you have any suggestion how to further troubleshoot this?

mihaiolteanu commented 4 years ago

Fixed it. I've managed to reproduced it using your init file suggestion. Your report was correct and very useful. Thanks for taking the time to debug this.

Please try it and let me know if it solves your problem (there should be a new vuiet version from melpa that you can install).

marben-olvbar commented 4 years ago

I can confirm that this fix solves the problem for me. Thanks for the quick fix, I'm closing this issue now.