lewang / ws-butler

Unobtrusively trim extraneous white-space *ONLY* in lines edited.
242 stars 26 forks source link

ws-butler inhibits emacs daemon #4

Closed PythonNut closed 10 years ago

PythonNut commented 10 years ago

My emacs daemon was failing, so I started disassembling my .emacs.d. If I strip my .emacs to this

(require 'package)
(ws-butler-global-mode +1)

Launching emacs --daemon fails to start (hangs), with this error:

Error in post-command-hook (ws-butler-global-mode-check-buffers): (error "X windows are not in use or not initialized")

This is the minimal setup that reproduces this.

mrvdb commented 10 years ago

I was able to solve this problem by moving the enabling of 'ws-butler-global-mode' to a function that gets hooked into 'server-visit-hook' like so

(add-hook 'server-visit-hook 'run-settings-functions-which-require-client)

If this could be transparent, that would be nice, but the workaround works fine.

lewang commented 10 years ago

Do you understand the root cause of the hang?

On Thu, Mar 27, 2014 at 7:15 AM, Marcel van der Boom < notifications@github.com> wrote:

I was able to solve this problem by moving the enabling of 'ws-butler-global-mode' to a function that gets hooked into 'server-visit-hook' like so

(add-hook 'server-visit-hook 'run-settings-functions-which-require-client)

If this could be transparent, that would be nice, but the workaround works fine.

Reply to this email directly or view it on GitHubhttps://github.com/lewang/ws-butler/issues/4#issuecomment-38791055 .

Le

mrvdb commented 10 years ago

I'm not sure what ws-butler does in the post-command-hook, but my experience is that many 'visual-like' settings will not work, using normal initialisation, when using the emacs daemon. The reason for this is that there might not be an X display yet/at all.

I have quite a few settings which need to run when the server-visit hook runs (menu-bar-mode, some face attributes, fringe-related stuff etc.), although I must admit I don't have a firm rule on which things will fail and which won't.

lewang commented 10 years ago

I see no clear way to resolve this. Closing for now, but a PR is always welcome.