dmitrym0 / org-hyperscheduler

org-hyperscheduler is an Emacs package that helps you organize your day.
GNU General Public License v3.0
188 stars 14 forks source link

[Suggestion] Handle multiple instances of emacs #22

Open lytex opened 1 year ago

lytex commented 1 year ago

Currently if I open two instances of emacs, the use-package call fails because the address is already in use:

Cannot bind server socket: Address already in use

The example README.md could be modified to wrap the use-package call within a with-demoted-errors so that emacs starts up normally, but then org-hyperscheduler-open can be called only from the first instance of emacs.

Should there be an unique server per machine? One server per instance of emacs? Is this wrapper enough?

dmitrym0 commented 1 year ago

Ideally there should be a server per emacs instance.

Are you suggesting something like

(with-demoted-errors "Failed to bind.." 
   (use-package 'org-hyperscheulder...))
natejlong commented 1 year ago

One workaround for this could also be to use emacs in its own server-client mode. If you just want multiple emacs editor windows, then running multiple emacsclient windows that all connect to the single emacs server daemon works extremely well and has other benefits (clients open near instantly, all emacs windows share buffers/state, etc.) So for this problem, the emacs daemon would run the hyperscheduler server, and calls to org-hyperscheduler-open would just open the existing server rather than run a new server.

info on how to use the emacs client/server model, it's very easy to use by default!: https://www.emacswiki.org/emacs/EmacsClient#h5o-4