Closed tuhdo closed 9 years ago
This is related to #4. What is the fix? I don't use daemon mode.
It would help me see the problem if you can show a repro starting from emacs -Q
.
Can you try?
(defun activate-ws-butler ()
(require 'ws-butler)
(add-hook 'prog-mode-hook 'ws-butler-mode))
(add-hook 'after-make-frame-functions 'activate-ws-butler)
I can start the Emacs daemon but ws-butler
won't activate anymore. When I tried to run emacsclient
with the above code, I got this error:
Waiting for Emacs... ERROR: Wrong number of arguments: (lambda nil (require (quote ws-butler)) (add-hook (quote prog-mode-hook) (quote ws-butler-mode))), 1
Normal Emacs starts file. My init.el only contains the above code you suggested.
How to repro the problem from emacs -Q
?
Well, I did start Emacs in clean state using emacs -Q
. But then, I have to save your code in init.el
to test with emacs-- daemon
. Your code is the only thing in init.el
.
The way I use Emacs daemon is like this:
emacs --daemon
. With the above code, the daemon starts fine.emacsclient
to connect to the daemon and do editting. Upon running emacsclient
, this error occurs:Waiting for Emacs... ERROR: Wrong number of arguments: (lambda nil (require (quote ws-butler)) (add-hook (quote prog-mode-hook) (quote ws-butler-mode))), 1
A hook of 'after-make-frame-functions requires an argument (the frame just rendered). This why the activate-ws-butler function above causes an error when starting emacsclient.
However, even if this syntax error is corrected, the suggested solution will not work in all cases because any prog-mode buffers created before the frame is created, .e.g. you are using desktop-save-mode and it reloads them at startup, will not get ws-butler. Only those prog-mode buffers created after the frame is created will do so. Refer to https://github.com/lewang/ws-butler/issues/14 for more details and a suggested workaround.
Refer to #14 for details. https://github.com/lewang/ws-butler/tree/remove-highlight-changes-mode/ is the fix branch being tested.
When ws-butler is activated, it hangs the emacs daemon, prevent it from proceeding further. I used the following config: